File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ export default defineNuxtConfig({
2727 public : {
2828 debug : process . env . DEBUG ? true : false ,
2929 docs_url : process . env . DOCS_URL ,
30+ database_repo : process . env . DATABASE_REPO ,
3031 }
3132 }
3233} )
Original file line number Diff line number Diff line change @@ -4,6 +4,11 @@ type Github = {
44 path : string
55}
66
7+ function defaultDatabaRepo ( ) : string {
8+ const runtimeConfig = useRuntimeConfig ( ) ;
9+ return runtimeConfig . public . database_repo || "os-checker/database" ;
10+ }
11+
712// 当构建期间设置了 DEBUG 环境变量,则去 debug 分支而不是 main 分支拉取数据
813function defaultBranch ( ) : string {
914 const runtimeConfig = useRuntimeConfig ( ) ;
@@ -12,9 +17,9 @@ function defaultBranch(): string {
1217
1318// https://raw.githubusercontent.com/os-checker/os-checker.github.io/main/os-checks/public/test_raw_reports.json
1419export default function < T > ( github : Github ) : Promise < T > {
15- const repo = github . repo || "database" ;
20+ const repo = github . repo || defaultDatabaRepo ( ) ;
1621 const branch = github . branch || defaultBranch ( ) ;
17- const url = `https://raw.githubusercontent.com/os-checker/ ${ repo } /${ branch } /${ github . path } ` ;
22+ const url = `https://raw.githubusercontent.com/${ repo } /${ branch } /${ github . path } ` ;
1823 return $fetch ( url , {
1924 // 构造简单请求来解决跨域问题(同时 github raw 资源支持所有源)
2025 "headers" : { "content-type" : "text/plain" } ,
You can’t perform that action at this time.
0 commit comments