forked from unimatrix/web
Publish Federal Reserve currency collection and editorial menu controls
This commit is contained in:
parent
04730a1323
commit
db61e7ad6c
1 changed files with 432 additions and 200 deletions
|
|
@ -23,6 +23,8 @@ import {createCommunityRewards} from './community-rewards.mjs';
|
|||
import {initializeCompanyRegistry,listPublicCompanies} from './company-registry.mjs';
|
||||
import {initializeShareLedger} from './share-ledger.mjs';
|
||||
import {createPublicNews} from './news.mjs';
|
||||
import {createMenuBadges} from './menu-badges.mjs';
|
||||
import {createSearchVisibility} from './search-visibility.mjs';
|
||||
const root=new URL('./public/',import.meta.url);
|
||||
const security={'X-Content-Type-Options':'nosniff','Referrer-Policy':'strict-origin-when-cross-origin','Content-Security-Policy':"default-src 'self'; frame-src https://cp.dunerealms.com; img-src 'self' https://www.dunerealms.com https://cp.dunerealms.com https://support.dunerealms.com https://forums.dunerealms.com data:; style-src 'self' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; script-src 'self'; connect-src 'self' https://cp.dunerealms.com; base-uri 'self'; object-src 'none'; frame-ancestors 'self'"};
|
||||
export function createApplication(db,settings={}) {
|
||||
|
|
@ -36,8 +38,14 @@ export function createApplication(db,settings={}) {
|
|||
const gameLink=createGameLink(db,settings,origin);
|
||||
const rewards=createCommunityRewards(db,settings,origin);
|
||||
const publicNews=createPublicNews(db);const publicExchange=createPublicExchange(db,settings);
|
||||
const searchVisibility=createSearchVisibility(db);const menuBadges=createMenuBadges(db,settings);
|
||||
return async function handle(request) {
|
||||
const url=new URL(request.url);
|
||||
if(url.pathname==='/api/menu-badges')return menuBadges(request);
|
||||
// Discord publishes canonical /news/:slug-:id links. Route these before
|
||||
// static assets so published articles cannot fall through to a Worker 404.
|
||||
const articleResponse=await searchVisibility.route(request);
|
||||
if(articleResponse)return articleResponse;
|
||||
if(url.pathname.startsWith('/git/sso/')||url.pathname==='/api/git/me')return gitIdentity(request);
|
||||
if(url.pathname==='/api/exchange/listings')return publicExchange(request);
|
||||
// Website articles use the editorial register, before the legacy Discord feed.
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff