Skip to content

Commit

Permalink
isolate gcm permission for Chrome only
Browse files Browse the repository at this point in the history
  • Loading branch information
fluctlight-kayaba committed Nov 27, 2023
1 parent dc483f8 commit 2c2316e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions apps/web/scripts/bundler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ const cloneExtensionBuild = async (platform, override = {}) => {
const indexTemplate = readFileSync('./metacraft/index.html', 'utf8');
const popupTemplate = indexTemplate.replace('<body>', '<body class="popup">');

if (platform === 'chrome') {
mergedManifest.permissions = [...mergedManifest.permissions, 'gcm'];
}

if (platform !== 'firefox') {
mergedManifest.key = process.env.EXTENSION_PUBLIC_KEY;
mergedManifest.oauth2 = {
Expand Down
1 change: 0 additions & 1 deletion apps/web/scripts/bundler/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"activeTab",
"clipboardWrite",
"identity",
"gcm",
"storage",
"unlimitedStorage",
"alarms"
Expand Down
6 changes: 5 additions & 1 deletion apps/web/src/utils/firebase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ export const initializeAuth = async () => {
const deviceInfo = await getDeviceInfo();

if (runtime.isExtension) {
nextToken = await chrome.instanceID.getToken(nativeTokenArgs);
if (chrome.instandID) {
nextToken = await chrome.instanceID.getToken(nativeTokenArgs);
} else {
console.log('TODO: configure notification for this platform!');
}
} else {
const { setUserProperties, getAnalytics } = await import(
'firebase/analytics'
Expand Down

0 comments on commit 2c2316e

Please sign in to comment.