forked from labring/sealos
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:desktop add umami (labring#3676)
Signed-off-by: jingyang <[email protected]>
- Loading branch information
Showing
11 changed files
with
69 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ yarn-error.log* | |
|
||
# local env files | ||
.env*.local | ||
|
||
data/config.local.json | ||
# vercel | ||
.vercel | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"scripts": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { jsonRes } from '@/services/backend/response'; | ||
import { SystemConfigType } from '@/types/system'; | ||
import { readFileSync } from 'fs'; | ||
import type { NextApiRequest, NextApiResponse } from 'next'; | ||
|
||
export default async function handler(req: NextApiRequest, res: NextApiResponse) { | ||
const config = await getSystemConfig(); | ||
jsonRes(res, { | ||
data: config, | ||
code: 200 | ||
}); | ||
} | ||
|
||
const defaultConfig: SystemConfigType = { | ||
scripts: [] | ||
}; | ||
|
||
export async function getSystemConfig(): Promise<SystemConfigType> { | ||
try { | ||
const filename = | ||
process.env.NODE_ENV === 'development' ? 'data/config.local.json' : '/app/data/config.json'; | ||
const res = JSON.parse(readFileSync(filename, 'utf-8')); | ||
return res; | ||
} catch (error) { | ||
console.log('get system config error, set default'); | ||
return defaultConfig; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export type SystemConfigType = { | ||
scripts: ScriptConfig[]; | ||
}; | ||
|
||
export type ScriptConfig = { | ||
src: string; | ||
'data-website-id'?: string; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters