diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-09-23 17:56:38 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-09-23 17:56:38 +0800 |
commit | a38700b5ae8822f159c7457d4d67e53f75ca63fa (patch) | |
tree | 13097a8f1a5e1e3b71a0948f9b876e6ec3d1c600 /src/features/settings | |
parent | 644a192508dba2719c24ecd3c0b3295120b0fbb5 (diff) | |
download | SoopyV2-a38700b5ae8822f159c7457d4d67e53f75ca63fa.tar.gz SoopyV2-a38700b5ae8822f159c7457d4d67e53f75ca63fa.tar.bz2 SoopyV2-a38700b5ae8822f159c7457d4d67e53f75ca63fa.zip |
Support lets encript prepairing for hypixel api change
Diffstat (limited to 'src/features/settings')
-rw-r--r-- | src/features/settings/helpDataLoader.js | 23 | ||||
-rw-r--r-- | src/features/settings/settingThings/settingBase.js | 12 |
2 files changed, 16 insertions, 19 deletions
diff --git a/src/features/settings/helpDataLoader.js b/src/features/settings/helpDataLoader.js index fc6afaf..acf4fd2 100644 --- a/src/features/settings/helpDataLoader.js +++ b/src/features/settings/helpDataLoader.js @@ -3,7 +3,7 @@ class HelpDataLoader { this.availableHelpData = {} this.dataCach = {} - fetch("http://soopy.dev/api/soopyv2/settingshelpoptions.json").json().then(data => { + fetch("https://soopy.dev/api/soopyv2/settingshelpoptions.json").json().then(data => { Object.keys(data).forEach(category => { this.availableHelpData[category] = new Set(data[category]) }); @@ -14,26 +14,23 @@ class HelpDataLoader { return this.availableHelpData[category] && this.availableHelpData[category].has(id) } - getData(category, id, callback) { + async getData(category, id) { if (!this.hasData(category, id)) { - callback("") - return + return "" } if (this.dataCach[category] && this.dataCach[category][id]) { - callback(this.dataCach[category][id]) - return + return this.dataCach[category][id] } - fetch("http://soopy.dev/api/soopyv2/settingshelp/" + category + "/" + id).text().then(data => { - if (!this.dataCach[category]) { - this.dataCach[category] = {} - } + let data = await fetch("https://soopy.dev/api/soopyv2/settingshelp/" + category + "/" + id).text() + if (!this.dataCach[category]) { + this.dataCach[category] = {} + } - this.dataCach[category][id] = data + this.dataCach[category][id] = data - callback(data) - }) + callback(data) } } diff --git a/src/features/settings/settingThings/settingBase.js b/src/features/settings/settingThings/settingBase.js index 5320f40..2346f32 100644 --- a/src/features/settings/settingThings/settingBase.js +++ b/src/features/settings/settingThings/settingBase.js @@ -30,12 +30,12 @@ class SettingBase { this.helpButton = new BoxWithText().setText("ยง0?").setLocation(3, 3, 0.05, 0.5) this.helpButton.location.location.setRelative(false, false) - this.helpButton.addEvent(new SoopyMouseClickEvent().setHandler(() => { + this.helpButton.addEvent(new SoopyMouseClickEvent().setHandler(async () => { module.FeatureManager.features.soopyGui.class.openSidebarPage(new SoopyGuiElement().setLocation(0.05, 0.05, 0.9, 0.9).setScrollable(true).addChild(new SoopyMarkdownElement().setLocation(0, 0, 1, 1).setText("Loading..."))) - this.getHelp(helpText => { - module.FeatureManager.features.soopyGui.class.openSidebarPage(new SoopyGuiElement().setLocation(0.05, 0.05, 0.9, 0.9).setScrollable(true).addChild(new SoopyMarkdownElement().setLocation(0, 0, 1, 1).setText(helpText))) - }) + let helpText = await this.getHelp() + + module.FeatureManager.features.soopyGui.class.openSidebarPage(new SoopyGuiElement().setLocation(0.05, 0.05, 0.9, 0.9).setScrollable(true).addChild(new SoopyMarkdownElement().setLocation(0, 0, 1, 1).setText(helpText))) })) this.helpButton.setLore(["Click for more information about this setting"]) @@ -79,8 +79,8 @@ class SettingBase { return helpDataLoader.hasData(this.moduleId, this.settingId) } - getHelp(callback) { - helpDataLoader.getData(this.moduleId, this.settingId, callback) + async getHelp() { + return await helpDataLoader.getData(this.moduleId, this.settingId) } getValue() { |