auth improvements:

- add google drive reauth support, if auth expires (for on-demand downloaded content)
- fix curated page width
This commit is contained in:
Ilya Kreymer
2020-05-06 18:09:42 -07:00
parent c74d0ffaa1
commit 1cf32c7de4
4 changed files with 107 additions and 52 deletions
+12 -1
View File
@@ -29,7 +29,18 @@ function getTS(iso) {
return iso.replace(/[-:T]/g, '').slice(0, 14);
}
async function sourceToId(url) {
try {
url = new URL(url, window.location.origin).href;
} catch(e) {}
const digest = await digestMessage(url, 'SHA-256');
const coll = "id-" + digest.slice(0, 12);
return {url, coll};
}
export { digestMessage, tsToDate, getTS };
export { digestMessage, tsToDate, getTS, sourceToId };