forked from akopachov/flipper-zero_authenticator-companion
-
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
8 changed files
with
170 additions
and
113 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
This file was deleted.
Oops, something went wrong.
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,89 +1,93 @@ | ||
{ | ||
"name": "flipper-authenticator-companion", | ||
"version": "1.1.0", | ||
"private": true, | ||
"description": "Flipper Authenticator Companion App", | ||
"main": "src/electron.cjs", | ||
"type": "module", | ||
"author": "Alexander Kopachov (@akopachov)", | ||
"scripts": { | ||
"dev": "cross-env NODE_ENV=dev pnpm run dev:all", | ||
"dev:all": "concurrently -n=svelte,electron -c='#ff3e00',blue \"pnpm run dev:svelte\" \"pnpm run dev:electron\"", | ||
"dev:svelte": "vite dev", | ||
"dev:electron": "electron src/electron.cjs", | ||
"build": "cross-env NODE_ENV=production pnpm run build:svelte && pnpm build:electron", | ||
"build:svelte": "vite build", | ||
"build:electron": "electron-builder --config build.config.json", | ||
"lint": "eslint src/", | ||
"lint:fix": "eslint src/ --fix" | ||
}, | ||
"browserslist": [ | ||
"Chrome 89" | ||
], | ||
"engines": { | ||
"node": ">=18", | ||
"pnpm": ">=8", | ||
"npm": "please-use-pnpm", | ||
"yarn": "please-use-pnpm" | ||
}, | ||
"devDependencies": { | ||
"@floating-ui/dom": "^1.5.1", | ||
"@skeletonlabs/skeleton": "^2.0.0", | ||
"@skeletonlabs/tw-plugin": "^0.1.0", | ||
"@sveltejs/adapter-static": "2.0.3", | ||
"@sveltejs/kit": "1.24.0", | ||
"@tailwindcss/forms": "^0.5.6", | ||
"@tailwindcss/typography": "^0.5.9", | ||
"@types/node": "^20.5.7", | ||
"@types/papaparse": "^5.3.8", | ||
"@types/uuid": "^9.0.2", | ||
"@typescript-eslint/eslint-plugin": "^6.5.0", | ||
"@typescript-eslint/parser": "^6.5.0", | ||
"async-sema": "^3.1.1", | ||
"autoprefixer": "^10.4.15", | ||
"concurrently": "^8.2.1", | ||
"cross-env": "^7.0.3", | ||
"delay": "^6.0.0", | ||
"electron": "^26.1.0", | ||
"electron-builder": "^24.6.3", | ||
"electron-connect": "^0.6.3", | ||
"electron-packager": "^17.1.2", | ||
"electron-reloader": "^1.2.3", | ||
"escape-string-regexp": "^5.0.0", | ||
"eslint": "^8.48.0", | ||
"eslint-config-prettier": "^9.0.0", | ||
"eslint-plugin-prettier": "^5.0.0", | ||
"eslint-plugin-svelte": "^2.33.0", | ||
"papaparse": "^5.4.1", | ||
"postcss": "^8.4.29", | ||
"postcss-load-config": "^4.0.1", | ||
"prettier": "^3.0.3", | ||
"prettier-plugin-svelte": "^3.0.3", | ||
"qr-scanner": "^1.4.2", | ||
"sass": "^1.66.1", | ||
"smart-buffer": "^4.2.0", | ||
"svelte": "^4.2.0", | ||
"svelte-check": "^3.5.1", | ||
"svelte-dnd-action": "^0.9.26", | ||
"svelte-eslint-parser": "^0.33.0", | ||
"svelte-preprocess": "^5.0.4", | ||
"tailwindcss": "^3.3.3", | ||
"tslib": "^2.6.2", | ||
"typescript": "^5.2.2", | ||
"url-otpauth-ng": "^3.1.0", | ||
"utc-offsets": "^1.0.0", | ||
"uuid": "^9.0.0", | ||
"vite": "^4.4.9", | ||
"vite-plugin-electron-renderer": "^0.14.5", | ||
"vite-plugin-tailwind-purgecss": "^0.1.3" | ||
}, | ||
"dependencies": { | ||
"electron-log": "^4.4.8", | ||
"electron-serve": "^1.1.0", | ||
"electron-store": "^8.1.0", | ||
"electron-updater": "^6.1.1", | ||
"electron-window-state": "^5.0.3", | ||
"node-screenshots": "^0.1.6", | ||
"serialport": "^12.0.0" | ||
} | ||
} | ||
{ | ||
"name": "flipper-authenticator-companion", | ||
"version": "1.1.0", | ||
"private": true, | ||
"description": "Flipper Authenticator Companion App", | ||
"main": "src/electron.cjs", | ||
"type": "module", | ||
"author": "Alexander Kopachov (@akopachov)", | ||
"scripts": { | ||
"dev": "cross-env NODE_ENV=dev pnpm run dev:all", | ||
"dev:all": "concurrently -n=svelte,electron -c='#ff3e00',blue \"pnpm run dev:svelte\" \"pnpm run dev:electron\"", | ||
"dev:svelte": "vite dev", | ||
"dev:electron": "electron src/electron.cjs", | ||
"build": "cross-env NODE_ENV=production pnpm run build:svelte && pnpm build:electron", | ||
"build:svelte": "vite build", | ||
"build:electron": "electron-builder --config build.config.json", | ||
"lint": "eslint src/", | ||
"lint:fix": "eslint src/ --fix", | ||
"update:icons": "node update-aegis-icons.cjs" | ||
}, | ||
"browserslist": [ | ||
"Chrome 89" | ||
], | ||
"engines": { | ||
"node": ">=18", | ||
"pnpm": ">=8", | ||
"npm": "please-use-pnpm", | ||
"yarn": "please-use-pnpm" | ||
}, | ||
"devDependencies": { | ||
"@floating-ui/dom": "^1.5.1", | ||
"@skeletonlabs/skeleton": "^2.0.0", | ||
"@skeletonlabs/tw-plugin": "^0.1.0", | ||
"@sveltejs/adapter-static": "2.0.3", | ||
"@sveltejs/kit": "1.24.0", | ||
"@tailwindcss/forms": "^0.5.6", | ||
"@tailwindcss/typography": "^0.5.9", | ||
"@types/node": "^20.5.7", | ||
"@types/papaparse": "^5.3.8", | ||
"@types/uuid": "^9.0.2", | ||
"@typescript-eslint/eslint-plugin": "^6.5.0", | ||
"@typescript-eslint/parser": "^6.5.0", | ||
"async-sema": "^3.1.1", | ||
"autoprefixer": "^10.4.15", | ||
"concurrently": "^8.2.1", | ||
"cross-env": "^7.0.3", | ||
"delay": "^6.0.0", | ||
"electron": "^26.1.0", | ||
"electron-builder": "^24.6.3", | ||
"electron-connect": "^0.6.3", | ||
"electron-packager": "^17.1.2", | ||
"electron-reloader": "^1.2.3", | ||
"escape-string-regexp": "^5.0.0", | ||
"eslint": "^8.48.0", | ||
"eslint-config-prettier": "^9.0.0", | ||
"eslint-plugin-prettier": "^5.0.0", | ||
"eslint-plugin-svelte": "^2.33.0", | ||
"papaparse": "^5.4.1", | ||
"postcss": "^8.4.29", | ||
"postcss-load-config": "^4.0.1", | ||
"prettier": "^3.0.3", | ||
"prettier-plugin-svelte": "^3.0.3", | ||
"qr-scanner": "^1.4.2", | ||
"sass": "^1.66.1", | ||
"smart-buffer": "^4.2.0", | ||
"svelte": "^4.2.0", | ||
"svelte-check": "^3.5.1", | ||
"svelte-dnd-action": "^0.9.26", | ||
"svelte-eslint-parser": "^0.33.0", | ||
"svelte-preprocess": "^5.0.4", | ||
"tailwindcss": "^3.3.3", | ||
"tslib": "^2.6.2", | ||
"typescript": "^5.2.2", | ||
"url-otpauth-ng": "^3.1.0", | ||
"utc-offsets": "^1.0.0", | ||
"uuid": "^9.0.0", | ||
"vite": "^4.4.9", | ||
"vite-plugin-electron-renderer": "^0.14.5", | ||
"vite-plugin-tailwind-purgecss": "^0.1.3" | ||
}, | ||
"dependencies": { | ||
"electron-log": "^4.4.8", | ||
"electron-serve": "^1.1.0", | ||
"electron-store": "^8.1.0", | ||
"electron-updater": "^6.1.1", | ||
"electron-window-state": "^5.0.3", | ||
"node-screenshots": "^0.1.6", | ||
"serialport": "^12.0.0" | ||
}, | ||
"optionalDependencies": { | ||
"adm-zip": "^0.5.10" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,58 @@ | ||
const AdmZip = require('adm-zip'); | ||
const fs = require('node:fs/promises'); | ||
|
||
const IconsDirectory = './static/totp-icons'; | ||
const IconsCatalogPath = './src/lib/totp-icons/catalog.json'; | ||
|
||
function mapAegisCatalog(data, tag) { | ||
return { | ||
uuid: data.uuid, | ||
name: data.name, | ||
version: data.version, | ||
tag: tag, | ||
icons: data.icons | ||
.filter(i => i.filename.includes('1_Primary')) | ||
.map(m => ({ filename: m.filename.replace('icons/1_Primary/', ''), issuer: m.issuer.map(i => i.toLowerCase()) })), | ||
}; | ||
} | ||
|
||
async function main() { | ||
const latestReleaseResponse = await fetch('https://github.com/aegis-icons/aegis-icons/releases/latest'); | ||
const actualReleaseTag = latestReleaseResponse.url.replace('https://github.com/aegis-icons/aegis-icons/releases/tag/', ''); | ||
let existingCatalogTag = 'N/A'; | ||
try { | ||
const existingCatalog = require(IconsCatalogPath); | ||
existingCatalogTag = existingCatalog.tag; | ||
} catch { | ||
/* empty */ | ||
} | ||
if (existingCatalogTag != actualReleaseTag) { | ||
console.info(`New version of AEGIS icons are available! Existing: ${existingCatalogTag}, New: ${actualReleaseTag}`); | ||
console.info('Downloading ZIP'); | ||
const catalogZipResponse = await fetch( | ||
'https://github.com/aegis-icons/aegis-icons/releases/latest/download/aegis-icons.zip', | ||
); | ||
|
||
const catalogZipBuffer = Buffer.from(await catalogZipResponse.arrayBuffer()); | ||
const catalogZip = new AdmZip(catalogZipBuffer, { readEntries: true }); | ||
await fs.rm(IconsDirectory, { recursive: true, force: true }); | ||
|
||
console.info('Extracting icons'); | ||
await fs.mkdir(IconsDirectory, { recursive: true }); | ||
for (let entry of catalogZip.getEntries()) { | ||
if (entry.entryName.startsWith('icons/1_Primary') || entry.entryName == 'icons/3_Generic/Key.svg') { | ||
catalogZip.extractEntryTo(entry, IconsDirectory, false, true, false); | ||
} | ||
} | ||
|
||
console.info('Building catalog file'); | ||
const rawCatalog = JSON.parse(catalogZip.getEntry('pack.json').getData().toString('utf-8')); | ||
const filteredCatalog = mapAegisCatalog(rawCatalog, actualReleaseTag); | ||
await fs.writeFile(IconsCatalogPath, JSON.stringify(filteredCatalog)); | ||
console.log('Done!'); | ||
} else { | ||
console.info('No new version available'); | ||
} | ||
} | ||
|
||
main(); |