diff --git a/.github/actions/linux-build/entrypoint.sh b/.github/actions/linux-build/entrypoint.sh index 594b7d22..0f2e4b6a 100755 --- a/.github/actions/linux-build/entrypoint.sh +++ b/.github/actions/linux-build/entrypoint.sh @@ -2,7 +2,4 @@ cd /github/workspace npm ci -cd desktop -npm ci -cd /github/workspace grunt desktop-linux diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 12a3fab9..b94b0ec4 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -24,6 +24,11 @@ jobs: run: npm test - name: Grunt run: grunt + - name: Upload artifact + uses: actions/upload-artifact@v1 + with: + name: KeeWeb-${{ steps.get_tag.outputs.tag }}.html + path: dist - name: Write secrets env: VIRUS_TOTAL: ${{ secrets.VIRUS_TOTAL }} @@ -33,11 +38,6 @@ jobs: - name: Check on VirusTotal run: grunt virustotal if: ${{ github.repository == 'keeweb/keeweb' }} - - name: Upload artifact - uses: actions/upload-artifact@v1 - with: - name: KeeWeb-${{ steps.get_tag.outputs.tag }}.html - path: dist linux: runs-on: ubuntu-latest @@ -95,11 +95,6 @@ jobs: with: name: KeeWeb-${{ steps.get_tag.outputs.tag }}.linux.x86_64.rpm path: dist/desktop/KeeWeb-${{ steps.get_tag.outputs.tag }}.linux.x86_64.rpm - - name: Upload update artifact - uses: actions/upload-artifact@v1 - with: - name: UpdateDesktop.zip - path: dist/desktop/UpdateDesktop.zip darwin: runs-on: macos-latest @@ -124,9 +119,6 @@ jobs: path: dist - name: Install npm modules run: npm ci - - name: Install desktop npm modules - working-directory: desktop - run: npm ci - name: Install grunt run: sudo npm i -g grunt-cli - name: Write secrets @@ -134,10 +126,12 @@ jobs: CODESIGN: ${{ secrets.CODESIGN }} APPLE_DEPLOY_PASSWORD: ${{ secrets.APPLE_DEPLOY_PASSWORD }} APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }} + APPLE_PROVISIONING_PROFILE: ${{ secrets.APPLE_PROVISIONING_PROFILE }} run: | mkdir keys echo "$CODESIGN" > keys/codesign.json xcrun altool --store-password-in-keychain-item "AC_PASSWORD" -u "$APPLE_ID_USERNAME" -p "$APPLE_DEPLOY_PASSWORD" + echo "$APPLE_PROVISIONING_PROFILE" | base64 -d > keys/keeweb.provisionprofile - name: Import certificates uses: keeweb/import-codesign-certs@v1 with: @@ -179,9 +173,6 @@ jobs: path: dist - name: Install npm modules run: npm ci - - name: Install desktop npm modules - working-directory: desktop - run: npm ci - name: Install grunt run: npm i -g grunt-cli - name: Write secrets @@ -328,11 +319,6 @@ jobs: with: name: KeeWeb-${{ steps.get_tag.outputs.tag }}.win.arm64.zip path: assets - - name: Download update artifact - uses: actions/download-artifact@v1 - with: - name: UpdateDesktop.zip - path: assets - name: Zip html working-directory: html run: zip -vr ../assets/KeeWeb-${{ steps.get_tag.outputs.tag }}.html.zip . @@ -505,15 +491,6 @@ jobs: asset_path: assets/KeeWeb-${{ steps.get_tag.outputs.tag }}.win.arm64.zip asset_name: KeeWeb-${{ steps.get_tag.outputs.tag }}.win.arm64.zip asset_content_type: application/octet-stream - - name: Upload update asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: assets/UpdateDesktop.zip - asset_name: UpdateDesktop.zip - asset_content_type: application/octet-stream - name: Upload verify.sign asset uses: actions/upload-release-asset@v1 env: diff --git a/Gruntfile.js b/Gruntfile.js index 2fdc180b..6f90bc7b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -25,16 +25,24 @@ module.exports = function (grunt) { const dt = date.toISOString().replace(/T.*/, ''); const year = date.getFullYear(); - const minElectronVersionForUpdate = '11.0.3'; - const zipCommentPlaceholderPart = 'zip_comment_placeholder_that_will_be_replaced_with_hash'; - const zipCommentPlaceholder = - zipCommentPlaceholderPart + '.'.repeat(512 - zipCommentPlaceholderPart.length); const electronVersion = pkg.dependencies.electron.replace(/^\D/, ''); const skipSign = grunt.option('skip-sign'); const getCodeSignConfig = () => skipSign ? { identities: {} } : require('./keys/codesign.json'); - const sha = execSync('git rev-parse --short HEAD').toString('utf8').trim(); + let sha = grunt.option('commit-sha'); + if (!sha) { + try { + sha = execSync('git rev-parse --short HEAD').toString('utf8').trim(); + } catch (e) { + grunt.warn( + "Cannot get commit sha from git. It's recommended to build KeeWeb from a git repo " + + 'because commit sha is displayed in the UI, however if you would like to build from a folder, ' + + 'you can override what will be displayed in the UI with --commit-sha=xxx.' + ); + } + } + grunt.log.writeln(`Building KeeWeb v${pkg.version} (${sha})`); const webpackOptions = { date, @@ -68,6 +76,15 @@ module.exports = function (grunt) { ] }); + const linuxDependencies = [ + 'libappindicator1', + 'libgconf-2-4', + 'gnome-keyring', + 'libxtst6', + 'libx11-6', + 'libatspi2.0-0' + ]; + grunt.initConfig({ noop: { noop: {} }, clean: { @@ -127,18 +144,6 @@ module.exports = function (grunt) { expand: true, nonull: true }, - 'desktop-update': { - cwd: 'tmp/desktop/keeweb-linux-x64/resources/', - src: 'app.asar', - dest: 'tmp/desktop/update/', - expand: true, - nonull: true - }, - 'desktop-update-helper': { - src: ['helper/darwin/KeeWebHelper', 'helper/win32/KeeWebHelper.exe'], - dest: 'tmp/desktop/update/', - nonull: true - }, 'desktop-darwin-helper-x64': { src: 'helper/darwin/KeeWebHelper', dest: 'tmp/desktop/KeeWeb-darwin-x64/KeeWeb.app/Contents/Resources/', @@ -152,7 +157,7 @@ module.exports = function (grunt) { options: { mode: '0755' } }, 'desktop-darwin-installer-helper-x64': { - cwd: 'package/osx/KeeWeb Installer.app', + cwd: 'tmp/desktop/KeeWeb Installer.app', src: '**', dest: 'tmp/desktop/KeeWeb-darwin-x64/KeeWeb.app/Contents/Installer/KeeWeb Installer.app', @@ -161,7 +166,7 @@ module.exports = function (grunt) { options: { mode: true } }, 'desktop-darwin-installer-helper-arm64': { - cwd: 'package/osx/KeeWeb Installer.app', + cwd: 'tmp/desktop/KeeWeb Installer.app', src: '**', dest: 'tmp/desktop/KeeWeb-darwin-arm64/KeeWeb.app/Contents/Installer/KeeWeb Installer.app', @@ -243,6 +248,11 @@ module.exports = function (grunt) { src: `tmp/desktop/electron-builder/keeweb-${pkg.version}.AppImage`, dest: `dist/desktop/KeeWeb-${pkg.version}.linux.AppImage`, nonull: true + }, + 'darwin-installer-icon': { + src: 'graphics/icon.icns', + dest: 'tmp/desktop/KeeWeb Installer.app/Contents/Resources/applet.icns', + nonull: true } }, eslint: { @@ -250,7 +260,8 @@ module.exports = function (grunt) { desktop: ['desktop/**/*.js', '!desktop/node_modules/**'], build: ['Gruntfile.js', 'grunt.*.js', 'build/**/*.js', 'webpack.config.js'], plugins: ['plugins/**/*.js'], - util: ['util/**/*.js'] + util: ['util/**/*.js'], + installer: ['package/osx/installer.js'] }, inline: { app: { @@ -263,7 +274,7 @@ module.exports = function (grunt) { algo: 'sha512', expected: { style: 1, - script: 2 + script: 1 } }, app: { @@ -283,20 +294,20 @@ module.exports = function (grunt) { } }, 'string-replace': { - manifest: { + 'update-manifest': { options: { replacements: [ { - pattern: '# YYYY-MM-DD:v0.0.0', - replacement: '# ' + dt + ':v' + pkg.version + pattern: /"version":\s*".*?"/, + replacement: `"version": "${pkg.version}"` }, { - pattern: '# updmin:v0.0.0', - replacement: '# updmin:v' + minElectronVersionForUpdate + pattern: /"date":\s*".*?"/, + replacement: `"date": "${dt}"` } ] }, - files: { 'dist/manifest.appcache': 'app/manifest.appcache' } + files: { 'dist/update.json': 'app/update.json' } }, 'service-worker': { options: { replacements: [{ pattern: '0.0.0', replacement: pkg.version }] }, @@ -437,26 +448,37 @@ module.exports = function (grunt) { category: 'Utility' }, rpm: { - // depends: ['libappindicator1', 'libgconf-2-4', 'gnome-keyring'] + // depends: linuxDependencies }, snap: { - stagePackages: ['libappindicator1', 'libgconf-2-4', 'gnome-keyring'] + stagePackages: linuxDependencies } } } } }, + 'electron-patch': { + 'win32-x64': 'tmp/desktop/KeeWeb-win32-x64/KeeWeb.exe', + 'win32-ia32': 'tmp/desktop/KeeWeb-win32-ia32/KeeWeb.exe', + 'win32-arm64': 'tmp/desktop/KeeWeb-win32-arm64/KeeWeb.exe', + 'darwin-x64': 'tmp/desktop/KeeWeb-darwin-x64/KeeWeb.app', + 'darwin-arm64': 'tmp/desktop/KeeWeb-darwin-arm64/KeeWeb.app', + 'linux': 'tmp/desktop/KeeWeb-linux-x64/keeweb' + }, + osacompile: { + options: { + language: 'JavaScript' + }, + installer: { + files: { + 'tmp/desktop/KeeWeb Installer.app': 'package/osx/installer.js' + } + } + }, compress: { options: { level: 6 }, - 'desktop-update': { - options: { - archive: 'dist/desktop/UpdateDesktop.zip', - comment: zipCommentPlaceholder - }, - files: [{ cwd: 'tmp/desktop/update', src: '**', expand: true, nonull: true }] - }, 'win32-x64': { options: { archive: `dist/desktop/KeeWeb-${pkg.version}.win.x64.zip` }, files: [{ cwd: 'tmp/desktop/KeeWeb-win32-x64', src: '**', expand: true }] @@ -565,7 +587,7 @@ module.exports = function (grunt) { pkgName: `KeeWeb-${pkg.version}.linux.x64.deb`, targetDir: 'dist/desktop', appName: 'KeeWeb', - depends: 'libappindicator1, libgconf-2-4, gnome-keyring', + depends: linuxDependencies.join(', '), scripts: { postinst: 'package/deb/scripts/postinst' } @@ -588,50 +610,30 @@ module.exports = function (grunt) { ] } }, - 'sign-archive': { - 'desktop-update': { - options: { - file: 'dist/desktop/UpdateDesktop.zip', - signature: zipCommentPlaceholder - } - } - }, - 'sign-desktop-files': { - 'desktop-update': { - options: { - path: 'tmp/desktop/update' - } - } - }, - 'validate-desktop-update': { - desktop: { - options: { - file: 'dist/desktop/UpdateDesktop.zip', - expected: [ - 'app.asar', - 'helper/darwin/KeeWebHelper', - 'helper/win32/KeeWebHelper.exe' - ], - expectedCount: 7, - publicKey: 'app/resources/public-key.pem' - } - } - }, 'osx-sign': { options: { get identity() { return getCodeSignConfig().identities.app; }, hardenedRuntime: true, - entitlements: 'package/osx/entitlements.mac.plist', - 'entitlements-inherit': 'package/osx/entitlements.mac.plist', + entitlements: 'package/osx/entitlements.plist', + 'entitlements-inherit': 'package/osx/entitlements-inherit.plist', 'gatekeeper-assess': false }, 'desktop-x64': { + options: { + 'provisioning-profile': './keys/keeweb.provisionprofile' + }, src: 'tmp/desktop/KeeWeb-darwin-x64/KeeWeb.app' }, 'desktop-arm64': { + options: { + 'provisioning-profile': './keys/keeweb.provisionprofile' + }, src: 'tmp/desktop/KeeWeb-darwin-arm64/KeeWeb.app' + }, + 'installer': { + src: 'tmp/desktop/KeeWeb Installer.app' } }, notarize: { @@ -747,10 +749,7 @@ module.exports = function (grunt) { sign: 'dist/desktop/Verify.sign.sha256' }, files: { - 'dist/desktop/Verify.sha256': [ - 'dist/desktop/KeeWeb-*', - 'dist/desktop/UpdateDesktop.zip' - ] + 'dist/desktop/Verify.sha256': ['dist/desktop/KeeWeb-*'] } } }, diff --git a/LICENSE b/LICENSE index 1ddadb0f..d8fac939 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020 Antelle https://antelle.net +Copyright (c) 2021 Antelle https://antelle.net Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index d38cc713..93e055f1 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ Please note: donation does not imply any type of service contract. Notable contributions to KeeWeb: -- Florian Reuschel ([@Loilo](https://github.com/Loilo)): [German translation](http://keeweb.oneskyapp.com/collaboration/translate/project/project/173183/language/550) +- Florian Reuschel ([@Loilo](https://github.com/Loilo)): [German translation](https://keeweb.oneskyapp.com/collaboration/translate/project/project/173183/language/550) - Dennis Ploeger ([@dploeger](https://github.com/dploeger)): [auto-type improvements](https://github.com/keeweb/keeweb/pulls?q=is%3Apr+is%3Aclosed+author%3Adploeger) - Hackmanit ([hackmanit.de](https://www.hackmanit.de)): [penetration test](https://www.hackmanit.de/en/blog-en/104-pro-bono-penetration-test-keeweb) - Peter Bittner ([@bittner](https://github.com/bittner)): [Wikipedia article](https://en.wikipedia.org/wiki/KeeWeb) diff --git a/app/index.html b/app/index.html index f5af9960..f556a310 100644 --- a/app/index.html +++ b/app/index.html @@ -72,7 +72,6 @@ -