Skip to content

Commit

Permalink
fix(script): Fix no cdn script parse error
Browse files Browse the repository at this point in the history
  • Loading branch information
violet-dev committed Jul 7, 2023
1 parent 60c4f1e commit ec2a9e7
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions lib/script/script_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,30 @@ class ScriptManager {
static Future<void> init() async {
try {
final scriptHtml = (await http.get(_scriptNoCDNUrl)).body;
_scriptCache = parse(scriptHtml).querySelector('table')!.text;
_scriptCache = json.decode(parse(scriptHtml)
.querySelector("script[data-target='react-app.embeddedData']")!
.text)['payload']['blob']['rawBlob'];
} catch (e) {
debugPrint(e.toString());
}
if (_scriptCache == null) {
try {
_scriptCache = (await http.get(_scriptUrl)).body;
} catch (e) {
debugPrint(e.toString());
}
}
try {
_v4Cache = (await http.get(_scriptV4)).body;
} catch (e) {
debugPrint(e.toString());
}
_latestUpdate = DateTime.now();
_initRuntime();
try {
_initRuntime();
} catch (e) {
debugPrint(e.toString());
}
}

static Future<bool> refresh() async {
Expand Down

0 comments on commit ec2a9e7

Please sign in to comment.