File tree Expand file tree Collapse file tree 3 files changed +33
-1
lines changed
routes/(categorical)/companies/[domain]/app-adstxt/download Expand file tree Collapse file tree 3 files changed +33
-1
lines changed Original file line number Diff line number Diff line change 4141 },
4242 "dependencies" : {
4343 "@carbon/charts-svelte" : " ^1.22.3" ,
44- "echarts" : " ^5.5.1"
44+ "echarts" : " ^5.5.1" ,
45+ "toml" : " ^3.0.0"
4546 }
4647}
Original file line number Diff line number Diff line change 1+ import fs from 'fs' ;
2+ import path from 'path' ;
3+ import toml from 'toml' ;
4+ import os from 'os' ;
5+
6+ const CONFIG_PATH = path . join ( os . homedir ( ) , '.config/appgoblin/config.toml' ) ;
7+
8+ export default function loadConfig ( ) {
9+ try {
10+ const configContent = fs . readFileSync ( CONFIG_PATH , 'utf-8' ) ;
11+ const parsedConfig = toml . parse ( configContent ) ;
12+ return parsedConfig . cloud ?. adstxt_endpoint || null ;
13+ } catch ( error ) {
14+ console . error ( 'Failed to load config:' , error ) ;
15+ return null ;
16+ }
17+ }
Original file line number Diff line number Diff line change 1+ import type { RequestHandler } from '@sveltejs/kit' ;
2+ import loadConfig from '$lib/loadConfig.js' ;
3+
4+ export const GET : RequestHandler = async ( { params } ) => {
5+ const domain = params . domain || '' ;
6+ const adstxtEndpoint = loadConfig ( ) ;
7+
8+ return new Response ( null , {
9+ status : 302 ,
10+ headers : {
11+ Location : `${ adstxtEndpoint } ${ domain } /latest.csv`
12+ }
13+ } ) ;
14+ } ;
You can’t perform that action at this time.
0 commit comments