mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 22:03:36 +00:00
Move desktop into apps/desktop
This commit is contained in:
62
apps/desktop/scripts/after-sign.js
Normal file
62
apps/desktop/scripts/after-sign.js
Normal file
@@ -0,0 +1,62 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires, no-console */
|
||||
require("dotenv").config();
|
||||
const path = require("path");
|
||||
|
||||
const { deepAssign } = require("builder-util");
|
||||
const { notarize } = require("electron-notarize");
|
||||
const fse = require("fs-extra");
|
||||
|
||||
exports.default = run;
|
||||
|
||||
async function run(context) {
|
||||
console.log("## After sign");
|
||||
// console.log(context);
|
||||
|
||||
const appName = context.packager.appInfo.productFilename;
|
||||
const appPath = `${context.appOutDir}/${appName}.app`;
|
||||
const macBuild = context.electronPlatformName === "darwin";
|
||||
const copyPlugIn = ["darwin", "mas"].includes(context.electronPlatformName);
|
||||
|
||||
if (copyPlugIn) {
|
||||
// Copy Safari plugin to work-around https://github.com/electron-userland/electron-builder/issues/5552
|
||||
const plugIn = path.join(__dirname, "../PlugIns");
|
||||
if (fse.existsSync(plugIn)) {
|
||||
fse.mkdirSync(path.join(appPath, "Contents/PlugIns"));
|
||||
fse.copySync(
|
||||
path.join(plugIn, "safari.appex"),
|
||||
path.join(appPath, "Contents/PlugIns/safari.appex")
|
||||
);
|
||||
|
||||
// Resign to sign safari extension
|
||||
if (context.electronPlatformName === "mas") {
|
||||
const masBuildOptions = deepAssign(
|
||||
{},
|
||||
context.packager.platformSpecificBuildOptions,
|
||||
context.packager.config.mas
|
||||
);
|
||||
if (context.targets.some((e) => e.name === "mas-dev")) {
|
||||
deepAssign(masBuildOptions, {
|
||||
type: "development",
|
||||
});
|
||||
}
|
||||
if (context.packager.packagerOptions.prepackaged == null) {
|
||||
await context.packager.sign(appPath, context.appOutDir, masBuildOptions, context.arch);
|
||||
}
|
||||
} else {
|
||||
await context.packager.signApp(context, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (macBuild) {
|
||||
console.log("### Notarizing " + appPath);
|
||||
const appleId = process.env.APPLE_ID_USERNAME || process.env.APPLEID;
|
||||
const appleIdPassword = process.env.APPLE_ID_PASSWORD || `@keychain:AC_PASSWORD`;
|
||||
return await notarize({
|
||||
appBundleId: "com.bitwarden.desktop",
|
||||
appPath: appPath,
|
||||
appleId: appleId,
|
||||
appleIdPassword: appleIdPassword,
|
||||
});
|
||||
}
|
||||
}
|
||||
17
apps/desktop/scripts/cask-update.ps1
Normal file
17
apps/desktop/scripts/cask-update.ps1
Normal file
@@ -0,0 +1,17 @@
|
||||
param (
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string] $version
|
||||
)
|
||||
|
||||
# Dependencies:
|
||||
# 1. brew cask install powershell
|
||||
# 2. brew install vitorgalvao/tiny-scripts/cask-repair
|
||||
# see https://github.com/Homebrew/homebrew-cask/blob/master/CONTRIBUTING.md#updating-a-cask
|
||||
# 3. fork of homebrew-cask repo setup.
|
||||
# see https://github.com/caskroom/homebrew-cask/blob/master/CONTRIBUTING.md#getting-set-up-to-contribute
|
||||
# 4. Environment variables for GITHUB_USER and GITHUB_TOKEN set.
|
||||
#
|
||||
# To run:
|
||||
# pwsh ./cask-update.ps1 -version 1.3.0
|
||||
|
||||
cask-repair --cask-version $version --blind-submit --fail-on-error bitwarden
|
||||
34
apps/desktop/scripts/choco-update.ps1
Normal file
34
apps/desktop/scripts/choco-update.ps1
Normal file
@@ -0,0 +1,34 @@
|
||||
param (
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string] $version
|
||||
)
|
||||
|
||||
# To run:
|
||||
# .\choco-update.ps1 -version 1.3.0
|
||||
|
||||
$dir = Split-Path -Parent $MyInvocation.MyCommand.Path;
|
||||
$rootDir = $dir + "\..";
|
||||
$distDir = $rootDir + "\dist";
|
||||
$chocoDir = $rootDir + "\stores\chocolatey";
|
||||
$distChocoDir = $distDir + "\chocolatey";
|
||||
|
||||
if(Test-Path -Path $distChocoDir) {
|
||||
Remove-Item -Recurse -Force $distChocoDir
|
||||
}
|
||||
|
||||
Copy-Item -Path $chocoDir -Destination $distChocoDir –Recurse
|
||||
|
||||
$exe = $distChocoDir + "\Bitwarden-Installer-" + $version + ".exe";
|
||||
$uri = "https://github.com/bitwarden/desktop/releases/download/v" + $version + "/Bitwarden-Installer-" + $version + ".exe";
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
Invoke-RestMethod -Uri $uri -OutFile $exe
|
||||
|
||||
$checksum = checksum -t sha256 $exe
|
||||
$nuspec = $distChocoDir + "\bitwarden.nuspec";
|
||||
$chocoInstall = $distChocoDir + "\tools\chocolateyinstall.ps1";
|
||||
|
||||
(Get-Content $chocoInstall).replace('__version__', $version).replace('__checksum__', $checksum) | Set-Content $chocoInstall
|
||||
choco pack $nuspec --version $version --out $distChocoDir
|
||||
cd $distChocoDir
|
||||
choco push
|
||||
cd $rootDir
|
||||
1
apps/desktop/scripts/dev/.gitignore
vendored
Normal file
1
apps/desktop/scripts/dev/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
data
|
||||
19
apps/desktop/scripts/dev/docker-compose.yml
Normal file
19
apps/desktop/scripts/dev/docker-compose.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
minio:
|
||||
image: minio/minio
|
||||
command: server /data --console-address ":9001"
|
||||
ports:
|
||||
- "9000:9000"
|
||||
- "9001:9001"
|
||||
# environment:
|
||||
# MINIO_ROOT_USER: minioadmin
|
||||
# MINIO_ROOT_PASSWORD: minioadmin
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
volumes:
|
||||
- ./data:/data
|
||||
12
apps/desktop/scripts/download-legacy-safari.ps1
Normal file
12
apps/desktop/scripts/download-legacy-safari.ps1
Normal file
@@ -0,0 +1,12 @@
|
||||
$dir = Split-Path -Parent $MyInvocation.MyCommand.Path;
|
||||
$rootDir = $dir + "\..";
|
||||
$outputPath = $rootDir + "\PlugIns";
|
||||
$zipFileName = "safari-legacy.appex.zip";
|
||||
$downloadOutput = $outputPath + "\" + $zipFileName;
|
||||
|
||||
Invoke-WebRequest -Uri "https://github.com/bitwarden/browser/releases/download/v1.48.1/safari-legacy.appex.zip" -OutFile $downloadOutput
|
||||
|
||||
Set-Location $outputPath
|
||||
Invoke-Expression -Command "unzip $zipFileName"
|
||||
|
||||
Remove-Item $downloadOutput
|
||||
72
apps/desktop/scripts/safari-build.ps1
Normal file
72
apps/desktop/scripts/safari-build.ps1
Normal file
@@ -0,0 +1,72 @@
|
||||
param (
|
||||
[string] $version,
|
||||
[switch] $mas,
|
||||
[switch] $masdev,
|
||||
[switch] $skipcheckout,
|
||||
[switch] $skipoutcopy,
|
||||
[switch] $copyonly
|
||||
)
|
||||
|
||||
# Dependencies:
|
||||
# 1. brew cask install powershell
|
||||
#
|
||||
# To run:
|
||||
# pwsh ./build-safari-appex.ps1 -version 1.41.0
|
||||
|
||||
$dir = Split-Path -Parent $MyInvocation.MyCommand.Path;
|
||||
$rootDir = $dir + "\..";
|
||||
$distSafariDir = $rootDir + "\dist-safari";
|
||||
$distSafariAppexDmg = $distSafariDir + "\browser\dist\Safari\dmg\build\Release\safari.appex";
|
||||
$distSafariAppexMas = $distSafariDir + "\browser\dist\Safari\mas\build\Release\safari.appex";
|
||||
$distSafariAppexMasDev = $distSafariDir + "\browser\dist\Safari\masdev\build\Release\safari.appex";
|
||||
$pluginsAppex = $rootDir + "\PlugIns\safari.appex";
|
||||
|
||||
function CopyOutput {
|
||||
if ($mas) {
|
||||
Copy-Item -Path $distSafariAppexMas -Destination $pluginsAppex –Recurse
|
||||
}
|
||||
elseif ($masdev) {
|
||||
Copy-Item -Path $distSafariAppexMasDev -Destination $pluginsAppex –Recurse
|
||||
}
|
||||
else {
|
||||
Copy-Item -Path $distSafariAppexDmg -Destination $pluginsAppex –Recurse
|
||||
}
|
||||
}
|
||||
|
||||
if (Test-Path -Path $pluginsAppex) {
|
||||
Remove-Item -Recurse -Force $pluginsAppex
|
||||
}
|
||||
|
||||
if ($copyonly) {
|
||||
CopyOutput
|
||||
exit
|
||||
}
|
||||
|
||||
if(-not $skipcheckout) {
|
||||
if (Test-Path -Path $distSafariDir) {
|
||||
Remove-Item -Recurse -Force $distSafariDir
|
||||
}
|
||||
New-Item $distSafariDir -ItemType Directory -ea 0
|
||||
}
|
||||
|
||||
cd $distSafariDir
|
||||
|
||||
if(-not $skipcheckout) {
|
||||
git clone git@github.com:bitwarden/browser.git
|
||||
}
|
||||
|
||||
cd browser
|
||||
|
||||
if (-not ([string]::IsNullOrEmpty($version))) {
|
||||
$tag = "v" + $version
|
||||
git checkout tags/$tag
|
||||
}
|
||||
|
||||
npm i
|
||||
npm run dist:safari
|
||||
|
||||
if (-not $skipoutcopy) {
|
||||
CopyOutput
|
||||
}
|
||||
|
||||
cd $rootDir
|
||||
28
apps/desktop/scripts/snap-update.ps1
Normal file
28
apps/desktop/scripts/snap-update.ps1
Normal file
@@ -0,0 +1,28 @@
|
||||
param (
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string] $version
|
||||
)
|
||||
|
||||
# Dependencies:
|
||||
# 1. Install powershell, ex `sudo apt-get install -y powershell`
|
||||
#
|
||||
# To run:
|
||||
# pwsh ./snap-update.ps1 -version 1.5.0
|
||||
|
||||
$dir = Split-Path -Parent $MyInvocation.MyCommand.Path;
|
||||
$rootDir = $dir + "/..";
|
||||
$distDir = $rootDir + "/dist";
|
||||
$distSnapDir = $distDir + "/snap";
|
||||
|
||||
if(Test-Path -Path $distSnapDir) {
|
||||
Remove-Item -Recurse -Force $distSnapDir
|
||||
}
|
||||
New-Item -ItemType directory -Path $distSnapDir | Out-Null
|
||||
|
||||
$snap = "bitwarden_" + $version + "_amd64.snap";
|
||||
$distSnap = $distSnapDir + "/" + $snap;
|
||||
$uri = "https://github.com/bitwarden/desktop/releases/download/v" + $version + "/" + $snap;
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
Invoke-RestMethod -Uri $uri -OutFile $distSnap
|
||||
|
||||
snapcraft upload $distSnap --release stable
|
||||
Reference in New Issue
Block a user