1
- const fss = require ( "fs" ) ;
1
+ const fs = require ( "fs" ) ;
2
2
const path = require ( "path" ) ;
3
3
const { contextBridge, ipcRenderer, webFrame } = require ( "electron" ) ;
4
4
5
5
// get selector UI content
6
- const selUiJs = fss . readFileSync ( path . join ( __dirname , "selector-ui.js" ) , "utf8" ) ;
6
+ const selUiJs = fs . readFileSync ( path . join ( __dirname , "selector-ui.js" ) , "utf8" ) ;
7
7
8
8
// build shelter injector plugins manifest
9
9
const injPlugins = {
@@ -29,7 +29,7 @@ ipcRenderer.invoke("SHELTER_BUNDLE_FETCH").then((bundle) => {
29
29
30
30
// everything below this comment is for the plugin selector UI exclusively
31
31
32
- // fetch branches from server, then create a structure like:
32
+ // read branches and then create a structure like:
33
33
/*
34
34
const branches = {
35
35
shelter: {
@@ -46,26 +46,17 @@ ipcRenderer.invoke("SHELTER_BUNDLE_FETCH").then((bundle) => {
46
46
}
47
47
*/
48
48
49
- let branches = { } ;
50
-
51
- fetch ( "https://inject.shelter.uwu.network/sheltupdate_branches" )
52
- . then ( ( r ) => r . json ( ) )
53
- . then (
54
- ( branches_raw ) =>
55
- ( branches = Object . fromEntries (
56
- branches_raw . map ( ( branch ) => [
57
- branch . name ,
58
- { ...branch , name : branch . displayName , desc : branch . description } ,
59
- ] ) ,
60
- ) ) ,
61
- ) ;
49
+ const branchesRaw = JSON . parse ( fs . readFileSync ( path . join ( __dirname , "branches.json" ) , "utf8" ) ) ;
50
+ const branches = Object . fromEntries (
51
+ branchesRaw . map ( ( branch ) => [ branch . name , { ...branch , name : branch . displayName , desc : branch . description } ] ) ,
52
+ ) ;
62
53
63
54
const readBranches = ( ) => ipcRenderer . invoke ( "SHELTER_BRANCH_GET" ) ;
64
55
65
56
const setBranches = ( branches ) => ipcRenderer . invoke ( "SHELTER_BRANCH_SET" , branches ) ;
66
57
67
58
contextBridge . exposeInMainWorld ( "SheltupdateNative" , {
68
- getAllowedBranches : ( ) => Promise . resolve ( branches ) ,
59
+ getAvailableBranches : ( ) => Promise . resolve ( branches ) ,
69
60
getCurrentBranches : readBranches ,
70
61
71
62
setBranches : async ( br ) => {
0 commit comments