From 335fb08a4631a36d96d795dc19dc44c3b72f02af Mon Sep 17 00:00:00 2001 From: Ben Zhang Date: Sat, 29 Jun 2024 15:27:49 -0700 Subject: [PATCH] Create asset-off-perm bucket for asset manager and pin deployment version (#2886) This PR creates a "asset-off-perm" bucket for the asset manager (see https://github.com/WATonomous/asset-manager/pull/1) and pins the deployment version of asset manager to avoid accidental upgrades. --- components/assets.tsx | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/components/assets.tsx b/components/assets.tsx index b82fe5c..6c88d02 100644 --- a/components/assets.tsx +++ b/components/assets.tsx @@ -33,6 +33,7 @@ const sha256Cache = new Map(); const RESOLVER_URL_PREFIXES = [ "https://rgw.watonomous.ca/asset-temp", "https://rgw.watonomous.ca/asset-perm", + "https://rgw.watonomous.ca/asset-off-perm", ] const extractSha256FromURI = (uri: string) => { @@ -72,7 +73,15 @@ async function resolveURI(uri: string) { })); // find the result with the latest expiry date - const result = maxBy(results, res => res?.expiresAt?.getTime() || 0); + const result = maxBy(results, res => { + // No result + if (!res) return 0; + + // No expiry date + if (!res.expiresAt) return Infinity; + + return res.expiresAt.getTime(); + }); if (!result) { throw new Error('Asset not found.'); } @@ -161,12 +170,14 @@ export function AssetInspector() { )} - {res.result.expiresAt && ( - <> - Expires -
{dayjs().to(res.result.expiresAt)} ({res.result.expiresAt.toISOString()})
- - )} + <> + Expires +
{
+                                        res.result.expiresAt ? 
+                                            `${dayjs().to(res.result.expiresAt)} (${res.result.expiresAt.toISOString()})` :
+                                            'Never'
+                                    }
+ {res.result.headers && ( <> Raw Headers