@@ -138,7 +138,7 @@ interface IOffsetsStore {
138
138
}
139
139
140
140
//// "https://cdn.jsdelivr.net/gh/OhMyGuus/BetterCrewlink-Offsets@main/"; // "https://raw.githubusercontent.com/OhMyGuus/BetterCrewlink-Offsets/main"
141
-
141
+ /*
142
142
const BASE_URL = "https://offsets.mxyx.club";
143
143
const BASE_URL_error = "https://github.moeyy.xyz/https://raw.githubusercontent.com/OhMyGuus/BetterCrewlink-Offsets/main";
144
144
@@ -159,6 +159,28 @@ async function fetchOffsetLookupJson(error: boolean = false): Promise<IOffsetsLo
159
159
throw Errors.LOOKUP_FETCH_ERROR;
160
160
}
161
161
});
162
+ }*/
163
+
164
+ //// "https://cdn.jsdelivr.net/gh/OhMyGuus/BetterCrewlink-Offsets@main/"; // "https://raw.githubusercontent.com/OhMyGuus/BetterCrewlink-Offsets/main"
165
+
166
+ const BASE_URL = "https://offsets.mxyx.club" ;
167
+ const BASE_URL_error = "https://github.moeyy.xyz/https://raw.githubusercontent.com/OhMyGuus/BetterCrewlink-Offsets/main" ;
168
+
169
+ const store = new Store < IOffsetsStore > ( { name : "offsets" } ) ;
170
+ const lookupStore = new Store < IOffsetsLookup > ( { name : "lookup" } ) ;
171
+
172
+ async function fetchOffsetLookupJson ( error : boolean = false ) : Promise < IOffsetsLookup > {
173
+ const url = error ? BASE_URL_error : BASE_URL ;
174
+ return fetch ( `${ url } /lookup.json` )
175
+ . then ( ( response ) => response . json ( ) )
176
+ . then ( ( data ) => { return data as IOffsetsLookup } )
177
+ . catch ( ( _ ) => {
178
+ if ( ! error ) {
179
+ return fetchOffsetLookupJson ( true ) ;
180
+ } else {
181
+ throw Errors . LOOKUP_FETCH_ERROR ;
182
+ }
183
+ } ) ;
162
184
}
163
185
164
186
export async function fetchOffsetLookup ( ) : Promise < IOffsetsLookup > {
@@ -174,9 +196,7 @@ export async function fetchOffsetLookup(): Promise<IOffsetsLookup> {
174
196
}
175
197
176
198
async function fetchOffsetsJson ( is_64bit : boolean , filename : string , error : boolean = false ) : Promise < IOffsets > {
177
- const GetUrl = SettingsStore . get ( 'CDN_Url' , 'nullUrl' ) ;
178
- const CDN_Url = GetUrl == 'nullUrl' ? BASE_URL : GetUrl ;
179
- const url = error ? BASE_URL_error : CDN_Url ;
199
+ const url = error ? BASE_URL_error : BASE_URL ;
180
200
const OFFSETS_URL = `${ url } /offsets` ;
181
201
return fetch ( `${ OFFSETS_URL } /${ is_64bit ? 'x64' : 'x86' } /${ filename } ` )
182
202
. then ( ( response ) => response . json ( ) )
@@ -185,7 +205,7 @@ async function fetchOffsetsJson(is_64bit: boolean, filename: string, error: bool
185
205
if ( ! error ) {
186
206
return fetchOffsetsJson ( is_64bit , filename , true ) ;
187
207
} else {
188
- throw Errors . OFFSETS_FETCH_ERROR ;
208
+ throw Errors . OFFSETS_FETCH_ERROR ;
189
209
}
190
210
} ) ;
191
211
}
0 commit comments