feat(discovery): more work on discovery plus a few fixes
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
/** @jsxImportSource hono/jsx */
|
||||
|
||||
import {CdnEndpoints} from '@fluxer/constants/src/CdnEndpoints';
|
||||
import type {BadgeCache} from '@fluxer/marketing/src/BadgeProxy';
|
||||
import {createI18n} from '@fluxer/marketing/src/I18n';
|
||||
import type {MarketingConfig} from '@fluxer/marketing/src/MarketingConfig';
|
||||
import type {MarketingContext} from '@fluxer/marketing/src/MarketingContext';
|
||||
@@ -33,8 +32,6 @@ import type {Context as HonoContext} from 'hono';
|
||||
export interface CreateMarketingContextFactoryOptions {
|
||||
config: MarketingConfig;
|
||||
publicDir: string;
|
||||
badgeFeaturedCache: BadgeCache;
|
||||
badgeTopPostCache: BadgeCache;
|
||||
}
|
||||
|
||||
export type MarketingContextFactory = (c: HonoContext) => Promise<MarketingContext>;
|
||||
@@ -62,8 +59,6 @@ export function createMarketingContextFactory(options: CreateMarketingContextFac
|
||||
platform: requestInfo.platform,
|
||||
architecture: requestInfo.architecture,
|
||||
releaseChannel: options.config.releaseChannel,
|
||||
badgeFeaturedCache: options.badgeFeaturedCache,
|
||||
badgeTopPostCache: options.badgeTopPostCache,
|
||||
csrfToken,
|
||||
isDev: options.config.env === 'development',
|
||||
};
|
||||
|
||||
@@ -26,7 +26,6 @@ import {HttpStatus, MimeType} from '@fluxer/constants/src/HttpConstants';
|
||||
import {isPressAssetId, PressAssets} from '@fluxer/constants/src/PressAssets';
|
||||
import {createSession} from '@fluxer/hono/src/Session';
|
||||
import {getLocaleFromCode} from '@fluxer/locale/src/LocaleService';
|
||||
import {type BadgeCache, createBadgeResponse} from '@fluxer/marketing/src/BadgeProxy';
|
||||
import type {MarketingConfig} from '@fluxer/marketing/src/MarketingConfig';
|
||||
import {sendMarketingRequest} from '@fluxer/marketing/src/MarketingHttpClient';
|
||||
import {renderCareersPage} from '@fluxer/marketing/src/pages/CareersPage';
|
||||
@@ -54,8 +53,6 @@ export interface RegisterMarketingRoutesOptions {
|
||||
app: Hono;
|
||||
config: MarketingConfig;
|
||||
contextFactory: MarketingContextFactory;
|
||||
badgeFeaturedCache: BadgeCache;
|
||||
badgeTopPostCache: BadgeCache;
|
||||
}
|
||||
|
||||
interface LocaleCookieSession {
|
||||
@@ -88,7 +85,6 @@ const PAGE_ROUTE_DEFINITIONS: ReadonlyArray<{
|
||||
];
|
||||
|
||||
export function registerMarketingRoutes(options: RegisterMarketingRoutesOptions): void {
|
||||
registerBadgeRoutes(options.app, options.badgeFeaturedCache, options.badgeTopPostCache);
|
||||
registerLocaleRoute(options.app, options.config);
|
||||
registerExternalRedirects(options.app);
|
||||
registerSystemContentRoutes(options.app, options.contextFactory);
|
||||
@@ -99,16 +95,6 @@ export function registerMarketingRoutes(options: RegisterMarketingRoutesOptions)
|
||||
registerNotFoundRoute(options.app, options.contextFactory);
|
||||
}
|
||||
|
||||
function registerBadgeRoutes(app: Hono, badgeFeaturedCache: BadgeCache, badgeTopPostCache: BadgeCache): void {
|
||||
app.get('/api/badges/product-hunt', async (c) => {
|
||||
return await createBadgeResponse(badgeFeaturedCache, c);
|
||||
});
|
||||
|
||||
app.get('/api/badges/product-hunt-top-post', async (c) => {
|
||||
return await createBadgeResponse(badgeTopPostCache, c);
|
||||
});
|
||||
}
|
||||
|
||||
function registerLocaleRoute(app: Hono, config: MarketingConfig): void {
|
||||
app.post('/_locale', async (c) => {
|
||||
const body = await c.req.parseBody();
|
||||
|
||||
Reference in New Issue
Block a user