2015-08-20 11:51:20 +01:00
|
|
|
import json
|
2015-08-20 19:28:20 +01:00
|
|
|
import os
|
|
|
|
current_dir = os.path.dirname(os.path.realpath(__file__)) + "/"
|
2015-08-20 11:51:20 +01:00
|
|
|
|
2015-08-20 19:28:20 +01:00
|
|
|
with open(current_dir + "../package.json") as json_file:
|
2015-08-20 11:51:20 +01:00
|
|
|
project_package = json.load(json_file)
|
|
|
|
|
2015-08-28 14:05:59 +01:00
|
|
|
manifest = {}
|
|
|
|
try:
|
|
|
|
with open(current_dir + "manifest.json") as json_file:
|
|
|
|
manifest = json.load(json_file)
|
|
|
|
except:
|
|
|
|
manifest = {}
|
2015-08-20 11:51:20 +01:00
|
|
|
|
|
|
|
switcher = {
|
|
|
|
'name': 'name',
|
|
|
|
'version': 'version',
|
|
|
|
'description': 'description',
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-08-20 19:28:20 +01:00
|
|
|
for key, value in switcher.items():
|
2015-08-20 11:51:20 +01:00
|
|
|
manifest[value] = project_package[key]
|
|
|
|
|
|
|
|
|
2015-08-24 14:57:19 +01:00
|
|
|
with open(current_dir + "data/decoder.json") as json_file:
|
2015-08-20 19:28:20 +01:00
|
|
|
site_decoder = json.load(json_file)['sites']
|
2015-08-20 11:51:20 +01:00
|
|
|
|
|
|
|
|
|
|
|
content_scripts = []
|
2015-08-20 19:28:20 +01:00
|
|
|
for site in site_decoder:
|
|
|
|
site = list(site.items())[0]
|
2015-08-20 11:51:20 +01:00
|
|
|
temp = {}
|
2015-08-24 14:57:19 +01:00
|
|
|
temp['matches'] = ["*://" + site[0] + '/*']
|
2015-08-28 15:00:39 +01:00
|
|
|
temp['js'] = ['data/injections/' + site[1]]
|
2015-08-20 11:51:20 +01:00
|
|
|
content_scripts.append(temp)
|
|
|
|
|
|
|
|
|
|
|
|
manifest['content_scripts'] = content_scripts
|
|
|
|
|
2015-08-28 14:05:59 +01:00
|
|
|
# Hard coded things
|
|
|
|
manifest['mannifest_version'] = 2
|
2015-08-20 11:51:20 +01:00
|
|
|
|
2015-08-20 19:28:20 +01:00
|
|
|
with open(current_dir + 'manifest.json', 'w') as file:
|
|
|
|
json.dump(manifest, file, indent=2, sort_keys=True)
|