@bubblewrap/core 1.22.3 → 1.22.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/TwaManifest.d.ts +3 -0
- package/dist/lib/TwaManifest.js +24 -6
- package/dist/lib/features/EmptyFeature.d.ts +1 -0
- package/dist/lib/features/EmptyFeature.js +1 -0
- package/dist/lib/features/Feature.d.ts +4 -0
- package/dist/lib/features/FeatureManager.d.ts +1 -0
- package/dist/lib/features/FeatureManager.js +10 -2
- package/dist/lib/features/LocationDelegationFeature.js +1 -1
- package/dist/lib/features/PlayBillingFeature.js +1 -1
- package/dist/lib/features/ProtocolHandlersFeature.d.ts +5 -0
- package/dist/lib/features/ProtocolHandlersFeature.js +46 -0
- package/dist/lib/types/ProtocolHandler.d.ts +7 -0
- package/dist/lib/types/ProtocolHandler.js +90 -0
- package/dist/lib/types/WebManifest.d.ts +2 -0
- package/package.json +2 -2
- package/template_project/.gradle/8.11.1/checksums/checksums.lock +0 -0
- package/template_project/.gradle/8.11.1/fileChanges/last-build.bin +0 -0
- package/template_project/.gradle/8.11.1/fileHashes/fileHashes.lock +0 -0
- package/template_project/.gradle/8.11.1/gc.properties +0 -0
- package/template_project/.gradle/8.8/checksums/checksums.lock +0 -0
- package/template_project/.gradle/8.8/fileHashes/fileHashes.lock +0 -0
- package/template_project/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/template_project/.gradle/buildOutputCleanup/cache.properties +2 -2
- package/template_project/app/build.gradle +1 -1
- package/template_project/app/src/main/AndroidManifest.xml +4 -0
- package/template_project/build.gradle +1 -1
- package/template_project/gradle/wrapper/gradle-wrapper.properties +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Color = require('color');
|
|
2
2
|
import { ShareTarget, WebManifestIcon, WebManifestJson } from './types/WebManifest';
|
|
3
|
+
import { ProtocolHandler } from './types/ProtocolHandler';
|
|
3
4
|
import { ShortcutInfo } from './ShortcutInfo';
|
|
4
5
|
import { AppsFlyerConfig } from './features/AppsFlyerFeature';
|
|
5
6
|
import { LocationDelegationConfig } from './features/LocationDelegationFeature';
|
|
@@ -101,6 +102,7 @@ export declare class TwaManifest {
|
|
|
101
102
|
serviceAccountJsonFile: string | undefined;
|
|
102
103
|
additionalTrustedOrigins: string[];
|
|
103
104
|
retainedBundles: number[];
|
|
105
|
+
protocolHandlers?: ProtocolHandler[];
|
|
104
106
|
private static log;
|
|
105
107
|
constructor(data: TwaManifestJson);
|
|
106
108
|
/**
|
|
@@ -237,6 +239,7 @@ export interface TwaManifestJson {
|
|
|
237
239
|
serviceAccountJsonFile?: string;
|
|
238
240
|
additionalTrustedOrigins?: string[];
|
|
239
241
|
retainedBundles?: number[];
|
|
242
|
+
protocolHandlers?: ProtocolHandler[];
|
|
240
243
|
}
|
|
241
244
|
export interface SigningKeyInfo {
|
|
242
245
|
path: string;
|
package/dist/lib/TwaManifest.js
CHANGED
|
@@ -23,6 +23,7 @@ const FetchUtils_1 = require("./FetchUtils");
|
|
|
23
23
|
const util_1 = require("./util");
|
|
24
24
|
const Color = require("color");
|
|
25
25
|
const Log_1 = require("./Log");
|
|
26
|
+
const ProtocolHandler_1 = require("./types/ProtocolHandler");
|
|
26
27
|
const ShortcutInfo_1 = require("./ShortcutInfo");
|
|
27
28
|
// The minimum size needed for the app icon.
|
|
28
29
|
const MIN_ICON_SIZE = 512;
|
|
@@ -31,7 +32,7 @@ const SHORT_NAME_MAX_SIZE = 12;
|
|
|
31
32
|
// The minimum size needed for the notification icon
|
|
32
33
|
const MIN_NOTIFICATION_ICON_SIZE = 48;
|
|
33
34
|
// Supported display modes for TWA
|
|
34
|
-
const DISPLAY_MODE_VALUES = ['standalone', 'fullscreen', 'fullscreen-sticky'];
|
|
35
|
+
const DISPLAY_MODE_VALUES = ['standalone', 'minimal-ui', 'fullscreen', 'fullscreen-sticky'];
|
|
35
36
|
exports.DisplayModes = [...DISPLAY_MODE_VALUES];
|
|
36
37
|
function asDisplayMode(input) {
|
|
37
38
|
return DISPLAY_MODE_VALUES.includes(input) ? input : null;
|
|
@@ -147,6 +148,7 @@ class TwaManifest {
|
|
|
147
148
|
this.serviceAccountJsonFile = data.serviceAccountJsonFile;
|
|
148
149
|
this.additionalTrustedOrigins = data.additionalTrustedOrigins || [];
|
|
149
150
|
this.retainedBundles = data.retainedBundles || [];
|
|
151
|
+
this.protocolHandlers = data.protocolHandlers;
|
|
150
152
|
}
|
|
151
153
|
/**
|
|
152
154
|
* Turns an TwaManifest into a TwaManifestJson.
|
|
@@ -217,7 +219,7 @@ class TwaManifest {
|
|
|
217
219
|
* @returns {TwaManifest}
|
|
218
220
|
*/
|
|
219
221
|
static fromWebManifestJson(webManifestUrl, webManifest) {
|
|
220
|
-
var _a;
|
|
222
|
+
var _a, _b;
|
|
221
223
|
const icon = (0, util_1.findSuitableIcon)(webManifest.icons, 'any', MIN_ICON_SIZE);
|
|
222
224
|
const maskableIcon = (0, util_1.findSuitableIcon)(webManifest.icons, 'maskable', MIN_ICON_SIZE);
|
|
223
225
|
const monochromeIcon = (0, util_1.findSuitableIcon)(webManifest.icons, 'monochrome', MIN_NOTIFICATION_ICON_SIZE);
|
|
@@ -227,12 +229,13 @@ class TwaManifest {
|
|
|
227
229
|
function resolveIconUrl(icon) {
|
|
228
230
|
return icon ? new URL(icon.src, webManifestUrl).toString() : undefined;
|
|
229
231
|
}
|
|
232
|
+
const processedProtocolHandlers = (0, ProtocolHandler_1.processProtocolHandlers)((_a = webManifest.protocol_handlers) !== null && _a !== void 0 ? _a : [], fullStartUrl, fullScopeUrl);
|
|
230
233
|
const twaManifest = new TwaManifest({
|
|
231
234
|
packageId: (0, util_1.generatePackageId)(webManifestUrl.host) || '',
|
|
232
235
|
host: webManifestUrl.host,
|
|
233
236
|
name: webManifest['name'] || webManifest['short_name'] || DEFAULT_APP_NAME,
|
|
234
237
|
launcherName: webManifest['short_name'] ||
|
|
235
|
-
((
|
|
238
|
+
((_b = webManifest['name']) === null || _b === void 0 ? void 0 : _b.substring(0, SHORT_NAME_MAX_SIZE)) || DEFAULT_APP_NAME,
|
|
236
239
|
display: asDisplayMode(webManifest['display']) || DEFAULT_DISPLAY_MODE,
|
|
237
240
|
themeColor: webManifest['theme_color'] || DEFAULT_THEME_COLOR,
|
|
238
241
|
themeColorDark: DEFAULT_THEME_COLOR_DARK,
|
|
@@ -258,6 +261,7 @@ class TwaManifest {
|
|
|
258
261
|
shareTarget: TwaManifest.verifyShareTarget(webManifestUrl, webManifest.share_target),
|
|
259
262
|
orientation: asOrientation(webManifest.orientation) || DEFAULT_ORIENTATION,
|
|
260
263
|
fullScopeUrl: fullScopeUrl.toString(),
|
|
264
|
+
protocolHandlers: processedProtocolHandlers,
|
|
261
265
|
});
|
|
262
266
|
return twaManifest;
|
|
263
267
|
}
|
|
@@ -369,7 +373,7 @@ class TwaManifest {
|
|
|
369
373
|
* @returns {Promise<TwaManifest>} the new and merged Twa manifest.
|
|
370
374
|
*/
|
|
371
375
|
static async merge(fieldsToIgnore, webManifestUrl, webManifest, oldTwaManifest) {
|
|
372
|
-
var _a, _b;
|
|
376
|
+
var _a, _b, _c, _d;
|
|
373
377
|
let shortcuts = oldTwaManifest.shortcuts;
|
|
374
378
|
if (!(fieldsToIgnore.includes('shortcuts'))) {
|
|
375
379
|
shortcuts = this.getShortcuts(webManifestUrl, webManifest);
|
|
@@ -378,15 +382,28 @@ class TwaManifest {
|
|
|
378
382
|
const iconUrl = this.getNewIconUrl(fieldsToIgnore, 'icons', oldTwaManifestJson.iconUrl, webManifest.icons, 'any', MIN_ICON_SIZE, webManifestUrl);
|
|
379
383
|
const maskableIconUrl = this.getNewIconUrl(fieldsToIgnore, 'maskableIcons', oldTwaManifestJson.iconUrl, webManifest.icons, 'maskable', MIN_ICON_SIZE, webManifestUrl);
|
|
380
384
|
const monochromeIconUrl = this.getNewIconUrl(fieldsToIgnore, 'monochromeIcons', oldTwaManifestJson.iconUrl, webManifest.icons, 'monochrome', MIN_NOTIFICATION_ICON_SIZE, webManifestUrl);
|
|
385
|
+
const protocolHandlersMap = new Map();
|
|
386
|
+
for (const handler of (_a = oldTwaManifest.protocolHandlers) !== null && _a !== void 0 ? _a : []) {
|
|
387
|
+
protocolHandlersMap.set(handler.protocol, handler.url);
|
|
388
|
+
}
|
|
389
|
+
if (!(fieldsToIgnore.includes('protocol_handlers'))) {
|
|
390
|
+
for (const handler of (_b = webManifest.protocol_handlers) !== null && _b !== void 0 ? _b : []) {
|
|
391
|
+
protocolHandlersMap.set(handler.protocol, handler.url);
|
|
392
|
+
}
|
|
393
|
+
;
|
|
394
|
+
}
|
|
395
|
+
const protocolHandlers = Array.from(protocolHandlersMap.entries()).map(([protocol, url]) => {
|
|
396
|
+
return { protocol, url };
|
|
397
|
+
});
|
|
381
398
|
const fullStartUrl = new URL(webManifest['start_url'] || '/', webManifestUrl);
|
|
382
399
|
const fullScopeUrl = new URL(webManifest['scope'] || '.', webManifestUrl);
|
|
383
400
|
const twaManifest = new TwaManifest({
|
|
384
401
|
...oldTwaManifestJson,
|
|
385
402
|
name: this.getNewFieldValue('name', fieldsToIgnore, oldTwaManifest.name, webManifest['name'] || webManifest['short_name']),
|
|
386
403
|
launcherName: this.getNewFieldValue('short_name', fieldsToIgnore, oldTwaManifest.launcherName, webManifest['short_name'] ||
|
|
387
|
-
((
|
|
404
|
+
((_c = webManifest['name']) === null || _c === void 0 ? void 0 : _c.substring(0, SHORT_NAME_MAX_SIZE))),
|
|
388
405
|
display: this.getNewFieldValue('display', fieldsToIgnore, oldTwaManifest.display, asDisplayMode(webManifest['display'])),
|
|
389
|
-
fullScopeUrl: this.getNewFieldValue('fullScopeUrl', fieldsToIgnore, (
|
|
406
|
+
fullScopeUrl: this.getNewFieldValue('fullScopeUrl', fieldsToIgnore, (_d = oldTwaManifest.fullScopeUrl) === null || _d === void 0 ? void 0 : _d.toString(), fullScopeUrl.toString()),
|
|
390
407
|
themeColor: this.getNewFieldValue('themeColor', fieldsToIgnore, oldTwaManifest.themeColor.hex(), webManifest['theme_color']),
|
|
391
408
|
backgroundColor: this.getNewFieldValue('backgroundColor', fieldsToIgnore, oldTwaManifest.backgroundColor.hex(), webManifest['background_color']),
|
|
392
409
|
startUrl: this.getNewFieldValue('startUrl', fieldsToIgnore, oldTwaManifest.startUrl, fullStartUrl.pathname + fullStartUrl.search),
|
|
@@ -394,6 +411,7 @@ class TwaManifest {
|
|
|
394
411
|
maskableIconUrl: maskableIconUrl || oldTwaManifestJson.maskableIconUrl,
|
|
395
412
|
monochromeIconUrl: monochromeIconUrl || oldTwaManifestJson.monochromeIconUrl,
|
|
396
413
|
shortcuts: shortcuts,
|
|
414
|
+
protocolHandlers: protocolHandlers,
|
|
397
415
|
});
|
|
398
416
|
return twaManifest;
|
|
399
417
|
}
|
|
@@ -53,6 +53,10 @@ export interface Feature {
|
|
|
53
53
|
* Additional meta-data items to be added into the `application` tag.
|
|
54
54
|
*/
|
|
55
55
|
applicationMetadata: Metadata[];
|
|
56
|
+
/**
|
|
57
|
+
* Additional manifest entries to be added into the `activity` tag of LauncherActivity.
|
|
58
|
+
*/
|
|
59
|
+
launcherActivityEntries: string[];
|
|
56
60
|
};
|
|
57
61
|
/**
|
|
58
62
|
* Customizations to be added to `app/src/main/java/<app-package>/Application.java`.
|
|
@@ -22,9 +22,10 @@ const PlayBillingFeature_1 = require("./PlayBillingFeature");
|
|
|
22
22
|
const FirstRunFlagFeature_1 = require("./FirstRunFlagFeature");
|
|
23
23
|
const Log_1 = require("../Log");
|
|
24
24
|
const ArCoreFeature_1 = require("./ArCoreFeature");
|
|
25
|
+
const ProtocolHandlersFeature_1 = require("./ProtocolHandlersFeature");
|
|
25
26
|
const ANDROID_BROWSER_HELPER_VERSIONS = {
|
|
26
|
-
stable: 'com.google.androidbrowserhelper:androidbrowserhelper:2.
|
|
27
|
-
alpha: 'com.google.androidbrowserhelper:androidbrowserhelper:2.
|
|
27
|
+
stable: 'com.google.androidbrowserhelper:androidbrowserhelper:2.6.0',
|
|
28
|
+
alpha: 'com.google.androidbrowserhelper:androidbrowserhelper:2.6.0',
|
|
28
29
|
};
|
|
29
30
|
/**
|
|
30
31
|
* Analyzes a TwaManifest to collect enable features and aggregates all customizations that will
|
|
@@ -44,6 +45,7 @@ class FeatureManager {
|
|
|
44
45
|
permissions: new Set(),
|
|
45
46
|
components: new Array(),
|
|
46
47
|
applicationMetadata: new Array(),
|
|
48
|
+
launcherActivityEntries: new Array(),
|
|
47
49
|
};
|
|
48
50
|
this.applicationClass = {
|
|
49
51
|
imports: new Set(),
|
|
@@ -95,6 +97,9 @@ class FeatureManager {
|
|
|
95
97
|
if (twaManifest.enableNotifications) {
|
|
96
98
|
this.androidManifest.permissions.add('android.permission.POST_NOTIFICATIONS');
|
|
97
99
|
}
|
|
100
|
+
if (twaManifest.protocolHandlers) {
|
|
101
|
+
this.addFeature(new ProtocolHandlersFeature_1.ProtocolHandlersFeature(twaManifest.protocolHandlers));
|
|
102
|
+
}
|
|
98
103
|
}
|
|
99
104
|
addFeature(feature) {
|
|
100
105
|
// Adds properties to build.
|
|
@@ -124,6 +129,9 @@ class FeatureManager {
|
|
|
124
129
|
feature.androidManifest.applicationMetadata.forEach((metadata) => {
|
|
125
130
|
this.androidManifest.applicationMetadata.push(metadata);
|
|
126
131
|
});
|
|
132
|
+
feature.androidManifest.launcherActivityEntries.forEach((entry) => {
|
|
133
|
+
this.androidManifest.launcherActivityEntries.push(entry);
|
|
134
|
+
});
|
|
127
135
|
// Adds properties to launcherActivity.
|
|
128
136
|
feature.launcherActivity.imports.forEach((imp) => {
|
|
129
137
|
this.launcherActivity.imports.add(imp);
|
|
@@ -20,7 +20,7 @@ const EmptyFeature_1 = require("./EmptyFeature");
|
|
|
20
20
|
class LocationDelegationFeature extends EmptyFeature_1.EmptyFeature {
|
|
21
21
|
constructor() {
|
|
22
22
|
super('locationDelegation');
|
|
23
|
-
this.buildGradle.dependencies.push('com.google.androidbrowserhelper:locationdelegation:1.1.
|
|
23
|
+
this.buildGradle.dependencies.push('com.google.androidbrowserhelper:locationdelegation:1.1.2');
|
|
24
24
|
this.androidManifest.components.push(`<activity android:name=
|
|
25
25
|
"com.google.androidbrowserhelper.locationdelegation.PermissionRequestActivity"/>`);
|
|
26
26
|
this.delegationService.imports.push('com.google.androidbrowserhelper.locationdelegation' +
|
|
@@ -20,7 +20,7 @@ const EmptyFeature_1 = require("./EmptyFeature");
|
|
|
20
20
|
class PlayBillingFeature extends EmptyFeature_1.EmptyFeature {
|
|
21
21
|
constructor() {
|
|
22
22
|
super('playbilling');
|
|
23
|
-
this.buildGradle.dependencies.push('com.google.androidbrowserhelper:billing:1.0.
|
|
23
|
+
this.buildGradle.dependencies.push('com.google.androidbrowserhelper:billing:1.0.1');
|
|
24
24
|
this.androidManifest.components.push(`
|
|
25
25
|
<activity
|
|
26
26
|
android:name="com.google.androidbrowserhelper.playbilling.provider.PaymentActivity"
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2025 Google Inc. All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.ProtocolHandlersFeature = void 0;
|
|
19
|
+
const EmptyFeature_1 = require("./EmptyFeature");
|
|
20
|
+
class ProtocolHandlersFeature extends EmptyFeature_1.EmptyFeature {
|
|
21
|
+
constructor(protocolHandlers) {
|
|
22
|
+
super('protocolHandlers');
|
|
23
|
+
if (protocolHandlers.length === 0)
|
|
24
|
+
return;
|
|
25
|
+
for (const handler of protocolHandlers) {
|
|
26
|
+
this.androidManifest.launcherActivityEntries.push(`<intent-filter>
|
|
27
|
+
<action android:name="android.intent.action.VIEW"/>
|
|
28
|
+
<category android:name="android.intent.category.DEFAULT" />
|
|
29
|
+
<category android:name="android.intent.category.BROWSABLE"/>
|
|
30
|
+
<data android:scheme="${handler.protocol}" />
|
|
31
|
+
</intent-filter>`);
|
|
32
|
+
}
|
|
33
|
+
this.launcherActivity.imports.push('java.util.HashMap', 'java.util.Map');
|
|
34
|
+
const mapEntries = new Array();
|
|
35
|
+
for (const handler of protocolHandlers) {
|
|
36
|
+
mapEntries.push(`registry.put("${handler.protocol}", Uri.parse("${handler.url}"));`);
|
|
37
|
+
}
|
|
38
|
+
this.launcherActivity.methods.push(`@Override
|
|
39
|
+
protected Map<String, Uri> getProtocolHandlers() {
|
|
40
|
+
Map<String, Uri> registry = new HashMap<>();
|
|
41
|
+
${mapEntries.join('\n')}
|
|
42
|
+
return registry;
|
|
43
|
+
}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.ProtocolHandlersFeature = ProtocolHandlersFeature;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface ProtocolHandler {
|
|
2
|
+
protocol: string;
|
|
3
|
+
url: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function processProtocolHandlers(protocolHandlers: ProtocolHandler[], startUrl: URL, scopeUrl: URL): ProtocolHandler[];
|
|
6
|
+
export declare function normalizeProtocolForTesting(protocol: string): string | undefined;
|
|
7
|
+
export declare function normalizeUrlForTesting(url: string, startUrl: URL, scopeUrl: URL): string | undefined;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2025 Google Inc. All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.processProtocolHandlers = processProtocolHandlers;
|
|
19
|
+
exports.normalizeProtocolForTesting = normalizeProtocolForTesting;
|
|
20
|
+
exports.normalizeUrlForTesting = normalizeUrlForTesting;
|
|
21
|
+
const ProtocolHandlerExtraScheme = /^web\+[a-z]+$/;
|
|
22
|
+
const ProtcolHandlerAllowedSchemes = [
|
|
23
|
+
'bitcoin', 'ftp', 'ftps', 'geo', 'im', 'irc', 'ircs',
|
|
24
|
+
'magnet', 'mailto', 'matrix', 'news', 'nntp', 'openpgp4fpr',
|
|
25
|
+
'sftp', 'sip', 'ssh', 'urn', 'webcal', 'wtai', 'xmpp',
|
|
26
|
+
];
|
|
27
|
+
// 'mms', 'sms', 'smsto', and 'tel' are not supported!
|
|
28
|
+
function normalizeProtocol(protocol) {
|
|
29
|
+
const normalized = protocol.toLowerCase();
|
|
30
|
+
if (ProtcolHandlerAllowedSchemes.includes(normalized)) {
|
|
31
|
+
return normalized;
|
|
32
|
+
}
|
|
33
|
+
if (ProtocolHandlerExtraScheme.test(normalized)) {
|
|
34
|
+
return normalized;
|
|
35
|
+
}
|
|
36
|
+
console.warn('Ignoring invalid protocol:', protocol);
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
function normalizeUrl(url, startUrl, scopeUrl) {
|
|
40
|
+
if (!url.includes('%s')) {
|
|
41
|
+
console.warn('Ignoring url without %%s:', url);
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
const absoluteUrl = new URL(url);
|
|
46
|
+
if (absoluteUrl.protocol !== 'https:') {
|
|
47
|
+
console.warn('Ignoring absolute url with illegal scheme:', absoluteUrl.toString());
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
if (absoluteUrl.origin != scopeUrl.origin) {
|
|
51
|
+
console.warn('Ignoring absolute url with invalid origin:', absoluteUrl.toString());
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
if (!absoluteUrl.pathname.startsWith(scopeUrl.pathname)) {
|
|
55
|
+
console.warn('Ignoring absolute url not within manifest scope: ', absoluteUrl.toString());
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
return absoluteUrl.toString();
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
// Expected, url might be relative!
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
const relativeUrl = new URL(url, startUrl);
|
|
65
|
+
return relativeUrl.toString();
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
console.warn('Ignoring invalid relative url:', url);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function processProtocolHandlers(protocolHandlers, startUrl, scopeUrl) {
|
|
72
|
+
const processedProtocolHandlers = [];
|
|
73
|
+
for (const handler of protocolHandlers) {
|
|
74
|
+
if (!handler.protocol || !handler.url)
|
|
75
|
+
continue;
|
|
76
|
+
const normalizedProtocol = normalizeProtocol(handler.protocol);
|
|
77
|
+
const normalizedUrl = normalizeUrl(handler.url, startUrl, scopeUrl);
|
|
78
|
+
if (!normalizedProtocol || !normalizedUrl) {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
processedProtocolHandlers.push({ protocol: normalizedProtocol, url: normalizedUrl });
|
|
82
|
+
}
|
|
83
|
+
return processedProtocolHandlers;
|
|
84
|
+
}
|
|
85
|
+
function normalizeProtocolForTesting(protocol) {
|
|
86
|
+
return normalizeProtocol(protocol);
|
|
87
|
+
}
|
|
88
|
+
function normalizeUrlForTesting(url, startUrl, scopeUrl) {
|
|
89
|
+
return normalizeUrl(url, startUrl, scopeUrl);
|
|
90
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ProtocolHandler } from './ProtocolHandler';
|
|
1
2
|
export interface WebManifestIcon {
|
|
2
3
|
src: string;
|
|
3
4
|
sizes?: string;
|
|
@@ -41,5 +42,6 @@ export interface WebManifestJson {
|
|
|
41
42
|
shortcuts?: Array<WebManifestShortcutJson>;
|
|
42
43
|
share_target?: ShareTarget;
|
|
43
44
|
orientation?: OrientationLock;
|
|
45
|
+
protocol_handlers?: Array<ProtocolHandler>;
|
|
44
46
|
}
|
|
45
47
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bubblewrap/core",
|
|
3
|
-
"version": "1.22.
|
|
3
|
+
"version": "1.22.5",
|
|
4
4
|
"description": "Core Library to generate, build and sign TWA projects",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=14.15.0"
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"tar": "^6.1.0",
|
|
58
58
|
"valid-url": "^1.0.9"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "5ab043ae7f55f7bc94ae62f60ec1e05ad648f615"
|
|
61
61
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#
|
|
2
|
-
gradle.version=8.
|
|
1
|
+
#Tue Apr 22 08:33:00 UTC 2025
|
|
2
|
+
gradle.version=8.11.1
|
|
@@ -207,6 +207,10 @@
|
|
|
207
207
|
android:host="<%= additionalOrigin %>"/>
|
|
208
208
|
</intent-filter>
|
|
209
209
|
<% } %>
|
|
210
|
+
|
|
211
|
+
<% for(const entry of androidManifest.launcherActivityEntries) { %>
|
|
212
|
+
<%= entry %>
|
|
213
|
+
<% } %>
|
|
210
214
|
</activity>
|
|
211
215
|
|
|
212
216
|
<activity android:name="com.google.androidbrowserhelper.trusted.FocusActivity" />
|
|
@@ -23,7 +23,7 @@ buildscript {
|
|
|
23
23
|
jcenter()
|
|
24
24
|
}
|
|
25
25
|
dependencies {
|
|
26
|
-
classpath 'com.android.tools.build:gradle:8.
|
|
26
|
+
classpath 'com.android.tools.build:gradle:8.9.1'
|
|
27
27
|
|
|
28
28
|
// NOTE: Do not place your application dependencies here; they belong
|
|
29
29
|
// in the individual module build.gradle files
|
|
@@ -2,6 +2,6 @@ distributionBase=GRADLE_USER_HOME
|
|
|
2
2
|
distributionPath=wrapper/dists
|
|
3
3
|
zipStoreBase=GRADLE_USER_HOME
|
|
4
4
|
zipStorePath=wrapper/dists
|
|
5
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.
|
|
5
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
|
6
6
|
networkTimeout=10000
|
|
7
7
|
validateDistributionUrl=true
|