diff --git a/.gitignore b/.gitignore index d281ac369..c964349b1 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ !.eslintrc.json !.prettierrc.js !.github/ +!.well-known/ **/isolate **/keys/ **/dist/ diff --git a/firebase.remote.json b/firebase.remote.json index 3cf322beb..c2f7c64a1 100644 --- a/firebase.remote.json +++ b/firebase.remote.json @@ -16,6 +16,10 @@ } ], "rewrites": [ + { + "source": "/.well-known/assetlinks.json", + "destination": "/en/assets/.well-known/assetlinks.json" + }, { "source": "/importGeoJson", "function": "importGeoJson" diff --git a/web/scripts/copy-asset-links.js b/web/scripts/copy-asset-links.js deleted file mode 100644 index 7b113076c..000000000 --- a/web/scripts/copy-asset-links.js +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright 2025 The Ground Authors. - * - * Licensed under the Apache License, Version 2.0 (the 'License'); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an 'AS IS' BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs'; - -// This script copies the assetLinks.json file from `web/keys//` to the local -// `dist/.well-known` folder before build. This file is used for Digital Asset Links -// to associate the web app with the Android app. - -const project = process.env['npm_config_project']; - -const assertLinksFilepath = `../keys/${project}/assetLinks.json`; - -if (existsSync(assertLinksFilepath)) { - const assertLinks = readFileSync( - `../keys/${project}/assetLinks.json`, - 'utf8' - ); - - const wellKnownDir = '../dist/web/.well-known'; - - if (!existsSync(wellKnownDir)) { - mkdirSync(wellKnownDir, { recursive: true }); - } - - writeFileSync(`${wellKnownDir}/assetLinks.json`, assertLinks); -} else { - console.warn('Warning: Missing assetLinks.json file'); -} diff --git a/web/scripts/package.json b/web/scripts/package.json deleted file mode 100644 index 149a9989e..000000000 --- a/web/scripts/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "ground-web-build-scripts", - "version": "1.0.0", - "description": "Ground web app custom build scripts", - "type": "module", - "scripts": { - "copy-asset-links": "node copy-asset-links.js" - }, - "keywords": [], - "author": "", - "license": "ISC" -} diff --git a/web/src/assets/.well-known/assetlinks.json b/web/src/assets/.well-known/assetlinks.json new file mode 100644 index 000000000..220736974 --- /dev/null +++ b/web/src/assets/.well-known/assetlinks.json @@ -0,0 +1,9 @@ +[{ + "relation": ["delegate_permission/common.handle_all_urls"], + "target": { + "namespace": "android_app", + "package_name": "org.groundplatform.android", + "sha256_cert_fingerprints": + ["9f:f1:da:1e:97:93:c7:93:9a:8d:52:24:af:8b:a6:07:da:0a:10:db:1c:d2:40:47:5c:07:eb:be:c4:e8:57:80"] + } +}]