Add or change a discovery site
- The Invite view gets its discovery links from
src/content/communities.json. - The backend embeds this file at build time and sends the visible entries in
data.communities. - The page does not fetch another file.
- These are community links. Listing a site does not imply a partnership.
Change the list
Each entry has four fields:
json
{
"id": "example-gallery",
"name": "Example Gallery",
"url": "https://example.com/pets/",
"visible": true
}| Field | Rule |
|---|---|
id | Unique and stable; lowercase ASCII letters, digits and hyphens |
name | The site's proper name |
url | Public HTTPS, no credentials, the default HTTPS port |
visible | false hides the entry |
- The example only shows the shape. Do not add it to the shipped list.
- Entries show in array order.
- To hide an entry, set
visibletofalseor remove its record.- A hidden or removed entry no longer lets
openExternalopen its URL. - If another visible entry allows the same host or repository, that permission stays.
- A hidden or removed entry no longer lets
What a link permits:
- An ordinary host: HTTPS paths on that exact origin.
github.comand*.github.io: the target also has to stay at or below the listed path.- A listed
https://github.com/team/petsdoes not permithttps://github.com/team/pets-otheror another repository.
- A listed
- This URL check does not cover how the external browser handles redirects.
Checks:
- The parser rejects duplicate IDs, invalid URLs and unknown fields.
- Tests check the bundled file.
- A malformed bundled registry fails closed at runtime: the app shows no discovery links.
Keep discovery separate from importing
Known IDs:
openpets,petdex,github,codexpetandcodex-petsname the existing import adapters insrc-tauri/src/pets/importer/sites.rs.- Keep these IDs when you change how the matching site is presented.
- The backend adds their localized hints and
importable: trueonly when both the ID and the URL match the trusted adapter origin (and, on GitHub, the repository path). - A known ID with an unrelated URL becomes a browse-only entry.
New IDs:
- A new ID is browse-only: it gets
importable: falseand an empty hint. - The Invite view explains it with its localized browse-only text.
- Adding that discovery link needs no page or Rust change.
- The flag describes the listed integration. It does not turn off the generic URL importer.
What a discovery record does not change:
- Hiding, removing or reordering a record does not remove its import adapter.
- People can still paste supported pet addresses.
- Pets already imported keep working.
- A record cannot pick an import route or add a trusted sprite host.
- A specialized adapter is a separate code change, with network fixtures and security tests.
- The importer still enforces its own HTTPS, same-site, redirect and private-address rules.
Bootstrap entries:
- They contain
id,name,url,hintandimportable. - Hidden entries are left out.
- The JSON file holds presentation data only. It is not a runtime URL editor or a remote registry.
Check the change
- Run the importer tests (parser, browser-opening boundaries and import fixtures):
cargo test --manifest-path src-tauri/Cargo.toml pets::importer::tests. - Run the repository's normal tests and lint checks.
- Rebuild the app so it picks up the embedded JSON.
- In the app, check the order of the Invite list and the browse-only explanation.
- If you changed this guide, also run
pnpm run site:buildto check the developer documentation.