Skip to content

Commit 9ddf614

Browse files
Merge pull request #24 from JavaScriptSolidServer/issue-23-public-tab
Relays page: replace 'Writable' tab with 'Public' (online + writable + open)
2 parents 8c284a0 + 8cf4b07 commit 9ddf614

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ <h2>${esc(c.name || short(pk))}</h2>
359359
const RTABS = [
360360
{ key: 'all', label: 'All' },
361361
{ key: 'online', label: 'Online' },
362-
{ key: 'writable', label: 'Writable' },
362+
{ key: 'public', label: 'Public' },
363363
{ key: 'paid', label: 'Paid' },
364364
{ key: 'auth', label: 'Auth' },
365365
];

src/db.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ const RELAY_FIELDS = {
120120
const RELAY_FILTERS = {
121121
all: {},
122122
online: { online: true },
123-
writable: { acceptsEvents: true },
123+
// "public" = reachable, accepts events, and open to anyone (no pay/auth).
124+
public: { online: true, acceptsEvents: true, requiresPayment: { $ne: true }, requiresAuth: { $ne: true } },
124125
paid: { requiresPayment: true },
125126
auth: { requiresAuth: true },
126127
};
@@ -143,7 +144,7 @@ export async function relaysDirectory({ filter = 'online', sort = 'recent', limi
143144
$facet: {
144145
all: count(RELAY_FILTERS.all),
145146
online: count(RELAY_FILTERS.online),
146-
writable: count(RELAY_FILTERS.writable),
147+
public: count(RELAY_FILTERS.public),
147148
paid: count(RELAY_FILTERS.paid),
148149
auth: count(RELAY_FILTERS.auth),
149150
newest: [{ $sort: { lastChecked: -1 } }, { $limit: 1 }, { $project: { _id: 0, lastChecked: 1 } }],
@@ -152,7 +153,7 @@ export async function relaysDirectory({ filter = 'online', sort = 'recent', limi
152153
}]).toArray();
153154
const n = (k) => res?.[k]?.[0]?.n || 0;
154155
return {
155-
counts: { all: n('all'), online: n('online'), writable: n('writable'), paid: n('paid'), auth: n('auth') },
156+
counts: { all: n('all'), online: n('online'), public: n('public'), paid: n('paid'), auth: n('auth') },
156157
lastChecked: res?.newest?.[0]?.lastChecked || null,
157158
relays: res?.page || [],
158159
};

0 commit comments

Comments
 (0)