Skip to content

Commit

Permalink
get manifest.json from web
Browse files Browse the repository at this point in the history
  • Loading branch information
tddebart committed Jan 21, 2024
1 parent 7229358 commit f83eb4b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 530 deletions.
4 changes: 4 additions & 0 deletions SteamDB-addon/SteamDB/script-loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ export function getNeededScripts() {
let scripts = [];

//#region Autogenerated code from convert-manifest.py
if (href.match("https://store\.steampowered\.com/cart/.*")) {
scripts.push("scripts/store/cart.js");
}

if (href.match("https://store\.steampowered\.com/app/.*")) {
scripts.push("scripts/store/app_error.js");
scripts.push("scripts/store/app.js");
Expand Down
7 changes: 4 additions & 3 deletions convert-manifest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import re
import requests
from collections import defaultdict

filtered_scripts = ['scripts/common.js', 'scripts/global.js', 'scripts/store/invalidate_cache.js']
Expand All @@ -8,8 +9,8 @@ def url_to_regex(url):
return re.escape(url).replace('\*', '.*')

def convert_to_js(manifest_file):
with open(manifest_file, 'r') as f:
data = json.load(f)
response = requests.get(manifest_file)
data = json.loads(response.text)

content_scripts = data['content_scripts']
combined_matches = defaultdict(list)
Expand All @@ -33,4 +34,4 @@ def convert_to_js(manifest_file):
print(' scripts.push("{}");'.format(js_file))
print('}\n')

convert_to_js('manifest.json')
convert_to_js('https://cdn.jsdelivr.net/gh/SteamDatabase/BrowserExtension@latest/manifest.json')
Loading

0 comments on commit f83eb4b

Please sign in to comment.