feat(website-server): Add configurable ads.txt support to website server
This commit is contained in:
@@ -1,5 +1,13 @@
|
||||
# Changelog
|
||||
|
||||
## 2025-12-05 - 7.10.0 - feat(website-server)
|
||||
Add configurable ads.txt support to website server
|
||||
|
||||
- Introduce adsTxt?: string[] option to the server options to allow configuring ads.txt entries.
|
||||
- Serve /ads.txt only when adsTxt is provided; the route is not registered if no entries are configured.
|
||||
- Replace previous hard-coded Google ads.txt entry with values joined from the provided adsTxt array and served as text/plain.
|
||||
- Preserves existing behavior when adsTxt is not set (no /ads.txt endpoint will be exposed).
|
||||
|
||||
## 2025-12-05 - 7.9.0 - feat(typedserver)
|
||||
Add configurable security headers and default SPA behavior
|
||||
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@api.global/typedserver',
|
||||
version: '7.9.0',
|
||||
version: '7.10.0',
|
||||
description: 'A TypeScript-based project for easy serving of static files with support for live reloading, compression, and typed requests.'
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ export interface IUtilityWebsiteServerConstructorOptions {
|
||||
forceSsl?: boolean;
|
||||
/** Port to listen on (default: 3000) */
|
||||
port?: number;
|
||||
/** ads.txt entries (only served if configured) */
|
||||
adsTxt?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,15 +96,16 @@ export class UtilityWebsiteServer {
|
||||
})
|
||||
);
|
||||
|
||||
// ads.txt handler
|
||||
this.typedserver.addRoute('/ads.txt', 'GET', async () => {
|
||||
const adsTxt =
|
||||
['google.com, pub-4104137977476459, DIRECT, f08c47fec0942fa0'].join('\n') + '\n';
|
||||
return new Response(adsTxt, {
|
||||
status: 200,
|
||||
headers: { 'Content-Type': 'text/plain' },
|
||||
// ads.txt handler (only if configured)
|
||||
if (this.options.adsTxt && this.options.adsTxt.length > 0) {
|
||||
this.typedserver.addRoute('/ads.txt', 'GET', async () => {
|
||||
const adsTxt = this.options.adsTxt.join('\n') + '\n';
|
||||
return new Response(adsTxt, {
|
||||
status: 200,
|
||||
headers: { 'Content-Type': 'text/plain' },
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Asset broker manifest handler
|
||||
this.typedserver.addRoute(
|
||||
|
||||
Reference in New Issue
Block a user