Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
perf: revert downloading remote resources from Ad-Shield server
Browse files Browse the repository at this point in the history
  • Loading branch information
piquark6046 committed Feb 10, 2024
1 parent aab915f commit 75da19b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 17 deletions.
14 changes: 7 additions & 7 deletions microShield.user.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "microshield",
"version": "3.15.1",
"version": "3.15.2",
"description": "",
"type": "module",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion sources/banner.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// @downloadURL https://cdn.jsdelivr.net/gh/List-KR/microShield@latest/microShield.user.js
// @license Apache-2.0
//
// @version 3.15.1
// @version 3.15.2
// @author PiQuark6046 and contributors
//
// @match *://algumon.com/*
Expand Down
1 change: 0 additions & 1 deletion sources/src/__generated__/ztinywave.cache.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions sources/src/loaders/ztinywave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const decode = (payload: string, scriptURL: string) => {

let mode = 0;

let data = payload
const data = payload
.slice(4)
.split('')
.map(char => {
Expand Down Expand Up @@ -70,12 +70,6 @@ const decode = (payload: string, scriptURL: string) => {
})
.join('');

if (data.includes('resources://') && key.remoteResourceToken) {
debug('downloading remote resource from Ad-Shield is required', data);
const scriptHostname = new URL(scriptURL.startsWith('//') ? `https:${scriptURL}` : scriptURL).hostname;
data = data.replace(/resources:\/\/[a-zA-Z0-9-]+/, (`https://${scriptHostname}/resources/${/(?<=resources:\/\/)[a-zA-Z0-9-]+/.exec(data) as unknown as string}?token=${key.remoteResourceToken}`));
}

return JSON.parse(data) as Data;
};

Expand Down

0 comments on commit 75da19b

Please sign in to comment.