mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2024-12-15 00:55:48 +01:00
Cache failed url-preview (apply to proxy/client) (#2154)
This commit is contained in:
parent
3c90abfb96
commit
a8f142096c
2 changed files with 11 additions and 7 deletions
|
@ -104,6 +104,7 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
fetch('/url?url=' + encodeURIComponent(this.url)).then(res => {
|
fetch('/url?url=' + encodeURIComponent(this.url)).then(res => {
|
||||||
res.json().then(info => {
|
res.json().then(info => {
|
||||||
|
if (info.url != null) {
|
||||||
this.title = info.title;
|
this.title = info.title;
|
||||||
this.description = info.description;
|
this.description = info.description;
|
||||||
this.thumbnail = info.thumbnail;
|
this.thumbnail = info.thumbnail;
|
||||||
|
@ -111,6 +112,7 @@ export default Vue.extend({
|
||||||
this.sitename = info.sitename;
|
this.sitename = info.sitename;
|
||||||
|
|
||||||
this.fetching = false;
|
this.fetching = false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,9 @@ module.exports = async (ctx: Koa.Context) => {
|
||||||
|
|
||||||
ctx.body = summary;
|
ctx.body = summary;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
ctx.status = 500;
|
ctx.status = 200;
|
||||||
|
ctx.set('Cache-Control', 'max-age=86400, immutable');
|
||||||
|
ctx.body = '{}';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue