-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
128 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
CHROME_ID=your_chrome_id | ||
CHROME_CLIENT_ID=your_chrome_client_id | ||
CHROME_CLIENT_SECRET=your_chrome_client_secret | ||
CHROME_REFRESH_TOKEN=your_chrome_refresh_token | ||
EDGE_ID=your_edge_id | ||
EDGE_CLIENT_ID=your_edge_client_id | ||
EDGE_CLIENT_SECRET=your_edge_client_secret | ||
EDGE_ACCESS_TOKEN_URL=your_edge_access_token_url | ||
FF_ID=your_firefox_id | ||
FF_JWT_ISSUER=your_firefox_jwt_issuer | ||
FF_JWT_SECRET=your_firefox_jwt_secret | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ jobs: | |
run: pnpm install | ||
|
||
- name: Build extension | ||
run: pnpm run build | ||
run: FF_ID=${{ env.FF_ID }} pnpm build:prod | ||
|
||
- name: Zip the build | ||
run: | | ||
|
@@ -41,21 +41,21 @@ jobs: | |
client_id: ${{ secrets.CHROME_CLIENT_ID }} | ||
client_secret: ${{ secrets.CHROME_CLIENT_SECRET }} | ||
refresh_token: ${{ secrets.CHROME_REFRESH_TOKEN }} | ||
extension_id: eggfhkdnfdhdpmkfpihjjbnncgmhihce | ||
extension_id: ${{ env.CHROME_ID }} | ||
zip_file: build.zip | ||
|
||
- name: Firefox upload & release | ||
uses: cardinalby/[email protected] | ||
with: | ||
zipFilePath: build.zip | ||
extensionId: [email protected] | ||
extensionId: ${{ env.FF_ID }} | ||
jwtIssuer: ${{ secrets.FF_JWT_ISSUER }} | ||
jwtSecret: ${{ secrets.FF_JWT_SECRET }} | ||
|
||
- name: Edge upload & release | ||
uses: wdzeng/[email protected] | ||
with: | ||
product-id: 70d8655d-2c91-4b81-99b1-35afa863ea8c | ||
product-id: ${{ env.EDGE_ID }} | ||
zip-path: build.zip | ||
client-id: ${{ secrets.EDGE_CLIENT_ID }} | ||
client-secret: ${{ secrets.EDGE_CLIENT_SECRET }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { Message } from '../../types/index'; | ||
|
||
console.log('background script loaded'); | ||
|
||
chrome.runtime.onMessageExternal.addListener((message: Message, sender, sendResponse) => { | ||
if (message.action === 'openWindow') { | ||
try { | ||
chrome.windows.create({ | ||
url: 'sign.html', | ||
type: 'popup', | ||
height: 600, | ||
width: 375, | ||
top: 0, | ||
left: screen.width - 375 | ||
}); | ||
} catch (error) { | ||
console.error('Error creating window:', error); | ||
return; | ||
} | ||
sendResponse({ success: true, message: 'Window opened' }); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"compilerOptions": { | ||
"outDir": "../../build/scripts", | ||
"allowJs": true, | ||
"checkJs": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"skipLibCheck": true, | ||
"strict": true, | ||
"target": "esnext", | ||
"types": ["chrome"] | ||
}, | ||
"include": ["background.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
// removeExportFromScript.cjs | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
|
||
function removeExportStatement(directory, fileName) { | ||
console.log('Removing "export {};" from script'); | ||
const filePath = path.join(directory, fileName); | ||
let fileContent = fs.readFileSync(filePath, 'utf8'); | ||
|
||
// Replace "export {};" with an empty string | ||
fileContent = fileContent.replace('export {};', ''); | ||
|
||
fs.writeFileSync(filePath, fileContent); | ||
console.log(`"export {};" removed from: ${filePath}`); | ||
} | ||
|
||
removeExportStatement(path.resolve(__dirname, '../../build/scripts'), 'background.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
// replaceGeckoId.js | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const manifestPath = path.resolve(__dirname, '../../static/manifest.json'); | ||
|
||
const args = process.argv.slice(2); | ||
const geckoId = args[0]; | ||
|
||
if (!geckoId) { | ||
console.error('Gecko ID is not provided as an argument.'); | ||
process.exit(1); | ||
} | ||
|
||
fs.readFile(manifestPath, 'utf8', (err, data) => { | ||
if (err) { | ||
console.error('Error reading the manifest file:', err); | ||
return; | ||
} | ||
|
||
const manifest = JSON.parse(data); | ||
const updatedManifest = { | ||
...manifest, | ||
browser_specific_settings: { | ||
...manifest.browser_specific_settings, | ||
gecko: { | ||
id: geckoId | ||
} | ||
} | ||
}; | ||
|
||
fs.writeFile(manifestPath, JSON.stringify(updatedManifest, null, 2), 'utf8', (err) => { | ||
if (err) { | ||
console.error('Error writing the manifest file:', err); | ||
return; | ||
} | ||
|
||
console.log('Manifest file updated successfully.'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
{ | ||
"name": "Holo key manager", | ||
"description": "A browser extension to manage holo keys", | ||
"version": "0.0.27", | ||
"version": "0.0.28", | ||
"manifest_version": 3, | ||
"browser_specific_settings": { | ||
"gecko": { | ||
"id": "[email protected]" | ||
} | ||
}, | ||
"action": { | ||
"default_title": "Holo key manager", | ||
"default_icon": "favicon.png", | ||
|
@@ -16,5 +11,11 @@ | |
"content_security_policy": { | ||
"extension_pages": "default-src 'self' 'wasm-unsafe-eval'" | ||
}, | ||
"permissions": ["storage"] | ||
"background": { | ||
"service_worker": "scripts/background.js" | ||
}, | ||
"permissions": ["activeTab", "storage", "tabs", "nativeMessaging"], | ||
"externally_connectable": { | ||
"matches": ["*://localhost/*"] | ||
} | ||
} |