diff --git a/web/flat-web/deploy/nginx/nginx.conf b/web/flat-web/deploy/nginx/nginx.conf index 90241673c2b..5c28caf2448 100644 --- a/web/flat-web/deploy/nginx/nginx.conf +++ b/web/flat-web/deploy/nginx/nginx.conf @@ -16,15 +16,15 @@ http { root /app; location ~ ^/assets.+$ { - gzip on; - gzip_static on; - gzip_types application/javascript application/x-javascript text/javascript; + gzip on; + gzip_static on; + gzip_types application/javascript application/x-javascript text/javascript; - add_header Cache-Control "public, max-age=31536000"; - try_files $uri 404; + add_header Cache-Control "public, max-age=31536000"; + try_files $uri 404; } - location /apple-app-site-association { + location /.well-known/apple-app-site-association { add_header Content-Type 'application/json; charset=utf-8'; add_header Cache-Control no-cache; diff --git a/web/flat-web/public/apple-app-site-association.json b/web/flat-web/public/apple-app-site-association.json index 541852ada64..bfb8935afa4 100644 --- a/web/flat-web/public/apple-app-site-association.json +++ b/web/flat-web/public/apple-app-site-association.json @@ -1,12 +1,20 @@ { "applinks": { - "apps": [], "details": [ { - "appID": "48TB6ZZL5S.io.agora.flat", - "paths": [ - "/join/*", - "/replay/*" + "appIDs": [ + "48TB6ZZL5S.io.agora.flat", + "48TB6ZZL5S.io.agora.flint" + ], + "components": [ + { + "/": "/join/*", + "comment": "Join classroom link." + }, + { + "/": "/replay/*", + "comment": "Replay classroom link." + } ] } ] diff --git a/web/flat-web/scripts/vite-plugin-apple-app-site-association.ts b/web/flat-web/scripts/vite-plugin-apple-app-site-association.ts index 1cbde39ecc5..333919c3b81 100644 --- a/web/flat-web/scripts/vite-plugin-apple-app-site-association.ts +++ b/web/flat-web/scripts/vite-plugin-apple-app-site-association.ts @@ -28,25 +28,14 @@ export function appleAppSiteAssociation(): Plugin { } const content = await readFile(file, "utf8"); - const json = JSON.parse(content) as { applinks: { details: { appID: string }[] } }; + const json = JSON.parse(content) as { applinks: { details: { appIDs: string[] }[] } }; - json.applinks.details.forEach(detail => { - detail.appID = AppleAppID[region]; - console.log("Updated apple-app-site-association.json:", detail.appID); - }); - - // Append all appIds to allow universal links for different region apps. if (json.applinks.details.length > 0) { - const keys = Object.keys(AppleAppID) as (keyof typeof AppleAppID)[]; - keys.forEach((key) => { - const appId = AppleAppID[key]; - const appIdExist = json.applinks.details.some((detail) => detail.appID == appId); - if (!appIdExist) { - const appendingDetail = { ...json.applinks.details[0] }; - appendingDetail.appID = appId; - json.applinks.details.push(appendingDetail); - } - }); + if (region === "CN") { + json.applinks.details[0].appIDs = [AppleAppID["CN"], AppleAppID["SG"]]; + } else if (region === "SG") { + json.applinks.details[0].appIDs = [AppleAppID["SG"], AppleAppID["CN"]]; + } } await writeFile(file, JSON.stringify(json, null, 2), "utf8");