beta versions should refer to branch 'next' (for central.json)
Massimo Melina committed
Sep 17, 2023 at 16:46 UTC
1e084baf3e1dd29c676ee7c768a5a236ed01397c
2 files changed
+10
-2
src/const.ts
+1
@@ -20,6 +20,7 @@ export const API_VERSION = 8.3
20
export const COMPATIBLE_API_VERSION = 1 // while changes in the api are not breaking, this number stays the same, otherwise it is made equal to API_VERSION
21
22
export const HFS_REPO = 'rejetto/hfs'
23
+export const HFS_REPO_BRANCH = RUNNING_BETA ? 'next' : 'main'
24
25
export const SPECIAL_URI = '/~/'
26
export const FRONTEND_URI = SPECIAL_URI + 'frontend/'
src/github.ts
+9
-2
@@ -12,7 +12,14 @@ import {
12
} from './plugins'
13
import { ApiError } from './apiMiddleware'
14
import _ from 'lodash'
15
-import { HFS_REPO, HTTP_BAD_REQUEST, HTTP_CONFLICT, HTTP_NOT_ACCEPTABLE, HTTP_SERVER_ERROR } from './const'
15
+import {
16
+ HFS_REPO,
17
+ HFS_REPO_BRANCH,
18
+ HTTP_BAD_REQUEST,
19
+ HTTP_CONFLICT,
20
+ HTTP_NOT_ACCEPTABLE,
21
+ HTTP_SERVER_ERROR
22
+} from './const'
23
import { rename, rm } from 'fs/promises'
24
import { join } from 'path'
25
import { readFileSync } from 'fs'
@@ -189,7 +196,7 @@ let cache
196
const FN = 'central.json'
197
let latest = JSON.parse(readFileSync(join(__dirname, '..', FN), 'utf8')) // initially built-in is our latest
198
export function getProjectInfo() {
192
- return cache ||= readGithubFile(HFS_REPO + '/main/' + FN)
199
+ return cache ||= readGithubFile(`${HFS_REPO}/${HFS_REPO_BRANCH}/${FN}`)
200
.catch(() => latest) // fall back to latest
201
.then(x => {
202
if (!x) throw x // go catch