A [Python script](misc/collect.py) is included to create those json files:
`./collect.py bin/ --url
-'https://downloads.openwrt.org/releases/{release}/targets/{target}' >
+'https://downloads.openwrt.org/releases/{version}/targets/{target}' >
names-test.json`.
For the OpenWrt 18.06 and 19.07 releases, you need to patch OpenWrt to output JSON files for collect.py (commit [openwrt/openwrt@881ed09](https://github.com/openwrt/openwrt/commit/881ed09ee6e23f6c224184bb7493253c4624fb9f)).
'tr-load': 'Lade die OpenWrt Firmware für dein Gerät!',
'tr-title': 'OpenWrt Firmware Selector',
'tr-message': 'Bitte benutze die Eingabe um die passende Firmware zu finden!',
- 'tr-release-build': 'Release Build',
+ 'tr-version-build': 'Release Build',
'tr-custom-build': 'Custom Build',
'tr-customize': 'Customize',
'tr-request-build': 'Request Build',
'tr-load': 'Download OpenWrt firmware for your device!',
'tr-title': 'OpenWrt Firmware Selector',
'tr-message': 'Please use the input below to download firmware for your device!',
- 'tr-release-build': 'Build',
+ 'tr-version-build': 'Build',
'tr-custom-build': 'Custom Build',
'tr-customize': 'Customize',
'tr-request-build': 'Request Build',
'tr-model': 'Modell:',
'tr-target': 'Platform:',
'tr-version': 'Version:',
- 'tr-release-downloads': 'Downloads',
+ 'tr-version-downloads': 'Downloads',
'tr-custom-downloads': 'Custom Downloads',
'tr-factory-help': 'Factory images are for flashing routers with OpenWrt for the first time. Usually via the web interface of the original firmware.',
'tr-sysupgrade-help': 'Sysupgrade images are for flashing routers that already run OpenWrt. The image can be applied using the web interface or the terminal.',
<p class="tr-message">Please use the input below to download firmware for your device!</p>
<br>
- <select id="releases" size="1"></select>
+ <select id="versions" size="1"></select>
<div class="autocomplete">
<input id="models" type="text" placeholder="Model" spellcheck="false" autocapitalize="off" autocorrect="off">
</div>
</div>
<div>
- <h3 id="images-title" class="tr-release-build">Release Build</h3>
+ <h3 id="images-title" class="tr-version-build">Release Build</h3>
<div><span class="column tr-model">Model:</span> <span id="image-model"></span></div>
<div><span class="column tr-target">Target:</span> <span id="image-target"></span></div>
- <div><span class="column tr-version">Version:</span> <span id="image-release"></span> (<span id="image-commit"></span>)</div>
+ <div><span class="column tr-version">Version:</span> <span id="image-version"></span> (<span id="image-code"></span>)</div>
</div>
<div id="download-links">
var request_data = {
'profile': current_model.id,
'packages': split($('packages').value),
- 'version': $('releases').value
+ 'version': $('versions').value
}
console.log('disable request button / show loading spinner')
.then(mobj => {
console.log(mobj)
updateImages(
- mobj.version_number, mobj.version_commit,
+ mobj.version_number,
+ mobj.version_code,
get_model_titles(mobj.titles),
mobj.url, mobj, true
);
});
}
-function updateImages(version, commit, model, url, mobj, is_custom) {
+function updateImages(version, code, model, url, mobj, is_custom) {
// add download button for image
function addLink(type, file) {
var a = document.createElement('A');
a.classList.add('download-link');
a.href = url
.replace('{target}', mobj.target)
- .replace('{release}', version)
+ .replace('{version}', version)
+ '/' + file;
var span = document.createElement('SPAN');
span.appendChild(document.createTextNode(''));
Array.from(document.getElementsByClassName('download-help'))
.forEach(e => e.style.display = 'none');
- if (version && commit && model && url && mobj) {
+ if (version && code && model && url && mobj) {
var target = mobj.target;
var images = mobj.images;
- // change between "release" and "custom" title
+ // change between "version" and "custom" title
if (is_custom) {
- switchClass('images-title', 'tr-release-build', 'tr-custom-build');
- switchClass('downloads-title', 'tr-release-downloads', 'tr-custom-downloads');
+ switchClass('images-title', 'tr-version-build', 'tr-custom-build');
+ switchClass('downloads-title', 'tr-version-downloads', 'tr-custom-downloads');
} else {
- switchClass('images-title', 'tr-custom-build', 'tr-release-build');
- switchClass('downloads-title', 'tr-custom-downloads', 'tr-release-downloads');
+ switchClass('images-title', 'tr-custom-build', 'tr-version-build');
+ switchClass('downloads-title', 'tr-custom-downloads', 'tr-version-downloads');
}
// update title translation
applyLanguage();
// fill out build info
$('image-model').innerText = model;
$('image-target').innerText = target;
- $('image-release').innerText = version;
- $('image-commit').innerText = commit;
+ $('image-version').innerText = version;
+ $('image-code').innerText = code;
images.sort((a, b) => a.name.localeCompare(b.name));
}
}
-setupSelectList($('releases'), Object.keys(config.versions), version => {
+setupSelectList($('versions'), Object.keys(config.versions), version => {
loadFile(config.versions[version], obj => {
setupAutocompleteList($('models'), Object.keys(obj['models']), model => {
if (model in obj['models']) {
var url = obj.url;
- var commit = obj.version_commit;
+ var code = obj.version_code;
var mobj = obj['models'][model];
- updateImages(version, commit, model, url, mobj, false);
+ updateImages(version, code, model, url, mobj, false);
current_model = mobj;
} else {
updateImages();
import os
parser = argparse.ArgumentParser()
-parser.add_argument("input_path", nargs='?', help="Input folder that is traversed for OpenWrt JSON device files.")
-parser.add_argument('--url',
- action="store", dest="url", default="",
- help="Link to get the image from. May contain {target}, {release} and {commit}")
-parser.add_argument('--formatted',
- action="store_true", dest="formatted", help="Output formatted JSON data.")
+parser.add_argument("input_path", nargs='?',
+ help="Input folder that is traversed for OpenWrt JSON device files.")
+parser.add_argument('--url', action="store", default="",
+ help="Link to get the image from. May contain {target}, {version} and {commit}")
+parser.add_argument('--formatted', action="store_true",
+ help="Output formatted JSON data.")
args = parser.parse_args()
sys.stderr.write('{} has unsupported metadata version: {} => skip\n'.format(path, obj['metadata_version']))
continue
- version = obj['version_number']
- commit = obj['version_commit']
+ code = obj.get('version_code', obj.get('version_commit'))
- if not 'version_commit' in output:
+ if not 'version_code' in output:
output = {
- 'version_commit': commit,
+ 'version_code': code,
'url': args.url,
'models' : {}
}
# only support a version_number with images of a single version_commit
- if output['version_commit'] != commit:
- sys.stderr.write('mixed revisions for a release ({} and {}) => abort\n'.format(output['version_commit'], commit))
+ if output['version_code'] != code:
+ sys.stderr.write('mixed revisions for a release ({} and {}) => abort\n'.format(output['version_code'], commit))
exit(1)
images = []
"target": "x86/64"
}
},
- "url": "https://downloads.openwrt.org/releases/{release}/targets/{target}",
- "version_commit": "r7976-ca47026b7d"
+ "url": "https://downloads.openwrt.org/releases/{version}/targets/{target}",
+ "version_code": "r7976-ca47026b7d"
}
\ No newline at end of file
"target": "x86/64"
}
},
- "url": "https://downloads.openwrt.org/releases/{release}/targets/{target}",
- "version_commit": "r10911-c155900f66"
+ "url": "https://downloads.openwrt.org/releases/{version}/targets/{target}",
+ "version_code": "r10911-c155900f66"
}
\ No newline at end of file
}
},
"url": "https://downloads.openwrt.org/snapshots/targets/{target}",
- "version_commit": "r12145-4716c843d6"
+ "version_code": "r12145-4716c843d6"
}
\ No newline at end of file