Checkpoint peering identity and opt-in discovery
This commit is contained in:
1 parent
eba9b50e30
commit
47de081721
44 files changed
+1557
-55
No files matched your search
+10
-2
@@ -94,15 +94,23 @@ function topNav(me) {
|
||||
const bell = h('button', { class: 'btn icon bell', title: 'Notifications', 'aria-label': 'Notifications', onclick: e => { e.stopPropagation(); open(); } }, icon(ICONS.bell), count);
|
||||
panel.addEventListener('click', e => e.stopPropagation());
|
||||
document.addEventListener('click', () => { panel.hidden = true; });
|
||||
const settingsLink = h('a', { class: 'btn', href: 'settings.html' }, 'Settings');
|
||||
const nav = h('header', { class: 'nav' },
|
||||
h('a', { class: 'brand', href: './' }, 'MangaCircus'),
|
||||
h('a', { class: 'btn nav-greatest', href: 'greatest.html', title: 'Shijō Saikō no Manga · Greatest of All Time', 'aria-label': 'Shijō Saikō no Manga' }, 'Shijō Saikō no Manga'),
|
||||
h('a', { class: 'btn', href: 'discover.html' }, 'Discover'),
|
||||
h('div', { class: 'grow' }),
|
||||
h('div', { class: 'bell-wrap' }, bell, panel),
|
||||
...(me.admin ? [h('a', { class: 'btn', href: 'peer-catalog.html' }, 'Peer catalogs')] : []),
|
||||
h('a', { class: 'btn', href: 'settings.html' }, 'Settings'),
|
||||
settingsLink,
|
||||
h('button', { class: 'btn', onclick: async () => { await api('api/logout', {}); location.href = 'login.html'; } }, 'Log out'));
|
||||
document.body.prepend(nav);
|
||||
if (me.admin) {
|
||||
api('api/admin/peering').then(state => {
|
||||
if (state.peers?.length && nav.isConnected) {
|
||||
nav.insertBefore(h('a', { class: 'btn', href: 'peer-catalog.html' }, 'Peer catalogs'), settingsLink);
|
||||
}
|
||||
}).catch(() => {}).finally(() => { nav.dataset.peerCatalogResolved = 'true'; });
|
||||
} else nav.dataset.peerCatalogResolved = 'true';
|
||||
}
|
||||
|
||||
function showError(e) {
|
||||
|
||||
Reference in new issue
Block a user