Merge branch 'develop'
This commit is contained in:
commit
8efd9577e1
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "eternae.ink.update",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"description": "A simple redirection to serve a gitea instance's repositories' latest release files as an http file server. (302 redirections)",
|
||||
"repository": "https://eternae.ink/arisu/update.eternae.ink",
|
||||
"author": "Alice Gaudon <alice@gaudon.pro>",
|
||||
|
@ -24,18 +24,22 @@ export default class GiteaRepoLatestReleaseController extends Controller {
|
||||
data += c;
|
||||
});
|
||||
r.on('end', () => {
|
||||
const assets = JSON.parse(data)[0].assets;
|
||||
try {
|
||||
const assets = JSON.parse(data)[0].assets;
|
||||
|
||||
if (file) {
|
||||
for (const asset of assets) {
|
||||
if (asset.name === file) {
|
||||
log.debug('Redirect to', asset.browser_download_url);
|
||||
return res.redirect(302, asset.browser_download_url);
|
||||
if (file) {
|
||||
for (const asset of assets) {
|
||||
if (asset.name === file) {
|
||||
log.debug('Redirect to', asset.browser_download_url);
|
||||
return res.redirect(302, asset.browser_download_url);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.debug('List files');
|
||||
return res.render('list-files', {assets: assets});
|
||||
}
|
||||
} else {
|
||||
log.debug('List files');
|
||||
return res.render('list-files', {assets: assets});
|
||||
} catch (e) {
|
||||
return next(e);
|
||||
}
|
||||
});
|
||||
}).on('error', err => {
|
||||
|
Loading…
Reference in New Issue
Block a user