Compare commits
31 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f9ac05ea01 | |||
| e8e188a30f | |||
| 2a22410550 | |||
| 65cd7095f3 | |||
| 6bb7162263 | |||
| 0a48323043 | |||
| b347a926c2 | |||
| d2a179f58b | |||
| 3330cdc69b | |||
| dd1e2b2100 | |||
| 2566bdcedf | |||
| 1ff3fe194e | |||
| 6e2476df02 | |||
| e3fe33245e | |||
| f40f002bf9 | |||
| 69d1789a03 | |||
| 4edf2eb92c | |||
| 098956b81a | |||
| 2aa665ae38 | |||
| ba712516ff | |||
| 865ac44037 | |||
| 7d41062ae9 | |||
| f3c69faf8b | |||
| e353dc554d | |||
| 415d08b411 | |||
| 62499a5630 | |||
| d6d7ea592e | |||
| 5033e9718c | |||
| 16f9dc43cb | |||
| b8f27cc7d2 | |||
| 6b10da524c |
2
.gitignore
vendored
@ -5,6 +5,7 @@
|
|||||||
# Editor files
|
# Editor files
|
||||||
.*.sw?
|
.*.sw?
|
||||||
*~
|
*~
|
||||||
|
.idea
|
||||||
|
|
||||||
# Test files
|
# Test files
|
||||||
godog.test
|
godog.test
|
||||||
@ -29,3 +30,4 @@ vendor-cache
|
|||||||
/hasher
|
/hasher
|
||||||
cmd/Desktop-Bridge/deploy
|
cmd/Desktop-Bridge/deploy
|
||||||
cmd/Import-Export/deploy
|
cmd/Import-Export/deploy
|
||||||
|
proton-bridge
|
||||||
|
|||||||
@ -1,3 +1,21 @@
|
|||||||
|
# Copyright (c) 2022 Proton Technologies AG
|
||||||
|
#
|
||||||
|
# This file is part of ProtonMail Bridge.
|
||||||
|
#
|
||||||
|
# ProtonMail Bridge is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# ProtonMail Bridge is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
---
|
||||||
image: gitlab.protontech.ch:4567/go/bridge-internal:latest
|
image: gitlab.protontech.ch:4567/go/bridge-internal:latest
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
@ -20,6 +38,7 @@ stages:
|
|||||||
- cache
|
- cache
|
||||||
- test
|
- test
|
||||||
- build
|
- build
|
||||||
|
- check
|
||||||
- mirror
|
- mirror
|
||||||
|
|
||||||
# Stage: CACHE
|
# Stage: CACHE
|
||||||
@ -43,6 +62,10 @@ lint:
|
|||||||
stage: test
|
stage: test
|
||||||
only:
|
only:
|
||||||
- branches
|
- branches
|
||||||
|
before_script:
|
||||||
|
- mkdir -p .cache/bin
|
||||||
|
- export PATH=$(pwd)/.cache/bin:$PATH
|
||||||
|
- export GOPATH="$CI_PROJECT_DIR/.cache"
|
||||||
script:
|
script:
|
||||||
- env GOMAXPROCS=$(( ${CI_TAG_CPU} / 2 )) make lint
|
- env GOMAXPROCS=$(( ${CI_TAG_CPU} / 2 )) make lint
|
||||||
tags:
|
tags:
|
||||||
@ -121,6 +144,9 @@ build-qml:
|
|||||||
# regardless of the expiry time. Introduced in GitLab 13.0 behind a
|
# regardless of the expiry time. Introduced in GitLab 13.0 behind a
|
||||||
# disabled feature flag, and made the default behavior in GitLab 13.4.
|
# disabled feature flag, and made the default behavior in GitLab 13.4.
|
||||||
expire_in: 1 day
|
expire_in: 1 day
|
||||||
|
when: always
|
||||||
|
paths:
|
||||||
|
- bridge_*.tgz
|
||||||
tags:
|
tags:
|
||||||
- large
|
- large
|
||||||
|
|
||||||
@ -128,20 +154,16 @@ build-linux:
|
|||||||
extends: .build-base
|
extends: .build-base
|
||||||
artifacts:
|
artifacts:
|
||||||
name: "bridge-linux-$CI_COMMIT_SHORT_SHA"
|
name: "bridge-linux-$CI_COMMIT_SHORT_SHA"
|
||||||
paths:
|
|
||||||
- bridge_*.tgz
|
|
||||||
|
|
||||||
build-linux-qa:
|
build-linux-qa:
|
||||||
extends: .build-base
|
extends: build-linux
|
||||||
only:
|
only:
|
||||||
- web
|
- web
|
||||||
- branches
|
- branches
|
||||||
script:
|
variables:
|
||||||
- BUILD_TAGS="build_qa" make build
|
BUILD_TAGS: "build_qa"
|
||||||
artifacts:
|
artifacts:
|
||||||
name: "bridge-linux-qa-$CI_COMMIT_SHORT_SHA"
|
name: "bridge-linux-qa-$CI_COMMIT_SHORT_SHA"
|
||||||
paths:
|
|
||||||
- bridge_*.tgz
|
|
||||||
|
|
||||||
|
|
||||||
.build-darwin-base:
|
.build-darwin-base:
|
||||||
@ -155,6 +177,10 @@ build-linux-qa:
|
|||||||
- export GOPATH=~/go
|
- export GOPATH=~/go
|
||||||
- export PATH=$GOPATH/bin:$PATH
|
- export PATH=$GOPATH/bin:$PATH
|
||||||
- export CGO_CPPFLAGS='-Wno-error -Wno-nullability-completeness -Wno-expansion-to-defined -Wno-builtin-requires-header'
|
- export CGO_CPPFLAGS='-Wno-error -Wno-nullability-completeness -Wno-expansion-to-defined -Wno-builtin-requires-header'
|
||||||
|
script:
|
||||||
|
- go version
|
||||||
|
- make build
|
||||||
|
- git diff && git diff-index --quiet HEAD
|
||||||
cache: {}
|
cache: {}
|
||||||
tags:
|
tags:
|
||||||
- macOS
|
- macOS
|
||||||
@ -163,20 +189,16 @@ build-darwin:
|
|||||||
extends: .build-darwin-base
|
extends: .build-darwin-base
|
||||||
artifacts:
|
artifacts:
|
||||||
name: "bridge-darwin-$CI_COMMIT_SHORT_SHA"
|
name: "bridge-darwin-$CI_COMMIT_SHORT_SHA"
|
||||||
paths:
|
|
||||||
- bridge_*.tgz
|
|
||||||
|
|
||||||
build-darwin-qa:
|
build-darwin-qa:
|
||||||
extends: .build-darwin-base
|
extends: .build-darwin-base
|
||||||
only:
|
only:
|
||||||
- web
|
- web
|
||||||
- branches
|
- branches
|
||||||
script:
|
variables:
|
||||||
- BUILD_TAGS="build_qa" make build
|
BUILD_TAGS: "build_qa"
|
||||||
artifacts:
|
artifacts:
|
||||||
name: "bridge-darwin-qa-$CI_COMMIT_SHORT_SHA"
|
name: "bridge-darwin-qa-$CI_COMMIT_SHORT_SHA"
|
||||||
paths:
|
|
||||||
- bridge_*.tgz
|
|
||||||
|
|
||||||
|
|
||||||
.build-windows-base:
|
.build-windows-base:
|
||||||
@ -190,6 +212,9 @@ build-darwin-qa:
|
|||||||
- export PATH=$GOPATH/bin:$PATH
|
- export PATH=$GOPATH/bin:$PATH
|
||||||
- export MSYSTEM=
|
- export MSYSTEM=
|
||||||
- export PATH=$PATH:/c/grrrQt/5.13.2/mingw73_64/bin
|
- export PATH=$PATH:/c/grrrQt/5.13.2/mingw73_64/bin
|
||||||
|
script:
|
||||||
|
- make build
|
||||||
|
- git diff && git diff-index --quiet HEAD
|
||||||
tags:
|
tags:
|
||||||
- windows-bridge
|
- windows-bridge
|
||||||
|
|
||||||
@ -197,20 +222,36 @@ build-windows:
|
|||||||
extends: .build-windows-base
|
extends: .build-windows-base
|
||||||
artifacts:
|
artifacts:
|
||||||
name: "bridge-windows-$CI_COMMIT_SHORT_SHA"
|
name: "bridge-windows-$CI_COMMIT_SHORT_SHA"
|
||||||
paths:
|
|
||||||
- bridge_*.tgz
|
|
||||||
|
|
||||||
build-windows-qa:
|
build-windows-qa:
|
||||||
extends: .build-windows-base
|
extends: .build-windows-base
|
||||||
only:
|
only:
|
||||||
- web
|
- web
|
||||||
- branches
|
- branches
|
||||||
script:
|
variables:
|
||||||
- BUILD_TAGS="build_qa" make build
|
BUILD_TAGS: "build_qa"
|
||||||
artifacts:
|
artifacts:
|
||||||
name: "bridge-windows-qa-$CI_COMMIT_SHORT_SHA"
|
name: "bridge-windows-qa-$CI_COMMIT_SHORT_SHA"
|
||||||
|
|
||||||
|
# Stage: CHECK
|
||||||
|
check-gobinsec:
|
||||||
|
stage: check
|
||||||
|
only:
|
||||||
|
- branches
|
||||||
|
cache:
|
||||||
|
key: gobinsec-cache
|
||||||
paths:
|
paths:
|
||||||
- bridge_*.tgz
|
- gobinsec-cache.yml
|
||||||
|
policy: pull-push
|
||||||
|
before_script:
|
||||||
|
- mkdir build
|
||||||
|
- tar -xzf bridge_linux_*.tgz -C build
|
||||||
|
script:
|
||||||
|
- "[ ! -f ./gobinsec-cache.yml ] && wget bridgeteam.protontech.ch/bridgeteam/gobinsec-cache.yml"
|
||||||
|
- cat ./gobinsec-cache.yml
|
||||||
|
- gobinsec -cache -config utils/gobinsec_conf.yml build/proton-bridge
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Stage: MIRROR
|
# Stage: MIRROR
|
||||||
|
|
||||||
|
|||||||
@ -56,7 +56,6 @@ linters:
|
|||||||
- godox # Tool for detection of FIXME, TODO and other comment keywords [fast: true, auto-fix: false]
|
- godox # Tool for detection of FIXME, TODO and other comment keywords [fast: true, auto-fix: false]
|
||||||
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification [fast: true, auto-fix: true]
|
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification [fast: true, auto-fix: true]
|
||||||
- goimports # Goimports does everything that gofmt does. Additionally it checks unused imports [fast: true, auto-fix: true]
|
- goimports # Goimports does everything that gofmt does. Additionally it checks unused imports [fast: true, auto-fix: true]
|
||||||
- golint # Golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes [fast: true, auto-fix: false]
|
|
||||||
- gosec # Inspects source code for security problems [fast: true, auto-fix: false]
|
- gosec # Inspects source code for security problems [fast: true, auto-fix: false]
|
||||||
- misspell # Finds commonly misspelled English words in comments [fast: true, auto-fix: true]
|
- misspell # Finds commonly misspelled English words in comments [fast: true, auto-fix: true]
|
||||||
- nakedret # Finds naked returns in functions greater than a specified function length [fast: true, auto-fix: false]
|
- nakedret # Finds naked returns in functions greater than a specified function length [fast: true, auto-fix: false]
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
# Building ProtonMail Bridge and Import-Export app
|
# Building Proton Mail Bridge and Import-Export app
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
* 64-bit AMD OS:
|
* 64-bit AMD OS:
|
||||||
|
|||||||
@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
By making a contribution to this project:
|
By making a contribution to this project:
|
||||||
|
|
||||||
1. I assign any and all copyright related to the contribution to
|
1. I assign any and all copyright related to the contribution to Proton AG;
|
||||||
Proton Technologies AG;
|
|
||||||
2. I certify that the contribution was created in whole by me;
|
2. I certify that the contribution was created in whole by me;
|
||||||
3. I understand and agree that this project and the contribution are public
|
3. I understand and agree that this project and the contribution are public
|
||||||
and that a record of the contribution (including all personal information I
|
and that a record of the contribution (including all personal information I
|
||||||
|
|||||||
131
COPYING_NOTES.md
@ -1,72 +1,93 @@
|
|||||||
# Copying
|
# Copying
|
||||||
Copyright (c) 2020 Proton Technologies AG
|
Copyright (c) 2022 Proton AG
|
||||||
|
|
||||||
ProtonMail Bridge is free software: you can redistribute it and/or modify it
|
Proton Mail Bridge is free software: you can redistribute it and/or modify it
|
||||||
under the terms of the GNU General Public License as published by the Free
|
under the terms of the GNU General Public License as published by the Free
|
||||||
Software Foundation, either version 3 of the License, or (at your option) any
|
Software Foundation, either version 3 of the License, or (at your option) any
|
||||||
later version.
|
later version.
|
||||||
|
|
||||||
ProtonMail Bridge is distributed in the hope that it will be useful, but WITHOUT ANY
|
Proton Mail Bridge is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License along with
|
You should have received a copy of the GNU General Public License along with
|
||||||
ProtonMail Bridge. If not, see https://www.gnu.org/licenses.
|
Proton Mail Bridge. If not, see https://www.gnu.org/licenses.
|
||||||
|
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
ProtonMail Bridge app includes the following libraries from Proton Technologies AG:
|
Proton Mail Bridge includes the following 3rd party software:
|
||||||
|
|
||||||
* [GopenPGP library](https://gopenpgp.org/) | The [MIT License](https://github.com/ProtonMail/gopenpgp/blob/master/LICENSE).
|
|
||||||
|
|
||||||
ProtonMail Bridge includes the following 3rd party software:
|
|
||||||
|
|
||||||
* [The Go Project libraries](https://golang.org/project/) | Available under [BSD license](https://golang.org/LICENSE)
|
* [The Go Project libraries](https://golang.org/project/) | Available under [BSD license](https://golang.org/LICENSE)
|
||||||
* [Qt Go binding](https://github.com/therecipe/qt) | Available under [LGPLv3 license](https://github.com/therecipe/qt/blob/master/LICENSE)
|
|
||||||
* [Qt](https://www.qt.io/) | Available under [multiple licences](https://www.qt.io/licensing)
|
* [Qt](https://www.qt.io/) | Available under [multiple licences](https://www.qt.io/licensing)
|
||||||
* [Font Awesome 4.7.0](https://fontawesome.com/v4.7.0/) | Available under [multiple licenses](https://fontawesome.com/v4.7.0/license/)
|
|
||||||
|
|
||||||
* [notificator](https://github.com/0xAX/notificator) | Available under [license](https://github.com/0xAX/notificator/blob/master/LICENSE)
|
<!-- START AUTOGEN -->
|
||||||
* [ishell](https://github.com/abiosoft/ishell) | Available under [license](https://github.com/abiosoft/ishell/blob/master/LICENSE)
|
* [docker-credential-helpers](https://github.com/docker/docker-credential-helpers) available under [license](https://github.com/docker/docker-credential-helpers/blob/master/LICENSE)
|
||||||
* [readline](https://github.com/abiosoft/readline) | Available under [license](https://github.com/abiosoft/readline/blob/master/LICENSE)
|
* [go-imap](https://github.com/emersion/go-imap) available under [license](https://github.com/emersion/go-imap/blob/master/LICENSE)
|
||||||
* [singleinstance](https://github.com/allan-simon/go-singleinstance) | Available under [license](https://github.com/allan-simon/go-singleinstance/blob/master/LICENSE)
|
* [notificator](https://github.com/0xAX/notificator) available under [license](https://github.com/0xAX/notificator/blob/master/LICENSE)
|
||||||
* [cascadia](https://github.com/andybalholm/cascadia) | Available under [license](https://github.com/andybalholm/cascadia/blob/master/LICENSE)
|
* [semver](https://github.com/Masterminds/semver/v3) available under [license](https://github.com/Masterminds/semver/v3/blob/master/LICENSE)
|
||||||
* [gocertifi](https://github.com/certifi/gocertifi) | Available under [license](https://github.com/certifi/gocertifi/blob/master/LICENSE)
|
* [bcrypt](https://github.com/ProtonMail/bcrypt) available under [license](https://github.com/ProtonMail/bcrypt/blob/master/LICENSE)
|
||||||
* [logex](https://github.com/chzyer/logex) | Available under [license](https://github.com/chzyer/logex/blob/master/LICENSE)
|
* [go-autostart](https://github.com/ProtonMail/go-autostart) available under [license](https://github.com/ProtonMail/go-autostart/blob/master/LICENSE)
|
||||||
* [test](https://github.com/chzyer/test) | Available under [license](https://github.com/chzyer/test/blob/master/LICENSE)
|
* [go-crypto](https://github.com/ProtonMail/go-crypto) available under [license](https://github.com/ProtonMail/go-crypto/blob/master/LICENSE)
|
||||||
* [godog](https://github.com/cucumber/godog) | Available under [license](https://github.com/cucumber/godog/blob/master/LICENSE)
|
* [go-imap-id](https://github.com/ProtonMail/go-imap-id) available under [license](https://github.com/ProtonMail/go-imap-id/blob/master/LICENSE)
|
||||||
* [wincred](https://github.com/danieljoos/wincred) | Available under [license](https://github.com/danieljoos/wincred/blob/master/LICENSE)
|
* [go-rfc5322](https://github.com/ProtonMail/go-rfc5322) available under [license](https://github.com/ProtonMail/go-rfc5322/blob/master/LICENSE)
|
||||||
* [credential-helpers](https://github.com/docker/docker-credential-helpers) | Available under [license](https://github.com/docker/docker-credential-helpers/blob/master/LICENSE)
|
* [go-srp](https://github.com/ProtonMail/go-srp) available under [license](https://github.com/ProtonMail/go-srp/blob/master/LICENSE)
|
||||||
* [imap](https://github.com/emersion/go-imap) | Available under [license](https://github.com/emersion/go-imap/blob/master/LICENSE)
|
* [go-vcard](https://github.com/ProtonMail/go-vcard) available under [license](https://github.com/ProtonMail/go-vcard/blob/master/LICENSE)
|
||||||
* [imap-appendlimit](https://github.com/emersion/go-imap-appendlimit) | Available under [license](https://github.com/emersion/go-imap-appendlimit/blob/master/LICENSE)
|
* [gopenpgp](https://github.com/ProtonMail/gopenpgp/v2) available under [license](https://github.com/ProtonMail/gopenpgp/v2/blob/master/LICENSE)
|
||||||
* [imap-idle](https://github.com/emersion/go-imap-idle) | Available under [license](https://github.com/emersion/go-imap-idle/blob/master/LICENSE)
|
* [goquery](https://github.com/PuerkitoBio/goquery) available under [license](https://github.com/PuerkitoBio/goquery/blob/master/LICENSE)
|
||||||
* [imap-quota](https://github.com/emersion/go-imap-quota) | Available under [license](https://github.com/emersion/go-imap-quota/blob/master/LICENSE)
|
* [ishell](https://github.com/abiosoft/ishell) available under [license](https://github.com/abiosoft/ishell/blob/master/LICENSE)
|
||||||
* [sasl](https://github.com/emersion/go-sasl) | Available under [license](https://github.com/emersion/go-sasl/blob/master/LICENSE)
|
* [readline](https://github.com/abiosoft/readline) available under [license](https://github.com/abiosoft/readline/blob/master/LICENSE)
|
||||||
* [smtp](https://github.com/emersion/go-smtp) | Available under [license](https://github.com/emersion/go-smtp/blob/master/LICENSE)
|
* [go-singleinstance](https://github.com/allan-simon/go-singleinstance) available under [license](https://github.com/allan-simon/go-singleinstance/blob/master/LICENSE)
|
||||||
* [textwrapper](https://github.com/emersion/go-textwrapper) | Available under [license](https://github.com/emersion/go-textwrapper/blob/master/LICENSE)
|
* [logex](https://github.com/chzyer/logex) available under [license](https://github.com/chzyer/logex/blob/master/LICENSE)
|
||||||
* [vcard](https://github.com/emersion/go-vcard) | Available under [license](https://github.com/emersion/go-vcard/blob/master/LICENSE)
|
* [test](https://github.com/chzyer/test) available under [license](https://github.com/chzyer/test/blob/master/LICENSE)
|
||||||
* [color](https://github.com/fatih/color) | Available under [license](https://github.com/fatih/color/blob/master/LICENSE.md)
|
* [godog](https://github.com/cucumber/godog) available under [license](https://github.com/cucumber/godog/blob/master/LICENSE)
|
||||||
* [shlex](https://github.com/flynn-archive/go-shlex) | Available under [license](https://github.com/flynn-archive/go-shlex/blob/master/COPYING)
|
* [messages-go](https://github.com/cucumber/messages-go/v16) available under [license](https://github.com/cucumber/messages-go/v16/blob/master/LICENSE)
|
||||||
* [raven](https://github.com/getsentry/raven-go) | Available under [license](https://github.com/getsentry/raven-go/blob/master/LICENSE)
|
* [go-sysinfo](https://github.com/elastic/go-sysinfo) available under [license](https://github.com/elastic/go-sysinfo/blob/master/LICENSE)
|
||||||
* [resty](https://github.com/go-resty/resty) | Available under [license](https://github.com/go-resty/resty/blob/master/LICENSE)
|
* [go-windows](https://github.com/elastic/go-windows) available under [license](https://github.com/elastic/go-windows/blob/master/LICENSE)
|
||||||
* [mock](https://github.com/golang/mock) | Available under [license](https://github.com/golang/mock/blob/master/LICENSE)
|
* [go-imap-appendlimit](https://github.com/emersion/go-imap-appendlimit) available under [license](https://github.com/emersion/go-imap-appendlimit/blob/master/LICENSE)
|
||||||
* [cmp](https://github.com/google/go-cmp) | Available under [license](https://github.com/google/go-cmp/blob/master/LICENSE)
|
* [go-imap-move](https://github.com/emersion/go-imap-move) available under [license](https://github.com/emersion/go-imap-move/blob/master/LICENSE)
|
||||||
* [gopherjs](https://github.com/gopherjs/gopherjs) | Available under [license](https://github.com/gopherjs/gopherjs/blob/master/LICENSE)
|
* [go-imap-quota](https://github.com/emersion/go-imap-quota) available under [license](https://github.com/emersion/go-imap-quota/blob/master/LICENSE)
|
||||||
* [multierror](https://github.com/hashicorp/go-multierror) | Available under [license](https://github.com/hashicorp/go-multierror/blob/master/LICENSE)
|
* [go-imap-unselect](https://github.com/emersion/go-imap-unselect) available under [license](https://github.com/emersion/go-imap-unselect/blob/master/LICENSE)
|
||||||
* [bcrypt](https://github.com/jameskeane/bcrypt) | Available under [license](https://github.com/jameskeane/bcrypt/blob/master/LICENSE)
|
* [go-message](https://github.com/emersion/go-message) available under [license](https://github.com/emersion/go-message/blob/master/LICENSE)
|
||||||
* [html2text](https://github.com/jaytaylor/html2text) | Available under [license](https://github.com/jaytaylor/html2text/blob/master/LICENSE)
|
* [go-sasl](https://github.com/emersion/go-sasl) available under [license](https://github.com/emersion/go-sasl/blob/master/LICENSE)
|
||||||
* [enmime](https://github.com/jhillyerd/enmime) | Available under [license](https://github.com/jhillyerd/enmime/blob/master/LICENSE)
|
* [go-smtp](https://github.com/emersion/go-smtp) available under [license](https://github.com/emersion/go-smtp/blob/master/LICENSE)
|
||||||
* [osext](https://github.com/kardianos/osext) | Available under [license](https://github.com/kardianos/osext/blob/master/LICENSE)
|
* [go-textwrapper](https://github.com/emersion/go-textwrapper) available under [license](https://github.com/emersion/go-textwrapper/blob/master/LICENSE)
|
||||||
* [keychain](https://github.com/keybase/go-keychain) | Available under [license](https://github.com/keybase/go-keychain/blob/master/LICENSE)
|
* [go-vcard](https://github.com/emersion/go-vcard) available under [license](https://github.com/emersion/go-vcard/blob/master/LICENSE)
|
||||||
* [aurora](https://github.com/logrusorgru/aurora) | Available under [license](https://github.com/logrusorgru/aurora/blob/master/LICENSE)
|
* [color](https://github.com/fatih/color) available under [license](https://github.com/fatih/color/blob/master/LICENSE)
|
||||||
* [dns](https://github.com/miekg/dns) | Available under [license](https://github.com/miekg/dns/blob/master/LICENSE)
|
* [go-shlex](https://github.com/flynn-archive/go-shlex) available under [license](https://github.com/flynn-archive/go-shlex/blob/master/LICENSE)
|
||||||
* [uuid](https://github.com/myesui/uuid) | Available under [license](https://github.com/myesui/uuid/blob/master/LICENSE)
|
* [sentry-go](https://github.com/getsentry/sentry-go) available under [license](https://github.com/getsentry/sentry-go/blob/master/LICENSE)
|
||||||
* [jsondiff](https://github.com/nsf/jsondiff) | Available under [license](https://github.com/nsf/jsondiff/blob/master/LICENSE)
|
* [resty](https://github.com/go-resty/resty/v2) available under [license](https://github.com/go-resty/resty/v2/blob/master/LICENSE)
|
||||||
* [logrus](https://github.com/sirupsen/logrus) | Available under [license](https://github.com/sirupsen/logrus/blob/master/LICENSE)
|
* [dbus](https://github.com/godbus/dbus) available under [license](https://github.com/godbus/dbus/blob/master/LICENSE)
|
||||||
* [golang](https://github.com/skratchdot/open-golang) | Available under [license](https://github.com/skratchdot/open-golang/blob/master/LICENSE)
|
* [mock](https://github.com/golang/mock) available under [license](https://github.com/golang/mock/blob/master/LICENSE)
|
||||||
* [testify](https://github.com/stretchr/testify) | Available under [license](https://github.com/stretchr/testify/blob/master/LICENSE)
|
* [go-cmp](https://github.com/google/go-cmp) available under [license](https://github.com/google/go-cmp/blob/master/LICENSE)
|
||||||
* [uuid](https://github.com/twinj/uuid) | Available under [license](https://github.com/twinj/uuid/blob/master/LICENSE)
|
* [uuid](https://github.com/google/uuid) available under [license](https://github.com/google/uuid/blob/master/LICENSE)
|
||||||
* [cli](https://github.com/urfave/cli) | Available under [license](https://github.com/urfave/cli/blob/master/LICENSE)
|
* [go-multierror](https://github.com/hashicorp/go-multierror) available under [license](https://github.com/hashicorp/go-multierror/blob/master/LICENSE)
|
||||||
|
* [bcrypt](https://github.com/jameskeane/bcrypt) available under [license](https://github.com/jameskeane/bcrypt/blob/master/LICENSE)
|
||||||
* [BBolt](https://pkg.go.dev/go.etcd.io/bbolt/?tab=doc) | Available under [license](https://pkg.go.dev/go.etcd.io/bbolt?tab=licenses#LICENSE)
|
* [html2text](https://github.com/jaytaylor/html2text) available under [license](https://github.com/jaytaylor/html2text/blob/master/LICENSE)
|
||||||
* [testify.v1](https://gopkg.in/stretchr/testify.v1) | Available under [license](https://github.com/stretchr/testify/blob/master/LICENSE)
|
* [go-keychain](https://github.com/keybase/go-keychain) available under [license](https://github.com/keybase/go-keychain/blob/master/LICENSE)
|
||||||
|
* [text](https://github.com/kr/text) available under [license](https://github.com/kr/text/blob/master/LICENSE)
|
||||||
|
* [aurora](https://github.com/logrusorgru/aurora) available under [license](https://github.com/logrusorgru/aurora/blob/master/LICENSE)
|
||||||
|
* [go-runewidth](https://github.com/mattn/go-runewidth) available under [license](https://github.com/mattn/go-runewidth/blob/master/LICENSE)
|
||||||
|
* [dns](https://github.com/miekg/dns) available under [license](https://github.com/miekg/dns/blob/master/LICENSE)
|
||||||
|
* [pretty](https://github.com/niemeyer/pretty) available under [license](https://github.com/niemeyer/pretty/blob/master/LICENSE)
|
||||||
|
* [jsondiff](https://github.com/nsf/jsondiff) available under [license](https://github.com/nsf/jsondiff/blob/master/LICENSE)
|
||||||
|
* [tablewriter](https://github.com/olekukonko/tablewriter) available under [license](https://github.com/olekukonko/tablewriter/blob/master/LICENSE)
|
||||||
|
* [errors](https://github.com/pkg/errors) available under [license](https://github.com/pkg/errors/blob/master/LICENSE)
|
||||||
|
* [procfs](https://github.com/prometheus/procfs) available under [license](https://github.com/prometheus/procfs/blob/master/LICENSE)
|
||||||
|
* [du](https://github.com/ricochet2200/go-disk-usage/du) available under [license](https://github.com/ricochet2200/go-disk-usage/du/blob/master/LICENSE)
|
||||||
|
* [logrus](https://github.com/sirupsen/logrus) available under [license](https://github.com/sirupsen/logrus/blob/master/LICENSE)
|
||||||
|
* [bom](https://github.com/ssor/bom) available under [license](https://github.com/ssor/bom/blob/master/LICENSE)
|
||||||
|
* [testify](https://github.com/stretchr/testify) available under [license](https://github.com/stretchr/testify/blob/master/LICENSE)
|
||||||
|
* [qt](https://github.com/therecipe/qt) available under [license](https://github.com/therecipe/qt/blob/master/LICENSE)
|
||||||
|
* [cli](https://github.com/urfave/cli/v2) available under [license](https://github.com/urfave/cli/v2/blob/master/LICENSE)
|
||||||
|
* [msgpack](https://github.com/vmihailenco/msgpack/v5) available under [license](https://github.com/vmihailenco/msgpack/v5/blob/master/LICENSE)
|
||||||
|
* [bbolt](https://go.etcd.io/bbolt) available under [license](https://github.com/etcd-io/bbolt/blob/master/LICENSE)
|
||||||
|
* [crypto](https://golang.org/x/crypto) available under [license](https://cs.opensource.google/go/x/crypto/+/master:LICENSE)
|
||||||
|
* [net](https://golang.org/x/net) available under [license](https://cs.opensource.google/go/x/net/+/master:LICENSE)
|
||||||
|
* [sys](https://golang.org/x/sys) available under [license](https://cs.opensource.google/go/x/sys/+/master:LICENSE)
|
||||||
|
* [text](https://golang.org/x/text) available under [license](https://cs.opensource.google/go/x/text/+/master:LICENSE)
|
||||||
|
* [plist](https://howett.net/plist) available under [license](https://github.com/DHowett/go-plist/blob/main/LICENSE)
|
||||||
|
* [docker-credential-helpers](https://github.com/ProtonMail/docker-credential-helpers) available under [license](https://github.com/ProtonMail/docker-credential-helpers/blob/master/LICENSE)
|
||||||
|
* [go-imap](https://github.com/ProtonMail/go-imap) available under [license](https://github.com/ProtonMail/go-imap/blob/master/LICENSE)
|
||||||
|
* [go-message](https://github.com/ProtonMail/go-message) available under [license](https://github.com/ProtonMail/go-message/blob/master/LICENSE)
|
||||||
|
* [go-keychain](https://github.com/cuthix/go-keychain) available under [license](https://github.com/cuthix/go-keychain/blob/master/LICENSE)
|
||||||
|
<!-- END AUTOGEN -->
|
||||||
|
|||||||
74
Changelog.md
@ -1,31 +1,83 @@
|
|||||||
# ProtonMail Bridge and Import-Export app Changelog
|
# Proton Mail Bridge and Import-Export app Changelog
|
||||||
|
|
||||||
Changelog [format](http://keepachangelog.com/en/1.0.0/)
|
Changelog [format](http://keepachangelog.com/en/1.0.0/)
|
||||||
|
|
||||||
|
## [Bridge 2.2.2] Millau
|
||||||
|
|
||||||
|
### Added
|
||||||
|
* Introduced gobinsec cache.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
* GODT-1743: Terminate running bridge if has old version.
|
||||||
|
* GODT-1743: Quit bridge when opening manual install.
|
||||||
|
|
||||||
|
|
||||||
|
## [Bridge 2.2.1] Millau
|
||||||
|
|
||||||
|
### Added
|
||||||
|
* GODT-1550: Add gobinsec check after CI build.
|
||||||
|
* GODT-1686: Add Label/Folder filtering to pmapi.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
* Rebranding:
|
||||||
|
* GODT-1475: Change systray icons.
|
||||||
|
* GODT-1565: Update Bridge application icons.
|
||||||
|
* GODT-1564: Update welcome illustration.
|
||||||
|
* GODT-1626: Update gopenpgp v2.4.7.
|
||||||
|
* GODT-1627: Update go-srvp to v0.0.5.
|
||||||
|
* GODT-1523: Reduce unnecessary shell executions. Inspired by @kortschak.
|
||||||
|
* Other: Add v2 to module name.
|
||||||
|
* GODT-1562: Update test fingerpring.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
* GODT-1659: Convert charset only for `text/*` MIME types.
|
||||||
|
* GODT-1640: Renew test keys.
|
||||||
|
|
||||||
|
|
||||||
|
## [Bridge 2.2.0] Millau
|
||||||
|
|
||||||
|
### Added
|
||||||
|
* Rebranding:
|
||||||
|
* GODT-1508: Splash screen for rebranding.
|
||||||
|
* GODT-1542: Update login screen for rebranding.
|
||||||
|
* GODT-1260: Renaming.
|
||||||
|
* GODT-1502: Rebranding: color and radius.
|
||||||
|
* GODT-1549: Add notification when address list changes.
|
||||||
|
* GODT-1560: Dependecy licenses update and link.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
* GODT-1543: Using one buffered event for off and on connection.
|
||||||
|
* GODT-1550: Update dependencies.
|
||||||
|
* GODT-1545 GODT-1521: Change wording and enable release notes link.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
* GODT-1534: Reset address when leaving split mode.
|
||||||
|
|
||||||
|
|
||||||
## [Bridge 2.1.3] London
|
## [Bridge 2.1.3] London
|
||||||
|
|
||||||
## Added
|
### Added
|
||||||
GODT-1525: Add keybase/go-keychain/secretservice as new keychain helper.
|
GODT-1525: Add keybase/go-keychain/secretservice as new keychain helper.
|
||||||
|
|
||||||
## Changed
|
### Changed
|
||||||
GODT-1527: Change bug report description.
|
GODT-1527: Change bug report description.
|
||||||
|
|
||||||
## Fixed
|
### Fixed
|
||||||
GODT-1537: Manual in-app update mechanism.
|
GODT-1537: Manual in-app update mechanism.
|
||||||
|
|
||||||
|
|
||||||
## [Bridge 2.1.2] London
|
## [Bridge 2.1.2] London
|
||||||
|
|
||||||
## Added
|
### Added
|
||||||
* GODT-1522: Rebuild macOS keychain notification.
|
* GODT-1522: Rebuild macOS keychain notification.
|
||||||
* GODT-1437 Add new proxy provider (Quad9 with port).
|
* GODT-1437 Add new proxy provider (Quad9 with port).
|
||||||
* GODT-1516: Return notification on missing keychain.
|
* GODT-1516: Return notification on missing keychain.
|
||||||
|
|
||||||
## Changed
|
### Changed
|
||||||
* GODT-1451: Do not check for gnome keyring to allow other implementations of secret-service API. Thanks to @remgodow.
|
* GODT-1451: Do not check for gnome keyring to allow other implementations of secret-service API. Thanks to @remgodow.
|
||||||
* GODT-1516 GODT-1451: KeepassXC is crashing on start. We need to block it until it's fixed.
|
* GODT-1516 GODT-1451: KeepassXC is crashing on start. We need to block it until it's fixed.
|
||||||
|
|
||||||
## Fixed
|
### Fixed
|
||||||
* GODT-1524: Logout issues with macOS.
|
* GODT-1524: Logout issues with macOS.
|
||||||
* GODT-1503 GODT-1492: Improve email validation and username in bug report.
|
* GODT-1503 GODT-1492: Improve email validation and username in bug report.
|
||||||
* GODT-1507: Enable autostart after Qt setup.
|
* GODT-1507: Enable autostart after Qt setup.
|
||||||
@ -34,7 +86,7 @@ GODT-1537: Manual in-app update mechanism.
|
|||||||
|
|
||||||
## [Bridge 2.1.1] London
|
## [Bridge 2.1.1] London
|
||||||
|
|
||||||
## Added
|
### Added
|
||||||
* GODT-1376: Add first userID to sentry scope.
|
* GODT-1376: Add first userID to sentry scope.
|
||||||
* GODT-1375: Add host architecture to sentry reports.
|
* GODT-1375: Add host architecture to sentry reports.
|
||||||
* GODT-1364: Add windows CI machine for tests, and build.
|
* GODT-1364: Add windows CI machine for tests, and build.
|
||||||
@ -56,7 +108,7 @@ GODT-1537: Manual in-app update mechanism.
|
|||||||
* GODT-1483: Correct scope in sentry report.
|
* GODT-1483: Correct scope in sentry report.
|
||||||
* GODT-1477: Change CoD wording.
|
* GODT-1477: Change CoD wording.
|
||||||
|
|
||||||
## Added
|
### Added
|
||||||
* GODT-1478: Add GUI settings for keychain selection.
|
* GODT-1478: Add GUI settings for keychain selection.
|
||||||
* Other: Change copyright year.
|
* Other: Change copyright year.
|
||||||
* GODT-1329: Dark mode, with autodetect.
|
* GODT-1329: Dark mode, with autodetect.
|
||||||
@ -70,7 +122,7 @@ GODT-1537: Manual in-app update mechanism.
|
|||||||
|
|
||||||
## [Bridge 2.0.0] Kwai
|
## [Bridge 2.0.0] Kwai
|
||||||
|
|
||||||
## Added
|
### Added
|
||||||
* GODT-22: New GUI style and improved UX:
|
* GODT-22: New GUI style and improved UX:
|
||||||
* GODT-1168 GODT-1169 Qml artifacts for preview.
|
* GODT-1168 GODT-1169 Qml artifacts for preview.
|
||||||
* GODT-1177: Remove Import-Export from repo.
|
* GODT-1177: Remove Import-Export from repo.
|
||||||
@ -141,7 +193,7 @@ GODT-1537: Manual in-app update mechanism.
|
|||||||
* GODT-1158: Store full messages bodies on disk.
|
* GODT-1158: Store full messages bodies on disk.
|
||||||
* GODT-1433 Adding first integration test for drafts.
|
* GODT-1433 Adding first integration test for drafts.
|
||||||
|
|
||||||
## Changed
|
### Changed
|
||||||
* GODT-1438: Turn off SW OpenGL on windows and add debug info about graphic renderer.
|
* GODT-1438: Turn off SW OpenGL on windows and add debug info about graphic renderer.
|
||||||
* GODT-1425: Factory reset enables launch on startup.
|
* GODT-1425: Factory reset enables launch on startup.
|
||||||
* GODT-1433 Message.Type is deprecated, use Flags instead.
|
* GODT-1433 Message.Type is deprecated, use Flags instead.
|
||||||
|
|||||||
33
Makefile
@ -10,11 +10,11 @@ TARGET_OS?=${GOOS}
|
|||||||
.PHONY: build build-nogui build-launcher versioner hasher
|
.PHONY: build build-nogui build-launcher versioner hasher
|
||||||
|
|
||||||
# Keep version hardcoded so app build works also without Git repository.
|
# Keep version hardcoded so app build works also without Git repository.
|
||||||
BRIDGE_APP_VERSION?=2.1.3+git
|
BRIDGE_APP_VERSION?=2.2.2+git
|
||||||
APP_VERSION:=${BRIDGE_APP_VERSION}
|
APP_VERSION:=${BRIDGE_APP_VERSION}
|
||||||
SRC_ICO:=logo.ico
|
SRC_ICO:=bridge.ico
|
||||||
SRC_ICNS:=Bridge.icns
|
SRC_ICNS:=Bridge.icns
|
||||||
SRC_SVG:=logo.svg
|
SRC_SVG:=bridge.svg
|
||||||
EXE_NAME:=proton-bridge
|
EXE_NAME:=proton-bridge
|
||||||
CONFIGNAME:=bridge
|
CONFIGNAME:=bridge
|
||||||
REVISION:=$(shell git rev-parse --short=10 HEAD)
|
REVISION:=$(shell git rev-parse --short=10 HEAD)
|
||||||
@ -23,7 +23,7 @@ BUILD_TIME:=$(shell date +%FT%T%z)
|
|||||||
BUILD_FLAGS:=-tags='${BUILD_TAGS}'
|
BUILD_FLAGS:=-tags='${BUILD_TAGS}'
|
||||||
BUILD_FLAGS_LAUNCHER:=${BUILD_FLAGS}
|
BUILD_FLAGS_LAUNCHER:=${BUILD_FLAGS}
|
||||||
BUILD_FLAGS_GUI:=-tags='${BUILD_TAGS} build_qt'
|
BUILD_FLAGS_GUI:=-tags='${BUILD_TAGS} build_qt'
|
||||||
GO_LDFLAGS:=$(addprefix -X github.com/ProtonMail/proton-bridge/internal/constants.,Version=${APP_VERSION} Revision=${REVISION} BuildTime=${BUILD_TIME})
|
GO_LDFLAGS:=$(addprefix -X github.com/ProtonMail/proton-bridge/v2/internal/constants.,Version=${APP_VERSION} Revision=${REVISION} BuildTime=${BUILD_TIME})
|
||||||
ifneq "${BUILD_LDFLAGS}" ""
|
ifneq "${BUILD_LDFLAGS}" ""
|
||||||
GO_LDFLAGS+=${BUILD_LDFLAGS}
|
GO_LDFLAGS+=${BUILD_LDFLAGS}
|
||||||
endif
|
endif
|
||||||
@ -88,7 +88,7 @@ ${TGZ_TARGET}: ${DEPLOY_DIR}/${TARGET_OS}
|
|||||||
cd ${DEPLOY_DIR}/${TARGET_OS} && tar -czvf ../../../../$@ .
|
cd ${DEPLOY_DIR}/${TARGET_OS} && tar -czvf ../../../../$@ .
|
||||||
|
|
||||||
${DEPLOY_DIR}/linux: ${EXE_TARGET}
|
${DEPLOY_DIR}/linux: ${EXE_TARGET}
|
||||||
cp -pf ./internal/frontend/share/${SRC_SVG} ${DEPLOY_DIR}/linux/logo.svg
|
cp -pf ./dist/${SRC_SVG} ${DEPLOY_DIR}/linux/logo.svg
|
||||||
cp -pf ./LICENSE ${DEPLOY_DIR}/linux/
|
cp -pf ./LICENSE ${DEPLOY_DIR}/linux/
|
||||||
cp -pf ./Changelog.md ${DEPLOY_DIR}/linux/
|
cp -pf ./Changelog.md ${DEPLOY_DIR}/linux/
|
||||||
cp -pf ./dist/${EXE_NAME}.desktop ${DEPLOY_DIR}/linux/
|
cp -pf ./dist/${EXE_NAME}.desktop ${DEPLOY_DIR}/linux/
|
||||||
@ -98,7 +98,7 @@ ${DEPLOY_DIR}/darwin: ${EXE_TARGET}
|
|||||||
mv ${EXE_TARGET}/Contents/MacOS/{${DIRNAME},${EXE_NAME}}; \
|
mv ${EXE_TARGET}/Contents/MacOS/{${DIRNAME},${EXE_NAME}}; \
|
||||||
perl -i -pe"s/>${DIRNAME}/>${EXE_NAME}/g" ${EXE_TARGET}/Contents/Info.plist; \
|
perl -i -pe"s/>${DIRNAME}/>${EXE_NAME}/g" ${EXE_TARGET}/Contents/Info.plist; \
|
||||||
fi
|
fi
|
||||||
cp ./internal/frontend/share/${SRC_ICNS} ${DARWINAPP_CONTENTS}/Resources/${SRC_ICNS}
|
cp ./dist/${SRC_ICNS} ${DARWINAPP_CONTENTS}/Resources/${SRC_ICNS}
|
||||||
cp LICENSE ${DARWINAPP_CONTENTS}/Resources/
|
cp LICENSE ${DARWINAPP_CONTENTS}/Resources/
|
||||||
rm -rf "${DARWINAPP_CONTENTS}/Frameworks/QtWebEngine.framework"
|
rm -rf "${DARWINAPP_CONTENTS}/Frameworks/QtWebEngine.framework"
|
||||||
rm -rf "${DARWINAPP_CONTENTS}/Frameworks/QtWebView.framework"
|
rm -rf "${DARWINAPP_CONTENTS}/Frameworks/QtWebView.framework"
|
||||||
@ -106,7 +106,7 @@ ${DEPLOY_DIR}/darwin: ${EXE_TARGET}
|
|||||||
./utils/remove_non_relative_links_darwin.sh "${EXE_TARGET}${EXE_BINARY_DARWIN}"
|
./utils/remove_non_relative_links_darwin.sh "${EXE_TARGET}${EXE_BINARY_DARWIN}"
|
||||||
|
|
||||||
${DEPLOY_DIR}/windows: ${EXE_TARGET}
|
${DEPLOY_DIR}/windows: ${EXE_TARGET}
|
||||||
cp ./internal/frontend/share/${SRC_ICO} ${DEPLOY_DIR}/windows/logo.ico
|
cp ./dist/${SRC_ICO} ${DEPLOY_DIR}/windows/logo.ico
|
||||||
cp LICENSE ${DEPLOY_DIR}/windows/
|
cp LICENSE ${DEPLOY_DIR}/windows/
|
||||||
|
|
||||||
QT_BUILD_TARGET:=build desktop
|
QT_BUILD_TARGET:=build desktop
|
||||||
@ -127,7 +127,7 @@ ${EXE_TARGET}: check-has-go gofiles ${RESOURCE_FILE} ${VENDOR_TARGET}
|
|||||||
|
|
||||||
WINDRES_YEAR:=$(shell date +%Y)
|
WINDRES_YEAR:=$(shell date +%Y)
|
||||||
APP_VERSION_COMMA:=$(shell echo "${APP_VERSION}" | sed -e 's/[^0-9,.]*//g' -e 's/\./,/g')
|
APP_VERSION_COMMA:=$(shell echo "${APP_VERSION}" | sed -e 's/[^0-9,.]*//g' -e 's/\./,/g')
|
||||||
resource.syso: ./internal/frontend/share/info.rc ./internal/frontend/share/${SRC_ICO} .FORCE
|
resource.syso: ./dist/info.rc ./dist/${SRC_ICO} .FORCE
|
||||||
rm -f ./*.syso
|
rm -f ./*.syso
|
||||||
windres --target=pe-x86-64 -I ./internal/frontend/share/ -D ICO_FILE=${SRC_ICO} -D EXE_NAME="${EXE_NAME}" -D FILE_VERSION="${APP_VERSION}" -D ORIGINAL_FILE_NAME="${EXE}" -D PRODUCT_VERSION="${APP_VERSION}" -D FILE_VERSION_COMMA=${APP_VERSION_COMMA} -D YEAR=${WINDRES_YEAR} -o $@ $<
|
windres --target=pe-x86-64 -I ./internal/frontend/share/ -D ICO_FILE=${SRC_ICO} -D EXE_NAME="${EXE_NAME}" -D FILE_VERSION="${APP_VERSION}" -D ORIGINAL_FILE_NAME="${EXE}" -D PRODUCT_VERSION="${APP_VERSION}" -D FILE_VERSION_COMMA=${APP_VERSION_COMMA} -D YEAR=${WINDRES_YEAR} -o $@ $<
|
||||||
|
|
||||||
@ -228,18 +228,21 @@ integration-test-bridge:
|
|||||||
${MAKE} -C test test-bridge
|
${MAKE} -C test test-bridge
|
||||||
|
|
||||||
mocks:
|
mocks:
|
||||||
mockgen --package mocks github.com/ProtonMail/proton-bridge/internal/users Locator,PanicHandler,CredentialsStorer,StoreMaker > internal/users/mocks/mocks.go
|
mockgen --package mocks github.com/ProtonMail/proton-bridge/v2/internal/users Locator,PanicHandler,CredentialsStorer,StoreMaker > internal/users/mocks/mocks.go
|
||||||
mockgen --package mocks github.com/ProtonMail/proton-bridge/pkg/listener Listener > internal/users/mocks/listener_mocks.go
|
mockgen --package mocks github.com/ProtonMail/proton-bridge/v2/pkg/listener Listener > internal/users/mocks/listener_mocks.go
|
||||||
mockgen --package mocks github.com/ProtonMail/proton-bridge/internal/store PanicHandler,BridgeUser,ChangeNotifier,Storer > internal/store/mocks/mocks.go
|
mockgen --package mocks github.com/ProtonMail/proton-bridge/v2/internal/store PanicHandler,BridgeUser,ChangeNotifier,Storer > internal/store/mocks/mocks.go
|
||||||
mockgen --package mocks github.com/ProtonMail/proton-bridge/pkg/listener Listener > internal/store/mocks/utils_mocks.go
|
mockgen --package mocks github.com/ProtonMail/proton-bridge/v2/pkg/listener Listener > internal/store/mocks/utils_mocks.go
|
||||||
mockgen --package mocks github.com/ProtonMail/proton-bridge/pkg/pmapi Client,Manager > pkg/pmapi/mocks/mocks.go
|
mockgen --package mocks github.com/ProtonMail/proton-bridge/v2/pkg/pmapi Client,Manager > pkg/pmapi/mocks/mocks.go
|
||||||
mockgen --package mocks github.com/ProtonMail/proton-bridge/pkg/message Fetcher > pkg/message/mocks/mocks.go
|
mockgen --package mocks github.com/ProtonMail/proton-bridge/v2/pkg/message Fetcher > pkg/message/mocks/mocks.go
|
||||||
|
|
||||||
lint: gofiles lint-golang lint-license lint-changelog
|
lint: gofiles lint-golang lint-license lint-dependencies lint-changelog
|
||||||
|
|
||||||
lint-license:
|
lint-license:
|
||||||
./utils/missing_license.sh check
|
./utils/missing_license.sh check
|
||||||
|
|
||||||
|
lint-dependencies:
|
||||||
|
./utils/dependency_license.sh check
|
||||||
|
|
||||||
lint-changelog:
|
lint-changelog:
|
||||||
./utils/changelog_linter.sh Changelog.md
|
./utils/changelog_linter.sh Changelog.md
|
||||||
|
|
||||||
|
|||||||
22
README.md
@ -1,22 +1,22 @@
|
|||||||
# ProtonMail Bridge and Import Export app
|
# Proton Mail Bridge and Import Export app
|
||||||
Copyright (c) 2020 Proton Technologies AG
|
Copyright (c) 2022 Proton AG
|
||||||
|
|
||||||
This repository holds the ProtonMail Bridge and the ProtonMail Import-Export applications.
|
This repository holds the Proton Mail Bridge and the Proton Mail Import-Export applications.
|
||||||
For a detailed build information see [BUILDS](./BUILDS.md).
|
For a detailed build information see [BUILDS](./BUILDS.md).
|
||||||
The license can be found in [LICENSE](./LICENSE) file, for more licensing information see [COPYING_NOTES](./COPYING_NOTES.md).
|
The license can be found in [LICENSE](./LICENSE) file, for more licensing information see [COPYING_NOTES](./COPYING_NOTES.md).
|
||||||
For contribution policy see [CONTRIBUTING](./CONTRIBUTING.md).
|
For contribution policy see [CONTRIBUTING](./CONTRIBUTING.md).
|
||||||
|
|
||||||
|
|
||||||
## Description Bridge
|
## Description Bridge
|
||||||
ProtonMail Bridge for e-mail clients.
|
Proton Mail Bridge for e-mail clients.
|
||||||
|
|
||||||
When launched, Bridge will initialize local IMAP/SMTP servers and render
|
When launched, Bridge will initialize local IMAP/SMTP servers and render
|
||||||
its GUI.
|
its GUI.
|
||||||
|
|
||||||
To configure an e-mail client, firstly log in using your ProtonMail credentials.
|
To configure an e-mail client, firstly log in using your Proton Mail credentials.
|
||||||
Open your e-mail client and add a new account using the settings which are
|
Open your e-mail client and add a new account using the settings which are
|
||||||
located in the Bridge GUI. The client will only be able to sync with
|
located in the Bridge GUI. The client will only be able to sync with
|
||||||
your ProtonMail account when the Bridge is running, thus the option
|
your Proton Mail account when the Bridge is running, thus the option
|
||||||
to start Bridge on startup is enabled by default.
|
to start Bridge on startup is enabled by default.
|
||||||
|
|
||||||
When the main window is closed, Bridge will continue to run in the
|
When the main window is closed, Bridge will continue to run in the
|
||||||
@ -25,9 +25,9 @@ background.
|
|||||||
More details [on the public website](https://protonmail.com/bridge).
|
More details [on the public website](https://protonmail.com/bridge).
|
||||||
|
|
||||||
## Description Import-Export app
|
## Description Import-Export app
|
||||||
ProtonMail Import-Export app for importing and exporting messages.
|
Proton Mail Import-Export app for importing and exporting messages.
|
||||||
|
|
||||||
To transfer messages, firstly log in using your ProtonMail credentials.
|
To transfer messages, firstly log in using your Proton Mail credentials.
|
||||||
For import, expand your account, and pick the address to which to import
|
For import, expand your account, and pick the address to which to import
|
||||||
messages from IMAP server or local EML or MBOX files. For export, pick
|
messages from IMAP server or local EML or MBOX files. For export, pick
|
||||||
the whole account or only a specific address. Then, in both cases,
|
the whole account or only a specific address. Then, in both cases,
|
||||||
@ -40,9 +40,9 @@ More details [on the public website](https://protonmail.com/import-export).
|
|||||||
The Import-Export app is developed in separate branch `master-ie`.
|
The Import-Export app is developed in separate branch `master-ie`.
|
||||||
|
|
||||||
## Launchers
|
## Launchers
|
||||||
Launchers are binaries used to run the ProtonMail Bridge or Import-Export apps.
|
Launchers are binaries used to run the Proton Mail Bridge or Import-Export apps.
|
||||||
|
|
||||||
Official distributions of the ProtonMail Bridge and Import-Export apps contain
|
Official distributions of the Proton Mail Bridge and Import-Export apps contain
|
||||||
both a launcher and the app itself. The launcher is installed in a protected
|
both a launcher and the app itself. The launcher is installed in a protected
|
||||||
area of the system (i.e. an area accessible only with admin privileges) and is
|
area of the system (i.e. an area accessible only with admin privileges) and is
|
||||||
used to run the app. The launcher ensures that nobody tampered with the app's
|
used to run the app. The launcher ensures that nobody tampered with the app's
|
||||||
@ -52,7 +52,7 @@ feature enables the app to securely update itself automatically without asking
|
|||||||
the user for a password.
|
the user for a password.
|
||||||
|
|
||||||
## Keychain
|
## Keychain
|
||||||
You need to have a keychain in order to run the ProtonMail Bridge. On Mac or
|
You need to have a keychain in order to run the Proton Mail Bridge. On Mac or
|
||||||
Windows, Bridge uses native credential managers. On Linux, use `secret-service` freedesktop.org API
|
Windows, Bridge uses native credential managers. On Linux, use `secret-service` freedesktop.org API
|
||||||
(e.g. [Gnome keyring](https://wiki.gnome.org/Projects/GnomeKeyring/))
|
(e.g. [Gnome keyring](https://wiki.gnome.org/Projects/GnomeKeyring/))
|
||||||
or
|
or
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
@ -37,14 +37,14 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/ProtonMail/proton-bridge/internal/app/base"
|
"github.com/ProtonMail/proton-bridge/v2/internal/app/base"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/app/bridge"
|
"github.com/ProtonMail/proton-bridge/v2/internal/app/bridge"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
appName = "ProtonMail Bridge"
|
appName = "Proton Mail Bridge"
|
||||||
appUsage = "ProtonMail IMAP and SMTP Bridge"
|
appUsage = "Proton Mail IMAP and SMTP Bridge"
|
||||||
configName = "bridge"
|
configName = "bridge"
|
||||||
updateURLName = "bridge"
|
updateURLName = "bridge"
|
||||||
keychainName = "bridge"
|
keychainName = "bridge"
|
||||||
|
|||||||
@ -1,50 +1,50 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"github.com/Masterminds/semver/v3"
|
"github.com/Masterminds/semver/v3"
|
||||||
"github.com/ProtonMail/gopenpgp/v2/crypto"
|
"github.com/ProtonMail/gopenpgp/v2/crypto"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/config/useragent"
|
"github.com/ProtonMail/proton-bridge/v2/internal/config/useragent"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/constants"
|
"github.com/ProtonMail/proton-bridge/v2/internal/constants"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/crash"
|
"github.com/ProtonMail/proton-bridge/v2/internal/crash"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/locations"
|
"github.com/ProtonMail/proton-bridge/v2/internal/locations"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/logging"
|
"github.com/ProtonMail/proton-bridge/v2/internal/logging"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/sentry"
|
"github.com/ProtonMail/proton-bridge/v2/internal/sentry"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/updater"
|
"github.com/ProtonMail/proton-bridge/v2/internal/updater"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/versioner"
|
"github.com/ProtonMail/proton-bridge/v2/internal/versioner"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
"golang.org/x/sys/execabs"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
appName = "ProtonMail Launcher"
|
appName = "Proton Mail Launcher"
|
||||||
configName = "bridge"
|
configName = "bridge"
|
||||||
exeName = "proton-bridge"
|
exeName = "proton-bridge"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() { // nolint[funlen]
|
func main() { //nolint:funlen
|
||||||
reporter := sentry.NewReporter(appName, constants.Version, useragent.New())
|
reporter := sentry.NewReporter(appName, constants.Version, useragent.New())
|
||||||
|
|
||||||
crashHandler := crash.NewHandler(reporter.ReportException)
|
crashHandler := crash.NewHandler(reporter.ReportException)
|
||||||
@ -98,7 +98,7 @@ func main() { // nolint[funlen]
|
|||||||
logrus.WithError(err).Fatal("Failed to determine path to launcher")
|
logrus.WithError(err).Fatal("Failed to determine path to launcher")
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := exec.Command(exe, appendLauncherPath(launcher, os.Args[1:])...) // nolint[gosec]
|
cmd := execabs.Command(exe, appendLauncherPath(launcher, os.Args[1:])...) //nolint:gosec
|
||||||
|
|
||||||
cmd.Stdin = os.Stdin
|
cmd.Stdin = os.Stdin
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
|
|||||||
BIN
dist/Bridge.icns
vendored
Normal file
BIN
dist/bridge.ico
vendored
Normal file
|
After Width: | Height: | Size: 124 KiB |
32
dist/bridge.svg
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<svg width="256" height="256" viewBox="0 0 256 256" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<g clip-path="url(#clip0_9588_57903)">
|
||||||
|
<path d="M127.416 -0.0898438C63.1423 -0.0898438 11.0449 51.9864 11.0449 116.234V233.331C11.0449 245.779 21.1405 255.871 33.5942 255.871H223.647C234.767 255.871 243.788 246.853 243.788 235.738V116.234C243.788 51.9948 191.691 -0.0898438 127.416 -0.0898438ZM194.401 115.589L143.537 158.421C134.357 166.155 120.929 166.155 111.749 158.421L60.8849 115.589C60.8849 79.2409 90.3659 49.7718 126.728 49.7718H128.558C164.92 49.7718 194.401 79.2409 194.401 115.589Z" fill="#6D4AFF"/>
|
||||||
|
<path d="M127.416 -0.0898438C63.1423 -0.0898438 11.0449 51.9864 11.0449 116.234V233.331C11.0449 245.779 21.1405 255.871 33.5942 255.871H223.647C234.767 255.871 243.788 246.853 243.788 235.738V116.234C243.788 51.9948 191.691 -0.0898438 127.416 -0.0898438ZM194.401 115.589L143.537 158.421C134.357 166.155 120.929 166.155 111.749 158.421L60.8849 115.589C60.8849 79.2409 90.3659 49.7718 126.728 49.7718H128.558C164.92 49.7718 194.401 79.2409 194.401 115.589Z" fill="url(#paint0_linear_9588_57903)"/>
|
||||||
|
<g filter="url(#filter0_i_9588_57903)">
|
||||||
|
<path d="M143.572 158.939C138.271 163.23 124.489 169.238 111.766 158.939C99.0439 148.64 72.6401 125.871 61.0285 115.774H61.0868L60.8676 115.59C60.8676 79.2418 90.3367 49.7728 126.684 49.7728H128.513C164.861 49.7728 194.33 79.2418 194.33 115.59L194.111 115.774H194.31V255.872H223.564C234.679 255.872 243.697 246.854 243.697 235.739V116.235C243.697 51.9958 191.62 -0.0888672 127.372 -0.0888672C63.1241 -0.0888672 11.0479 51.9874 11.0479 116.235V123.587L82.9896 185.444C88.2906 190.492 102.224 197.56 115.553 185.444C128.881 173.327 139.786 162.726 143.572 158.939Z" fill="url(#paint1_radial_9588_57903)"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<defs>
|
||||||
|
<filter id="filter0_i_9588_57903" x="7.29545" y="-0.0888672" width="236.401" height="266.43" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||||
|
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||||
|
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
|
||||||
|
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||||
|
<feOffset dx="-3.7524" dy="10.4692"/>
|
||||||
|
<feGaussianBlur stdDeviation="28.143"/>
|
||||||
|
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
|
||||||
|
<feColorMatrix type="matrix" values="0 0 0 0 0.462745 0 0 0 0 0.337255 0 0 0 0 1 0 0 0 0.24 0"/>
|
||||||
|
<feBlend mode="normal" in2="shape" result="effect1_innerShadow_9588_57903"/>
|
||||||
|
</filter>
|
||||||
|
<linearGradient id="paint0_linear_9588_57903" x1="19.3784" y1="285.405" x2="54.2022" y2="186.949" gradientUnits="userSpaceOnUse">
|
||||||
|
<stop stop-color="#28B0E8"/>
|
||||||
|
<stop offset="1" stop-color="#C5B7FF" stop-opacity="0"/>
|
||||||
|
</linearGradient>
|
||||||
|
<radialGradient id="paint1_radial_9588_57903" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(229.979 277.075) rotate(-138.034) scale(294.445 240.743)">
|
||||||
|
<stop stop-color="#E2DBFF"/>
|
||||||
|
<stop offset="1" stop-color="#6D4AFF"/>
|
||||||
|
</radialGradient>
|
||||||
|
<clipPath id="clip0_9588_57903">
|
||||||
|
<rect width="256" height="256" fill="white"/>
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 3.1 KiB |
@ -4,11 +4,11 @@
|
|||||||
IDI_ICON1 ICON DISCARDABLE STRINGIZE(ICO_FILE)
|
IDI_ICON1 ICON DISCARDABLE STRINGIZE(ICO_FILE)
|
||||||
|
|
||||||
#define FILE_COMMENTS "The Bridge is an application that runs on your computer in the background and seamlessly encrypts and decrypts your mail as it enters and leaves your computer."
|
#define FILE_COMMENTS "The Bridge is an application that runs on your computer in the background and seamlessly encrypts and decrypts your mail as it enters and leaves your computer."
|
||||||
#define FILE_DESCRIPTION "ProtonMail Bridge"
|
#define FILE_DESCRIPTION "Proton Mail Bridge"
|
||||||
#define INTERNAL_NAME STRINGIZE(EXE_NAME)
|
#define INTERNAL_NAME STRINGIZE(EXE_NAME)
|
||||||
#define PRODUCT_NAME "ProtonMail Bridge for Windows"
|
#define PRODUCT_NAME "Proton Mail Bridge for Windows"
|
||||||
|
|
||||||
#define LEGAL_COPYRIGHT "(C) " STRINGIZE(YEAR) " Proton Technologies AG"
|
#define LEGAL_COPYRIGHT "(C) " STRINGIZE(YEAR) " Proton AG"
|
||||||
|
|
||||||
1 VERSIONINFO
|
1 VERSIONINFO
|
||||||
FILEVERSION FILE_VERSION_COMMA,0
|
FILEVERSION FILE_VERSION_COMMA,0
|
||||||
@ -19,7 +19,7 @@ BEGIN
|
|||||||
BLOCK "040904b0"
|
BLOCK "040904b0"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "Comments", FILE_COMMENTS
|
VALUE "Comments", FILE_COMMENTS
|
||||||
VALUE "CompanyName", "Proton Technologies AG"
|
VALUE "CompanyName", "Proton AG"
|
||||||
VALUE "FileDescription", FILE_DESCRIPTION
|
VALUE "FileDescription", FILE_DESCRIPTION
|
||||||
VALUE "FileVersion", STRINGIZE(FILE_VERSION)
|
VALUE "FileVersion", STRINGIZE(FILE_VERSION)
|
||||||
VALUE "InternalName", INTERNAL_NAME
|
VALUE "InternalName", INTERNAL_NAME
|
||||||
6
dist/proton-bridge.desktop
vendored
@ -1,11 +1,11 @@
|
|||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Type=Application
|
Type=Application
|
||||||
Version=1.1
|
Version=1.1
|
||||||
Name=ProtonMail Bridge
|
Name=Proton Mail Bridge
|
||||||
GenericName=ProtonMail Bridge for Linux
|
GenericName=Proton Mail Bridge for Linux
|
||||||
Comment=The Bridge is an application that runs on your computer in the background and seamlessly encrypts and decrypts your mail as it enters and leaves your computer.
|
Comment=The Bridge is an application that runs on your computer in the background and seamlessly encrypts and decrypts your mail as it enters and leaves your computer.
|
||||||
Icon=protonmail-bridge
|
Icon=protonmail-bridge
|
||||||
Exec=protonmail-bridge
|
Exec=protonmail-bridge
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Categories=Office;Email;Network
|
Categories=Office;Email;Network
|
||||||
StartupWMClass=protonmail-bridge
|
StartupWMClass=Proton Mail Bridge
|
||||||
|
|||||||
BIN
dist/raw/mac_icon_128x128.png
vendored
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
dist/raw/mac_icon_128x128@2x.png
vendored
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
dist/raw/mac_icon_16x16.png
vendored
Normal file
|
After Width: | Height: | Size: 715 B |
BIN
dist/raw/mac_icon_16x16@2x.png
vendored
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
dist/raw/mac_icon_256x256.png
vendored
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
dist/raw/mac_icon_256x256@2x.png
vendored
Normal file
|
After Width: | Height: | Size: 135 KiB |
BIN
dist/raw/mac_icon_32x32.png
vendored
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
dist/raw/mac_icon_32x32@2x.png
vendored
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
dist/raw/mac_icon_512x512.png
vendored
Normal file
|
After Width: | Height: | Size: 136 KiB |
BIN
dist/raw/mac_icon_512x512@2x.png
vendored
Normal file
|
After Width: | Height: | Size: 494 KiB |
32
dist/raw/win+lin_icon_16x16.svg
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<g clip-path="url(#clip0_9588_57915)">
|
||||||
|
<path d="M7.9607 -0.00488281C3.9452 -0.00488281 0.69043 3.24988 0.69043 7.26539V14.5839C0.69043 15.3619 1.32115 15.9926 2.09919 15.9926H13.9727C14.6674 15.9926 15.231 15.429 15.231 14.7344V7.26539C15.231 3.25041 11.9762 -0.00488281 7.9607 -0.00488281ZM12.1456 7.22502L8.96786 9.90202C8.39429 10.3854 7.55543 10.3854 6.98186 9.90202L3.80416 7.22502C3.80416 4.95329 5.64598 3.11147 7.91771 3.11147H8.032C10.3037 3.11147 12.1456 4.95329 12.1456 7.22502Z" fill="#6D4AFF"/>
|
||||||
|
<path d="M7.9607 -0.00488281C3.9452 -0.00488281 0.69043 3.24988 0.69043 7.26539V14.5839C0.69043 15.3619 1.32115 15.9926 2.09919 15.9926H13.9727C14.6674 15.9926 15.231 15.429 15.231 14.7344V7.26539C15.231 3.25041 11.9762 -0.00488281 7.9607 -0.00488281ZM12.1456 7.22502L8.96786 9.90202C8.39429 10.3854 7.55543 10.3854 6.98186 9.90202L3.80416 7.22502C3.80416 4.95329 5.64598 3.11147 7.91771 3.11147H8.032C10.3037 3.11147 12.1456 4.95329 12.1456 7.22502Z" fill="url(#paint0_linear_9588_57915)"/>
|
||||||
|
<g filter="url(#filter0_i_9588_57915)">
|
||||||
|
<path d="M8.97323 9.93257C8.64192 10.2008 7.78051 10.5763 6.98537 9.93257C6.19022 9.28888 4.53998 7.86583 3.81426 7.23476H3.81805L3.80416 7.22306C3.80416 4.95133 5.64598 3.10952 7.91771 3.10952H8.032C10.3037 3.10952 12.1456 4.95133 12.1456 7.22306L12.1317 7.23476H12.1443V15.9907H13.9727C14.6674 15.9907 15.231 15.4271 15.231 14.7324V7.26343C15.231 3.24845 11.9762 -0.00683594 7.9607 -0.00683594C3.9452 -0.00683594 0.69043 3.24793 0.69043 7.26343V7.72306L5.18683 11.5891C5.51814 11.9047 6.38901 12.3464 7.22202 11.5891C8.05502 10.8318 8.73658 10.1692 8.97323 9.93257Z" fill="url(#paint1_radial_9588_57915)"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<defs>
|
||||||
|
<filter id="filter0_i_9588_57915" x="0.455905" y="-0.00683594" width="14.7755" height="16.6514" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||||
|
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||||
|
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
|
||||||
|
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||||
|
<feOffset dx="-0.234525" dy="0.654324"/>
|
||||||
|
<feGaussianBlur stdDeviation="1.75894"/>
|
||||||
|
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
|
||||||
|
<feColorMatrix type="matrix" values="0 0 0 0 0.462745 0 0 0 0 0.337255 0 0 0 0 1 0 0 0 0.24 0"/>
|
||||||
|
<feBlend mode="normal" in2="shape" result="effect1_innerShadow_9588_57915"/>
|
||||||
|
</filter>
|
||||||
|
<linearGradient id="paint0_linear_9588_57915" x1="1.21106" y1="17.8385" x2="3.38824" y2="11.6856" gradientUnits="userSpaceOnUse">
|
||||||
|
<stop stop-color="#28B0E8"/>
|
||||||
|
<stop offset="1" stop-color="#C5B7FF" stop-opacity="0"/>
|
||||||
|
</linearGradient>
|
||||||
|
<radialGradient id="paint1_radial_9588_57915" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(14.3736 17.3159) rotate(-138.034) scale(18.4028 15.0465)">
|
||||||
|
<stop stop-color="#E2DBFF"/>
|
||||||
|
<stop offset="1" stop-color="#6D4AFF"/>
|
||||||
|
</radialGradient>
|
||||||
|
<clipPath id="clip0_9588_57915">
|
||||||
|
<rect width="16" height="16" fill="white"/>
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 3.1 KiB |
32
dist/raw/win+lin_icon_24x24.svg
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<g clip-path="url(#clip0_9588_57912)">
|
||||||
|
<path d="M11.8651 -0.0078125C6.09279 -0.0078125 1.41406 4.67091 1.41406 10.4432V20.9636C1.41406 22.082 2.32072 22.9886 3.43915 22.9886H20.5073C21.5059 22.9886 22.3161 22.1785 22.3161 21.1799V10.4432C22.3161 4.67167 17.6374 -0.0078125 11.8651 -0.0078125ZM17.8808 10.3852L13.3129 14.2334C12.4884 14.9282 11.2825 14.9282 10.458 14.2334L5.89005 10.3852C5.89005 7.11956 8.53767 4.47195 11.8033 4.47195H11.9676C15.2332 4.47195 17.8808 7.11956 17.8808 10.3852Z" fill="#6D4AFF"/>
|
||||||
|
<path d="M11.8651 -0.0078125C6.09279 -0.0078125 1.41406 4.67091 1.41406 10.4432V20.9636C1.41406 22.082 2.32072 22.9886 3.43915 22.9886H20.5073C21.5059 22.9886 22.3161 22.1785 22.3161 21.1799V10.4432C22.3161 4.67167 17.6374 -0.0078125 11.8651 -0.0078125ZM17.8808 10.3852L13.3129 14.2334C12.4884 14.9282 11.2825 14.9282 10.458 14.2334L5.89005 10.3852C5.89005 7.11956 8.53767 4.47195 11.8033 4.47195H11.9676C15.2332 4.47195 17.8808 7.11956 17.8808 10.3852Z" fill="url(#paint0_linear_9588_57912)"/>
|
||||||
|
<g filter="url(#filter0_i_9588_57912)">
|
||||||
|
<path d="M13.3213 14.28C12.8451 14.6656 11.6068 15.2053 10.4638 14.28C9.32078 13.3547 6.94856 11.3091 5.90533 10.4019H5.91095L5.89103 10.3852C5.89103 7.11956 8.53864 4.47195 11.8043 4.47195H11.9686C15.2342 4.47195 17.8818 7.11956 17.8818 10.3852L17.8619 10.4019H17.8798V22.9886H20.5083C21.5069 22.9886 22.3171 22.1785 22.3171 21.1799V10.4432C22.3171 4.67167 17.6383 -0.0078125 11.8661 -0.0078125C6.09377 -0.0078125 1.41504 4.67091 1.41504 10.4432V11.1041L7.8784 16.6613C8.35466 17.1149 9.60653 17.7499 10.804 16.6613C12.0014 15.5727 12.9812 14.6202 13.3213 14.28Z" fill="url(#paint1_radial_9588_57912)"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<defs>
|
||||||
|
<filter id="filter0_i_9588_57912" x="1.07791" y="-0.0078125" width="21.2395" height="23.9367" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||||
|
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||||
|
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
|
||||||
|
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||||
|
<feOffset dx="-0.337129" dy="0.940591"/>
|
||||||
|
<feGaussianBlur stdDeviation="2.52847"/>
|
||||||
|
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
|
||||||
|
<feColorMatrix type="matrix" values="0 0 0 0 0.462745 0 0 0 0 0.337255 0 0 0 0 1 0 0 0 0.24 0"/>
|
||||||
|
<feBlend mode="normal" in2="shape" result="effect1_innerShadow_9588_57912"/>
|
||||||
|
</filter>
|
||||||
|
<linearGradient id="paint0_linear_9588_57912" x1="2.16247" y1="25.6421" x2="5.29216" y2="16.7973" gradientUnits="userSpaceOnUse">
|
||||||
|
<stop stop-color="#28B0E8"/>
|
||||||
|
<stop offset="1" stop-color="#C5B7FF" stop-opacity="0"/>
|
||||||
|
</linearGradient>
|
||||||
|
<radialGradient id="paint1_radial_9588_57912" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(21.0847 24.8937) rotate(-138.034) scale(26.454 21.6293)">
|
||||||
|
<stop stop-color="#E2DBFF"/>
|
||||||
|
<stop offset="1" stop-color="#6D4AFF"/>
|
||||||
|
</radialGradient>
|
||||||
|
<clipPath id="clip0_9588_57912">
|
||||||
|
<rect width="24" height="24" fill="white"/>
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 3.1 KiB |
BIN
dist/raw/win+lin_icon_256x256.png
vendored
Normal file
|
After Width: | Height: | Size: 27 KiB |
32
dist/raw/win+lin_icon_256x256.svg
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<svg width="256" height="256" viewBox="0 0 256 256" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<g clip-path="url(#clip0_9588_57903)">
|
||||||
|
<path d="M127.416 -0.0898438C63.1423 -0.0898438 11.0449 51.9864 11.0449 116.234V233.331C11.0449 245.779 21.1405 255.871 33.5942 255.871H223.647C234.767 255.871 243.788 246.853 243.788 235.738V116.234C243.788 51.9948 191.691 -0.0898438 127.416 -0.0898438ZM194.401 115.589L143.537 158.421C134.357 166.155 120.929 166.155 111.749 158.421L60.8849 115.589C60.8849 79.2409 90.3659 49.7718 126.728 49.7718H128.558C164.92 49.7718 194.401 79.2409 194.401 115.589Z" fill="#6D4AFF"/>
|
||||||
|
<path d="M127.416 -0.0898438C63.1423 -0.0898438 11.0449 51.9864 11.0449 116.234V233.331C11.0449 245.779 21.1405 255.871 33.5942 255.871H223.647C234.767 255.871 243.788 246.853 243.788 235.738V116.234C243.788 51.9948 191.691 -0.0898438 127.416 -0.0898438ZM194.401 115.589L143.537 158.421C134.357 166.155 120.929 166.155 111.749 158.421L60.8849 115.589C60.8849 79.2409 90.3659 49.7718 126.728 49.7718H128.558C164.92 49.7718 194.401 79.2409 194.401 115.589Z" fill="url(#paint0_linear_9588_57903)"/>
|
||||||
|
<g filter="url(#filter0_i_9588_57903)">
|
||||||
|
<path d="M143.572 158.939C138.271 163.23 124.489 169.238 111.766 158.939C99.0439 148.64 72.6401 125.871 61.0285 115.774H61.0868L60.8676 115.59C60.8676 79.2418 90.3367 49.7728 126.684 49.7728H128.513C164.861 49.7728 194.33 79.2418 194.33 115.59L194.111 115.774H194.31V255.872H223.564C234.679 255.872 243.697 246.854 243.697 235.739V116.235C243.697 51.9958 191.62 -0.0888672 127.372 -0.0888672C63.1241 -0.0888672 11.0479 51.9874 11.0479 116.235V123.587L82.9896 185.444C88.2906 190.492 102.224 197.56 115.553 185.444C128.881 173.327 139.786 162.726 143.572 158.939Z" fill="url(#paint1_radial_9588_57903)"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<defs>
|
||||||
|
<filter id="filter0_i_9588_57903" x="7.29545" y="-0.0888672" width="236.401" height="266.43" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||||
|
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||||
|
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
|
||||||
|
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||||
|
<feOffset dx="-3.7524" dy="10.4692"/>
|
||||||
|
<feGaussianBlur stdDeviation="28.143"/>
|
||||||
|
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
|
||||||
|
<feColorMatrix type="matrix" values="0 0 0 0 0.462745 0 0 0 0 0.337255 0 0 0 0 1 0 0 0 0.24 0"/>
|
||||||
|
<feBlend mode="normal" in2="shape" result="effect1_innerShadow_9588_57903"/>
|
||||||
|
</filter>
|
||||||
|
<linearGradient id="paint0_linear_9588_57903" x1="19.3784" y1="285.405" x2="54.2022" y2="186.949" gradientUnits="userSpaceOnUse">
|
||||||
|
<stop stop-color="#28B0E8"/>
|
||||||
|
<stop offset="1" stop-color="#C5B7FF" stop-opacity="0"/>
|
||||||
|
</linearGradient>
|
||||||
|
<radialGradient id="paint1_radial_9588_57903" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(229.979 277.075) rotate(-138.034) scale(294.445 240.743)">
|
||||||
|
<stop stop-color="#E2DBFF"/>
|
||||||
|
<stop offset="1" stop-color="#6D4AFF"/>
|
||||||
|
</radialGradient>
|
||||||
|
<clipPath id="clip0_9588_57903">
|
||||||
|
<rect width="256" height="256" fill="white"/>
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 3.1 KiB |
32
dist/raw/win+lin_icon_32x32.svg
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<g clip-path="url(#clip0_9588_57909)">
|
||||||
|
<path d="M15.9709 -0.0107422C8.19088 -0.0107422 1.88477 6.29537 1.88477 14.0754V28.255C1.88477 29.7625 3.10678 30.9845 4.61423 30.9845H27.6191C28.9651 30.9845 30.0571 29.8925 30.0571 28.5465V14.0754C30.0571 6.29638 23.751 -0.0107422 15.9709 -0.0107422ZM24.0791 13.9972L17.9223 19.1839C16.811 20.1205 15.1857 20.1205 14.0744 19.1839L7.91762 13.9972C7.91762 9.59571 11.4861 6.02719 15.8876 6.02719H16.1091C20.5105 6.02719 24.0791 9.59571 24.0791 13.9972Z" fill="#6D4AFF"/>
|
||||||
|
<path d="M15.9709 -0.0107422C8.19088 -0.0107422 1.88477 6.29537 1.88477 14.0754V28.255C1.88477 29.7625 3.10678 30.9845 4.61423 30.9845H27.6191C28.9651 30.9845 30.0571 29.8925 30.0571 28.5465V14.0754C30.0571 6.29638 23.751 -0.0107422 15.9709 -0.0107422ZM24.0791 13.9972L17.9223 19.1839C16.811 20.1205 15.1857 20.1205 14.0744 19.1839L7.91762 13.9972C7.91762 9.59571 11.4861 6.02719 15.8876 6.02719H16.1091C20.5105 6.02719 24.0791 9.59571 24.0791 13.9972Z" fill="url(#paint0_linear_9588_57909)"/>
|
||||||
|
<g filter="url(#filter0_i_9588_57909)">
|
||||||
|
<path d="M17.9322 19.2467C17.2903 19.7663 15.6213 20.4938 14.0807 19.2467C12.5401 17.9996 9.34279 15.2424 7.9367 14.0197H7.94435L7.91762 13.9972C7.91762 9.59571 11.4861 6.02719 15.8876 6.02719H16.1091C20.5105 6.02719 24.0791 9.59571 24.0791 13.9972L24.0523 14.0197H24.0762V30.9845H27.6191C28.9651 30.9845 30.0571 29.8925 30.0571 28.5465V14.0754C30.0571 6.29638 23.751 -0.0107422 15.9709 -0.0107422C8.19088 -0.0107422 1.88477 6.29537 1.88477 14.0754V14.9662L10.596 22.4563C11.238 23.0676 12.9253 23.9235 14.5392 22.4563C16.1532 20.989 17.4737 19.7052 17.9322 19.2467Z" fill="url(#paint1_radial_9588_57909)"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<defs>
|
||||||
|
<filter id="filter0_i_9588_57909" x="1.43037" y="-0.0107422" width="28.6263" height="32.2629" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||||
|
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||||
|
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
|
||||||
|
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||||
|
<feOffset dx="-0.454392" dy="1.26775"/>
|
||||||
|
<feGaussianBlur stdDeviation="3.40794"/>
|
||||||
|
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
|
||||||
|
<feColorMatrix type="matrix" values="0 0 0 0 0.462745 0 0 0 0 0.337255 0 0 0 0 1 0 0 0 0.24 0"/>
|
||||||
|
<feBlend mode="normal" in2="shape" result="effect1_innerShadow_9588_57909"/>
|
||||||
|
</filter>
|
||||||
|
<linearGradient id="paint0_linear_9588_57909" x1="2.89348" y1="34.5608" x2="7.11177" y2="22.6396" gradientUnits="userSpaceOnUse">
|
||||||
|
<stop stop-color="#28B0E8"/>
|
||||||
|
<stop offset="1" stop-color="#C5B7FF" stop-opacity="0"/>
|
||||||
|
</linearGradient>
|
||||||
|
<radialGradient id="paint1_radial_9588_57909" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(28.396 33.5521) rotate(-138.034) scale(35.6554 29.1525)">
|
||||||
|
<stop stop-color="#E2DBFF"/>
|
||||||
|
<stop offset="1" stop-color="#6D4AFF"/>
|
||||||
|
</radialGradient>
|
||||||
|
<clipPath id="clip0_9588_57909">
|
||||||
|
<rect width="32" height="32" fill="white"/>
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 3.1 KiB |
32
dist/raw/win+lin_icon_48x48.svg
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<g clip-path="url(#clip0_9588_57906)">
|
||||||
|
<path d="M23.8921 -0.0166016C11.9792 -0.0166016 2.32324 9.63938 2.32324 21.5523V43.2642C2.32324 45.5724 4.1944 47.4436 6.50263 47.4436H41.728C43.7889 47.4436 45.461 45.7715 45.461 43.7106V21.5523C45.461 9.64093 35.805 -0.0166016 23.8921 -0.0166016ZM36.3074 21.4325L26.8801 29.3744C25.1784 30.8085 22.6898 30.8085 20.9882 29.3744L11.5608 21.4325C11.5608 14.6929 17.025 9.22875 23.7646 9.22875H24.1036C30.8432 9.22875 36.3074 14.6929 36.3074 21.4325Z" fill="#6D4AFF"/>
|
||||||
|
<path d="M23.8921 -0.0166016C11.9792 -0.0166016 2.32324 9.63938 2.32324 21.5523V43.2642C2.32324 45.5724 4.1944 47.4436 6.50263 47.4436H41.728C43.7889 47.4436 45.461 45.7715 45.461 43.7106V21.5523C45.461 9.64093 35.805 -0.0166016 23.8921 -0.0166016ZM36.3074 21.4325L26.8801 29.3744C25.1784 30.8085 22.6898 30.8085 20.9882 29.3744L11.5608 21.4325C11.5608 14.6929 17.025 9.22875 23.7646 9.22875H24.1036C30.8432 9.22875 36.3074 14.6929 36.3074 21.4325Z" fill="url(#paint0_linear_9588_57906)"/>
|
||||||
|
<g filter="url(#filter0_i_9588_57906)">
|
||||||
|
<path d="M26.8954 29.4706C25.9125 30.2663 23.3569 31.3803 20.998 29.4706C18.639 27.561 13.7432 23.3392 11.5902 21.467H11.6017L11.5608 21.4325C11.5608 14.6929 17.025 9.22875 23.7646 9.22875H24.1036C30.8432 9.22875 36.3074 14.6929 36.3074 21.4325L36.2665 21.467H36.3032V47.4436H41.728C43.7889 47.4436 45.461 45.7715 45.461 43.7106V21.5523C45.461 9.64093 35.805 -0.0166016 23.8921 -0.0166016C11.9792 -0.0166016 2.32324 9.63938 2.32324 21.5523V22.9161L15.6622 34.3851C16.6451 35.3212 19.2287 36.6318 21.7 34.3851C24.1713 32.1385 26.1933 30.1727 26.8954 29.4706Z" fill="url(#paint1_radial_9588_57906)"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<defs>
|
||||||
|
<filter id="filter0_i_9588_57906" x="1.62747" y="-0.0166016" width="43.8335" height="49.4012" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||||
|
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||||
|
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
|
||||||
|
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||||
|
<feOffset dx="-0.69577" dy="1.9412"/>
|
||||||
|
<feGaussianBlur stdDeviation="5.21827"/>
|
||||||
|
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
|
||||||
|
<feColorMatrix type="matrix" values="0 0 0 0 0.462745 0 0 0 0 0.337255 0 0 0 0 1 0 0 0 0.24 0"/>
|
||||||
|
<feBlend mode="normal" in2="shape" result="effect1_innerShadow_9588_57906"/>
|
||||||
|
</filter>
|
||||||
|
<linearGradient id="paint0_linear_9588_57906" x1="3.8678" y1="52.9198" x2="10.3269" y2="34.6659" gradientUnits="userSpaceOnUse">
|
||||||
|
<stop stop-color="#28B0E8"/>
|
||||||
|
<stop offset="1" stop-color="#C5B7FF" stop-opacity="0"/>
|
||||||
|
</linearGradient>
|
||||||
|
<radialGradient id="paint1_radial_9588_57906" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(42.9175 51.3752) rotate(-138.034) scale(54.5959 44.6386)">
|
||||||
|
<stop stop-color="#E2DBFF"/>
|
||||||
|
<stop offset="1" stop-color="#6D4AFF"/>
|
||||||
|
</radialGradient>
|
||||||
|
<clipPath id="clip0_9588_57906">
|
||||||
|
<rect width="48" height="48" fill="white"/>
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 3.0 KiB |
@ -51,7 +51,7 @@ PMAPI directly.
|
|||||||
graph TD
|
graph TD
|
||||||
|
|
||||||
C["Client (e.g. Thunderbird)"]
|
C["Client (e.g. Thunderbird)"]
|
||||||
PM[ProtonMail Server]
|
PM[Proton Mail Server]
|
||||||
|
|
||||||
subgraph "Bridge app"
|
subgraph "Bridge app"
|
||||||
subgraph "Bridge core"
|
subgraph "Bridge core"
|
||||||
|
|||||||
19
go.mod
@ -1,4 +1,4 @@
|
|||||||
module github.com/ProtonMail/proton-bridge
|
module github.com/ProtonMail/proton-bridge/v2
|
||||||
|
|
||||||
go 1.15
|
go 1.15
|
||||||
|
|
||||||
@ -7,19 +7,19 @@ go 1.15
|
|||||||
require (
|
require (
|
||||||
github.com/docker/docker-credential-helpers v0.6.3
|
github.com/docker/docker-credential-helpers v0.6.3
|
||||||
github.com/emersion/go-imap v1.0.6
|
github.com/emersion/go-imap v1.0.6
|
||||||
github.com/jameskeane/bcrypt v0.0.0-20170924085257-7509ea014998 // indirect
|
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/0xAX/notificator v0.0.0-20191016112426-3962a5ea8da1
|
github.com/0xAX/notificator v0.0.0-20191016112426-3962a5ea8da1
|
||||||
github.com/Masterminds/semver/v3 v3.1.0
|
github.com/Masterminds/semver/v3 v3.1.0
|
||||||
|
github.com/ProtonMail/bcrypt v0.0.0-20211005172633-e235017c1baf // indirect
|
||||||
github.com/ProtonMail/go-autostart v0.0.0-20181114175602-c5272053443a
|
github.com/ProtonMail/go-autostart v0.0.0-20181114175602-c5272053443a
|
||||||
github.com/ProtonMail/go-crypto v0.0.0-20211221144345-a4f6767435ab
|
github.com/ProtonMail/go-crypto v0.0.0-20220623141421-5afb4c282135
|
||||||
github.com/ProtonMail/go-imap-id v0.0.0-20190926060100-f94a56b9ecde
|
github.com/ProtonMail/go-imap-id v0.0.0-20190926060100-f94a56b9ecde
|
||||||
github.com/ProtonMail/go-rfc5322 v0.8.0
|
github.com/ProtonMail/go-rfc5322 v0.8.0
|
||||||
github.com/ProtonMail/go-srp v0.0.1
|
github.com/ProtonMail/go-srp v0.0.5
|
||||||
github.com/ProtonMail/go-vcard v0.0.0-20180326232728-33aaa0a0c8a5
|
github.com/ProtonMail/go-vcard v0.0.0-20180326232728-33aaa0a0c8a5
|
||||||
github.com/ProtonMail/gopenpgp/v2 v2.4.1
|
github.com/ProtonMail/gopenpgp/v2 v2.4.7
|
||||||
github.com/PuerkitoBio/goquery v1.5.1
|
github.com/PuerkitoBio/goquery v1.5.1
|
||||||
github.com/abiosoft/ishell v2.0.0+incompatible
|
github.com/abiosoft/ishell v2.0.0+incompatible
|
||||||
github.com/abiosoft/readline v0.0.0-20180607040430-155bce2042db // indirect
|
github.com/abiosoft/readline v0.0.0-20180607040430-155bce2042db // indirect
|
||||||
@ -48,6 +48,7 @@ require (
|
|||||||
github.com/google/go-cmp v0.5.5
|
github.com/google/go-cmp v0.5.5
|
||||||
github.com/google/uuid v1.1.1
|
github.com/google/uuid v1.1.1
|
||||||
github.com/hashicorp/go-multierror v1.1.0
|
github.com/hashicorp/go-multierror v1.1.0
|
||||||
|
github.com/jameskeane/bcrypt v0.0.0-20120420032655-c3cd44c1e20f // indirect
|
||||||
github.com/jaytaylor/html2text v0.0.0-20200412013138-3577fbdbcff7
|
github.com/jaytaylor/html2text v0.0.0-20200412013138-3577fbdbcff7
|
||||||
github.com/keybase/go-keychain v0.0.0
|
github.com/keybase/go-keychain v0.0.0
|
||||||
github.com/kr/text v0.2.0 // indirect
|
github.com/kr/text v0.2.0 // indirect
|
||||||
@ -69,16 +70,16 @@ require (
|
|||||||
github.com/urfave/cli/v2 v2.2.0
|
github.com/urfave/cli/v2 v2.2.0
|
||||||
github.com/vmihailenco/msgpack/v5 v5.1.3
|
github.com/vmihailenco/msgpack/v5 v5.1.3
|
||||||
go.etcd.io/bbolt v1.3.6
|
go.etcd.io/bbolt v1.3.6
|
||||||
golang.org/x/net v0.0.0-20211008194852-3b03d305991f
|
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect
|
||||||
golang.org/x/sys v0.0.0-20220111092808-5a964db01320
|
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4
|
||||||
|
golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b
|
||||||
golang.org/x/text v0.3.7
|
golang.org/x/text v0.3.7
|
||||||
howett.net/plist v1.0.0 // indirect
|
howett.net/plist v1.0.0
|
||||||
)
|
)
|
||||||
|
|
||||||
replace (
|
replace (
|
||||||
github.com/docker/docker-credential-helpers => github.com/ProtonMail/docker-credential-helpers v1.1.0
|
github.com/docker/docker-credential-helpers => github.com/ProtonMail/docker-credential-helpers v1.1.0
|
||||||
github.com/emersion/go-imap => github.com/ProtonMail/go-imap v0.0.0-20201228133358-4db68cea0cac
|
github.com/emersion/go-imap => github.com/ProtonMail/go-imap v0.0.0-20201228133358-4db68cea0cac
|
||||||
github.com/emersion/go-message => github.com/ProtonMail/go-message v0.0.0-20210611055058-fabeff2ec753
|
github.com/emersion/go-message => github.com/ProtonMail/go-message v0.0.0-20210611055058-fabeff2ec753
|
||||||
github.com/jameskeane/bcrypt => github.com/ProtonMail/bcrypt v0.0.0-20210511135022-227b4adcab57
|
|
||||||
github.com/keybase/go-keychain => github.com/cuthix/go-keychain v0.0.0-20220405075754-31e7cee908fe
|
github.com/keybase/go-keychain => github.com/cuthix/go-keychain v0.0.0-20220405075754-31e7cee908fe
|
||||||
)
|
)
|
||||||
|
|||||||
25
go.sum
@ -24,6 +24,8 @@ github.com/Masterminds/semver/v3 v3.1.0/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0
|
|||||||
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
||||||
github.com/ProtonMail/bcrypt v0.0.0-20210511135022-227b4adcab57 h1:pHA4K54ifoogVLunGGHi3xyF5Nz4x+Uh3dJuy3NwGQQ=
|
github.com/ProtonMail/bcrypt v0.0.0-20210511135022-227b4adcab57 h1:pHA4K54ifoogVLunGGHi3xyF5Nz4x+Uh3dJuy3NwGQQ=
|
||||||
github.com/ProtonMail/bcrypt v0.0.0-20210511135022-227b4adcab57/go.mod h1:HecWFHognK8GfRDGnFQbW/LiV7A3MX3gZVs45vk5h8I=
|
github.com/ProtonMail/bcrypt v0.0.0-20210511135022-227b4adcab57/go.mod h1:HecWFHognK8GfRDGnFQbW/LiV7A3MX3gZVs45vk5h8I=
|
||||||
|
github.com/ProtonMail/bcrypt v0.0.0-20211005172633-e235017c1baf h1:yc9daCCYUefEs69zUkSzubzjBbL+cmOXgnmt9Fyd9ug=
|
||||||
|
github.com/ProtonMail/bcrypt v0.0.0-20211005172633-e235017c1baf/go.mod h1:o0ESU9p83twszAU8LBeJKFAAMX14tISa0yk4Oo5TOqo=
|
||||||
github.com/ProtonMail/docker-credential-helpers v1.1.0 h1:+kvUIpwWcbtP3WFv5sSvkFn/XLzSqPOB5AAthuk9xPk=
|
github.com/ProtonMail/docker-credential-helpers v1.1.0 h1:+kvUIpwWcbtP3WFv5sSvkFn/XLzSqPOB5AAthuk9xPk=
|
||||||
github.com/ProtonMail/docker-credential-helpers v1.1.0/go.mod h1:mK0aBveCxhnQ756AmaTfXMZDeULvheYVhF/MWMErN5g=
|
github.com/ProtonMail/docker-credential-helpers v1.1.0/go.mod h1:mK0aBveCxhnQ756AmaTfXMZDeULvheYVhF/MWMErN5g=
|
||||||
github.com/ProtonMail/go-autostart v0.0.0-20181114175602-c5272053443a h1:fXK2KsfnkBV9Nh+9SKzHchYjuE9s0vI20JG1mbtEAcc=
|
github.com/ProtonMail/go-autostart v0.0.0-20181114175602-c5272053443a h1:fXK2KsfnkBV9Nh+9SKzHchYjuE9s0vI20JG1mbtEAcc=
|
||||||
@ -31,6 +33,9 @@ github.com/ProtonMail/go-autostart v0.0.0-20181114175602-c5272053443a/go.mod h1:
|
|||||||
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo=
|
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo=
|
||||||
github.com/ProtonMail/go-crypto v0.0.0-20211221144345-a4f6767435ab h1:5FiL/TCaiKCss/BLMIACDxxadYrx767l9kh0qYX+sLQ=
|
github.com/ProtonMail/go-crypto v0.0.0-20211221144345-a4f6767435ab h1:5FiL/TCaiKCss/BLMIACDxxadYrx767l9kh0qYX+sLQ=
|
||||||
github.com/ProtonMail/go-crypto v0.0.0-20211221144345-a4f6767435ab/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo=
|
github.com/ProtonMail/go-crypto v0.0.0-20211221144345-a4f6767435ab/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo=
|
||||||
|
github.com/ProtonMail/go-crypto v0.0.0-20220113124808-70ae35bab23f/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo=
|
||||||
|
github.com/ProtonMail/go-crypto v0.0.0-20220623141421-5afb4c282135 h1:xDc/cFH/hwyr9KyWc0sm26lpsscqtfZBvU8NpRLHwJ0=
|
||||||
|
github.com/ProtonMail/go-crypto v0.0.0-20220623141421-5afb4c282135/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo=
|
||||||
github.com/ProtonMail/go-imap v0.0.0-20201228133358-4db68cea0cac h1:2xU3QncAiS/W3UlWZTkbNKW5WkLzk6Egl1T0xX+sbjs=
|
github.com/ProtonMail/go-imap v0.0.0-20201228133358-4db68cea0cac h1:2xU3QncAiS/W3UlWZTkbNKW5WkLzk6Egl1T0xX+sbjs=
|
||||||
github.com/ProtonMail/go-imap v0.0.0-20201228133358-4db68cea0cac/go.mod h1:yKASt+C3ZiDAiCSssxg9caIckWF/JG7ZQTO7GAmvicU=
|
github.com/ProtonMail/go-imap v0.0.0-20201228133358-4db68cea0cac/go.mod h1:yKASt+C3ZiDAiCSssxg9caIckWF/JG7ZQTO7GAmvicU=
|
||||||
github.com/ProtonMail/go-imap-id v0.0.0-20190926060100-f94a56b9ecde h1:5koQozTDELymYOyFbQ/VSubexAEXzDR8qGM5mO8GRdw=
|
github.com/ProtonMail/go-imap-id v0.0.0-20190926060100-f94a56b9ecde h1:5koQozTDELymYOyFbQ/VSubexAEXzDR8qGM5mO8GRdw=
|
||||||
@ -39,14 +44,20 @@ github.com/ProtonMail/go-message v0.0.0-20210611055058-fabeff2ec753 h1:I8IsYA297
|
|||||||
github.com/ProtonMail/go-message v0.0.0-20210611055058-fabeff2ec753/go.mod h1:NBAn21zgCJ/52WLDyed18YvYFm5tEoeDauubFqLokM4=
|
github.com/ProtonMail/go-message v0.0.0-20210611055058-fabeff2ec753/go.mod h1:NBAn21zgCJ/52WLDyed18YvYFm5tEoeDauubFqLokM4=
|
||||||
github.com/ProtonMail/go-mime v0.0.0-20190923161245-9b5a4261663a h1:W6RrgN/sTxg1msqzFFb+G80MFmpjMw61IU+slm+wln4=
|
github.com/ProtonMail/go-mime v0.0.0-20190923161245-9b5a4261663a h1:W6RrgN/sTxg1msqzFFb+G80MFmpjMw61IU+slm+wln4=
|
||||||
github.com/ProtonMail/go-mime v0.0.0-20190923161245-9b5a4261663a/go.mod h1:NYt+V3/4rEeDuaev/zw1zCq8uqVEuPHzDPo3OZrlGJ4=
|
github.com/ProtonMail/go-mime v0.0.0-20190923161245-9b5a4261663a/go.mod h1:NYt+V3/4rEeDuaev/zw1zCq8uqVEuPHzDPo3OZrlGJ4=
|
||||||
|
github.com/ProtonMail/go-mime v0.0.0-20220302105931-303f85f7fe0f h1:CGq7OieOz3wyQJ1fO8S0eO9TCW1JyvLrf8fhzz1i8ko=
|
||||||
|
github.com/ProtonMail/go-mime v0.0.0-20220302105931-303f85f7fe0f/go.mod h1:NYt+V3/4rEeDuaev/zw1zCq8uqVEuPHzDPo3OZrlGJ4=
|
||||||
github.com/ProtonMail/go-rfc5322 v0.8.0 h1:7emrf75n3CDIduQflx7aT1nJa5h/kGsiFKUYX/+IAkU=
|
github.com/ProtonMail/go-rfc5322 v0.8.0 h1:7emrf75n3CDIduQflx7aT1nJa5h/kGsiFKUYX/+IAkU=
|
||||||
github.com/ProtonMail/go-rfc5322 v0.8.0/go.mod h1:BwpTbkJxkMGkc+pC84AXZnwuWOisEULBpfPIyIKS/Us=
|
github.com/ProtonMail/go-rfc5322 v0.8.0/go.mod h1:BwpTbkJxkMGkc+pC84AXZnwuWOisEULBpfPIyIKS/Us=
|
||||||
github.com/ProtonMail/go-srp v0.0.1 h1:J0O9Zb5XTC6iDrB7feH41cu+TUEB+l7uHctXIK6oS2o=
|
github.com/ProtonMail/go-srp v0.0.1 h1:J0O9Zb5XTC6iDrB7feH41cu+TUEB+l7uHctXIK6oS2o=
|
||||||
github.com/ProtonMail/go-srp v0.0.1/go.mod h1:Uvv5cqSGCs8MTZ8sbKiCkBnaB6/OA3eq2mc77tl2VVA=
|
github.com/ProtonMail/go-srp v0.0.1/go.mod h1:Uvv5cqSGCs8MTZ8sbKiCkBnaB6/OA3eq2mc77tl2VVA=
|
||||||
|
github.com/ProtonMail/go-srp v0.0.5 h1:xhUioxZgDbCnpo9JehyFhwwsn9JLWkUGfB0oiKXgiGg=
|
||||||
|
github.com/ProtonMail/go-srp v0.0.5/go.mod h1:06iYHtLXW8vjLtccWj++x3MKy65sIT8yZd7nrJF49rs=
|
||||||
github.com/ProtonMail/go-vcard v0.0.0-20180326232728-33aaa0a0c8a5 h1:Uga1DHFN4GUxuDQr0F71tpi8I9HqPIlZodZAI1lR6VQ=
|
github.com/ProtonMail/go-vcard v0.0.0-20180326232728-33aaa0a0c8a5 h1:Uga1DHFN4GUxuDQr0F71tpi8I9HqPIlZodZAI1lR6VQ=
|
||||||
github.com/ProtonMail/go-vcard v0.0.0-20180326232728-33aaa0a0c8a5/go.mod h1:oeP9CMN+ajWp5jKp1kue5daJNwMMxLF+ujPaUIoJWlA=
|
github.com/ProtonMail/go-vcard v0.0.0-20180326232728-33aaa0a0c8a5/go.mod h1:oeP9CMN+ajWp5jKp1kue5daJNwMMxLF+ujPaUIoJWlA=
|
||||||
github.com/ProtonMail/gopenpgp/v2 v2.4.1 h1:b3El0zabaKi73u4sRnb3hOOUczuKuYpN8wnp7wRsZSc=
|
github.com/ProtonMail/gopenpgp/v2 v2.4.1 h1:b3El0zabaKi73u4sRnb3hOOUczuKuYpN8wnp7wRsZSc=
|
||||||
github.com/ProtonMail/gopenpgp/v2 v2.4.1/go.mod h1:RFjoVjfhV8f78tjz/fLrp/OXkugL3QmWsiJq/fsQYA4=
|
github.com/ProtonMail/gopenpgp/v2 v2.4.1/go.mod h1:RFjoVjfhV8f78tjz/fLrp/OXkugL3QmWsiJq/fsQYA4=
|
||||||
|
github.com/ProtonMail/gopenpgp/v2 v2.4.7 h1:V3xeelvXgJiZXZuPtSSE+uYbtPw4RmbmyPqXDAESPhg=
|
||||||
|
github.com/ProtonMail/gopenpgp/v2 v2.4.7/go.mod h1:ZW1KxHNG6q5LMgFKf9Ap/d2eVYeyGf5+fAUEAjJWtmo=
|
||||||
github.com/PuerkitoBio/goquery v1.5.1 h1:PSPBGne8NIUWw+/7vFBV+kG2J/5MOjbzc7154OaKCSE=
|
github.com/PuerkitoBio/goquery v1.5.1 h1:PSPBGne8NIUWw+/7vFBV+kG2J/5MOjbzc7154OaKCSE=
|
||||||
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
|
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
|
||||||
github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0=
|
github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0=
|
||||||
@ -95,6 +106,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsr
|
|||||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
github.com/cronokirby/saferith v0.31.0 h1:TIlhldetKLeGAb19bZvWiuwQEzfzwSPthDEyJ9Ah8xs=
|
github.com/cronokirby/saferith v0.31.0 h1:TIlhldetKLeGAb19bZvWiuwQEzfzwSPthDEyJ9Ah8xs=
|
||||||
github.com/cronokirby/saferith v0.31.0/go.mod h1:QKJhjoqUtBsXCAVEjw38mFqoi7DebT7kthcD7UzbnoA=
|
github.com/cronokirby/saferith v0.31.0/go.mod h1:QKJhjoqUtBsXCAVEjw38mFqoi7DebT7kthcD7UzbnoA=
|
||||||
|
github.com/cronokirby/saferith v0.33.0 h1:TgoQlfsD4LIwx71+ChfRcIpjkw+RPOapDEVxa+LhwLo=
|
||||||
|
github.com/cronokirby/saferith v0.33.0/go.mod h1:QKJhjoqUtBsXCAVEjw38mFqoi7DebT7kthcD7UzbnoA=
|
||||||
github.com/cucumber/gherkin-go/v19 v19.0.3 h1:mMSKu1077ffLbTJULUfM5HPokgeBcIGboyeNUof1MdE=
|
github.com/cucumber/gherkin-go/v19 v19.0.3 h1:mMSKu1077ffLbTJULUfM5HPokgeBcIGboyeNUof1MdE=
|
||||||
github.com/cucumber/gherkin-go/v19 v19.0.3/go.mod h1:jY/NP6jUtRSArQQJ5h1FXOUgk5fZK24qtE7vKi776Vw=
|
github.com/cucumber/gherkin-go/v19 v19.0.3/go.mod h1:jY/NP6jUtRSArQQJ5h1FXOUgk5fZK24qtE7vKi776Vw=
|
||||||
github.com/cucumber/godog v0.12.1 h1:IhWVYFKDReM5WsuA9AuRLRPWOyvFNO9UBUKrNfLPais=
|
github.com/cucumber/godog v0.12.1 h1:IhWVYFKDReM5WsuA9AuRLRPWOyvFNO9UBUKrNfLPais=
|
||||||
@ -249,6 +262,7 @@ github.com/iris-contrib/go.uuid v2.0.0+incompatible/go.mod h1:iz2lgM/1UnEf1kP0L/
|
|||||||
github.com/iris-contrib/jade v1.1.3/go.mod h1:H/geBymxJhShH5kecoiOCSssPX7QWYH7UaeZTSWddIk=
|
github.com/iris-contrib/jade v1.1.3/go.mod h1:H/geBymxJhShH5kecoiOCSssPX7QWYH7UaeZTSWddIk=
|
||||||
github.com/iris-contrib/pongo2 v0.0.1/go.mod h1:Ssh+00+3GAZqSQb30AvBRNxBx7rf0GqwkjqxNd0u65g=
|
github.com/iris-contrib/pongo2 v0.0.1/go.mod h1:Ssh+00+3GAZqSQb30AvBRNxBx7rf0GqwkjqxNd0u65g=
|
||||||
github.com/iris-contrib/schema v0.0.1/go.mod h1:urYA3uvUNG1TIIjOSCzHr9/LmbQo8LrOcOqfqxa4hXw=
|
github.com/iris-contrib/schema v0.0.1/go.mod h1:urYA3uvUNG1TIIjOSCzHr9/LmbQo8LrOcOqfqxa4hXw=
|
||||||
|
github.com/jameskeane/bcrypt v0.0.0-20120420032655-c3cd44c1e20f/go.mod h1:u+9Snq0w+ZdYKi8BBoaxnEwWu0fY4Kvu9ByFpM51t1s=
|
||||||
github.com/jaytaylor/html2text v0.0.0-20200412013138-3577fbdbcff7 h1:g0fAGBisHaEQ0TRq1iBvemFRf+8AEWEmBESSiWB3Vsc=
|
github.com/jaytaylor/html2text v0.0.0-20200412013138-3577fbdbcff7 h1:g0fAGBisHaEQ0TRq1iBvemFRf+8AEWEmBESSiWB3Vsc=
|
||||||
github.com/jaytaylor/html2text v0.0.0-20200412013138-3577fbdbcff7/go.mod h1:CVKlgaMiht+LXvHG173ujK6JUhZXKb2u/BQtjPDIvyk=
|
github.com/jaytaylor/html2text v0.0.0-20200412013138-3577fbdbcff7/go.mod h1:CVKlgaMiht+LXvHG173ujK6JUhZXKb2u/BQtjPDIvyk=
|
||||||
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||||
@ -471,6 +485,10 @@ golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPh
|
|||||||
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg=
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg=
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
|
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA=
|
||||||
|
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||||
|
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY=
|
||||||
|
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||||
@ -518,6 +536,9 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
|
|||||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||||
golang.org/x/net v0.0.0-20211008194852-3b03d305991f h1:1scJEYZBaF48BaG6tYbtxmLcXqwYGSfGcMoStTqkkIw=
|
golang.org/x/net v0.0.0-20211008194852-3b03d305991f h1:1scJEYZBaF48BaG6tYbtxmLcXqwYGSfGcMoStTqkkIw=
|
||||||
golang.org/x/net v0.0.0-20211008194852-3b03d305991f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20211008194852-3b03d305991f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
|
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
|
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA=
|
||||||
|
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
@ -570,7 +591,11 @@ golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+R
|
|||||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220111092808-5a964db01320 h1:0jf+tOCoZ3LyutmCOWpVni1chK4VfFLhRsDK7MhqGRY=
|
golang.org/x/sys v0.0.0-20220111092808-5a964db01320 h1:0jf+tOCoZ3LyutmCOWpVni1chK4VfFLhRsDK7MhqGRY=
|
||||||
golang.org/x/sys v0.0.0-20220111092808-5a964db01320/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220111092808-5a964db01320/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b h1:2n253B2r0pYSmEV+UNCQoPfU/FiaizQEK5Gu4Bq4JE8=
|
||||||
|
golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
|
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
|
||||||
|
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 945 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 25 KiB |
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
// Package api provides HTTP API of the Bridge.
|
// Package api provides HTTP API of the Bridge.
|
||||||
//
|
//
|
||||||
@ -25,17 +25,15 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/ProtonMail/proton-bridge/internal/bridge"
|
"github.com/ProtonMail/proton-bridge/v2/internal/bridge"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/config/settings"
|
"github.com/ProtonMail/proton-bridge/v2/internal/config/settings"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/events"
|
"github.com/ProtonMail/proton-bridge/v2/internal/events"
|
||||||
"github.com/ProtonMail/proton-bridge/pkg/listener"
|
"github.com/ProtonMail/proton-bridge/v2/pkg/listener"
|
||||||
"github.com/ProtonMail/proton-bridge/pkg/ports"
|
"github.com/ProtonMail/proton-bridge/v2/pkg/ports"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var log = logrus.WithField("pkg", "api") //nolint:gochecknoglobals
|
||||||
log = logrus.WithField("pkg", "api") //nolint[gochecknoglobals]
|
|
||||||
)
|
|
||||||
|
|
||||||
type apiServer struct {
|
type apiServer struct {
|
||||||
host string
|
host string
|
||||||
@ -44,7 +42,7 @@ type apiServer struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewAPIServer returns prepared API server struct.
|
// NewAPIServer returns prepared API server struct.
|
||||||
func NewAPIServer(settings *settings.Settings, eventListener listener.Listener) *apiServer { //nolint[golint]
|
func NewAPIServer(settings *settings.Settings, eventListener listener.Listener) *apiServer { //nolint:revive
|
||||||
return &apiServer{
|
return &apiServer{
|
||||||
host: bridge.Host,
|
host: bridge.Host,
|
||||||
settings: settings,
|
settings: settings,
|
||||||
@ -68,7 +66,7 @@ func (api *apiServer) ListenAndServe() {
|
|||||||
api.eventListener.Emit(events.ErrorEvent, "API failed: "+err.Error())
|
api.eventListener.Emit(events.ErrorEvent, "API failed: "+err.Error())
|
||||||
log.Error("API failed: ", err)
|
log.Error("API failed: ", err)
|
||||||
}
|
}
|
||||||
defer server.Close() //nolint[errcheck]
|
defer server.Close() //nolint:errcheck
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *apiServer) getAddress() string {
|
func (api *apiServer) getAddress() string {
|
||||||
|
|||||||
@ -1,26 +1,26 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/ProtonMail/proton-bridge/pkg/listener"
|
"github.com/ProtonMail/proton-bridge/v2/pkg/listener"
|
||||||
)
|
)
|
||||||
|
|
||||||
// httpHandler with Go's Response and Request.
|
// httpHandler with Go's Response and Request.
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package api
|
package api
|
||||||
|
|
||||||
@ -21,8 +21,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/ProtonMail/proton-bridge/internal/bridge"
|
"github.com/ProtonMail/proton-bridge/v2/internal/bridge"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/events"
|
"github.com/ProtonMail/proton-bridge/v2/internal/events"
|
||||||
)
|
)
|
||||||
|
|
||||||
// focusHandler should be called from other instances (attempt to start bridge
|
// focusHandler should be called from other instances (attempt to start bridge
|
||||||
@ -42,7 +42,7 @@ func CheckOtherInstanceAndFocus(port int) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer resp.Body.Close() //nolint[errcheck]
|
defer resp.Body.Close() //nolint:errcheck
|
||||||
|
|
||||||
if resp.StatusCode != 200 {
|
if resp.StatusCode != 200 {
|
||||||
log.Error("Focus error: ", resp.StatusCode)
|
log.Error("Focus error: ", resp.StatusCode)
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package base
|
package base
|
||||||
|
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
// Package base implements a common application base currently shared by bridge and IE.
|
// Package base implements a common application base currently shared by bridge and IE.
|
||||||
// The base includes the following:
|
// The base includes the following:
|
||||||
@ -39,25 +39,24 @@ import (
|
|||||||
"github.com/Masterminds/semver/v3"
|
"github.com/Masterminds/semver/v3"
|
||||||
"github.com/ProtonMail/go-autostart"
|
"github.com/ProtonMail/go-autostart"
|
||||||
"github.com/ProtonMail/gopenpgp/v2/crypto"
|
"github.com/ProtonMail/gopenpgp/v2/crypto"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/api"
|
"github.com/ProtonMail/proton-bridge/v2/internal/api"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/config/cache"
|
"github.com/ProtonMail/proton-bridge/v2/internal/config/cache"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/config/settings"
|
"github.com/ProtonMail/proton-bridge/v2/internal/config/settings"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/config/tls"
|
"github.com/ProtonMail/proton-bridge/v2/internal/config/tls"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/config/useragent"
|
"github.com/ProtonMail/proton-bridge/v2/internal/config/useragent"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/constants"
|
"github.com/ProtonMail/proton-bridge/v2/internal/constants"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/cookies"
|
"github.com/ProtonMail/proton-bridge/v2/internal/cookies"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/crash"
|
"github.com/ProtonMail/proton-bridge/v2/internal/crash"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/events"
|
"github.com/ProtonMail/proton-bridge/v2/internal/events"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/locations"
|
"github.com/ProtonMail/proton-bridge/v2/internal/locations"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/logging"
|
"github.com/ProtonMail/proton-bridge/v2/internal/logging"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/sentry"
|
"github.com/ProtonMail/proton-bridge/v2/internal/sentry"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/updater"
|
"github.com/ProtonMail/proton-bridge/v2/internal/updater"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/users/credentials"
|
"github.com/ProtonMail/proton-bridge/v2/internal/users/credentials"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/versioner"
|
"github.com/ProtonMail/proton-bridge/v2/internal/versioner"
|
||||||
"github.com/ProtonMail/proton-bridge/pkg/keychain"
|
"github.com/ProtonMail/proton-bridge/v2/pkg/keychain"
|
||||||
"github.com/ProtonMail/proton-bridge/pkg/listener"
|
"github.com/ProtonMail/proton-bridge/v2/pkg/listener"
|
||||||
"github.com/ProtonMail/proton-bridge/pkg/pmapi"
|
"github.com/ProtonMail/proton-bridge/v2/pkg/pmapi"
|
||||||
"github.com/allan-simon/go-singleinstance"
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
)
|
)
|
||||||
@ -102,7 +101,7 @@ type Base struct {
|
|||||||
teardown []func() error // actions to perform when app is exiting
|
teardown []func() error // actions to perform when app is exiting
|
||||||
}
|
}
|
||||||
|
|
||||||
func New( // nolint[funlen]
|
func New( //nolint:funlen
|
||||||
appName,
|
appName,
|
||||||
appUsage,
|
appUsage,
|
||||||
configName,
|
configName,
|
||||||
@ -153,12 +152,16 @@ func New( // nolint[funlen]
|
|||||||
}
|
}
|
||||||
settingsObj := settings.New(settingsPath)
|
settingsObj := settings.New(settingsPath)
|
||||||
|
|
||||||
lock, err := singleinstance.CreateLockFile(locations.GetLockFile())
|
lock, err := checkSingleInstance(locations.GetLockFile(), settingsObj)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Warnf("%v is already running", appName)
|
logrus.WithError(err).Warnf("%v is already running", appName)
|
||||||
return nil, api.CheckOtherInstanceAndFocus(settingsObj.GetInt(settings.APIPortKey))
|
return nil, api.CheckOtherInstanceAndFocus(settingsObj.GetInt(settings.APIPortKey))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := migrateRebranding(settingsObj, keychainName); err != nil {
|
||||||
|
logrus.WithError(err).Warn("Rebranding migration failed")
|
||||||
|
}
|
||||||
|
|
||||||
cachePath, err := locations.ProvideCachePath()
|
cachePath, err := locations.ProvideCachePath()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -192,8 +195,8 @@ func New( // nolint[funlen]
|
|||||||
sentryReporter.SetClientFromManager(cm)
|
sentryReporter.SetClientFromManager(cm)
|
||||||
|
|
||||||
cm.AddConnectionObserver(pmapi.NewConnectionObserver(
|
cm.AddConnectionObserver(pmapi.NewConnectionObserver(
|
||||||
func() { listener.Emit(events.InternetOffEvent, "") },
|
func() { listener.Emit(events.InternetConnChangedEvent, events.InternetOff) },
|
||||||
func() { listener.Emit(events.InternetOnEvent, "") },
|
func() { listener.Emit(events.InternetConnChangedEvent, events.InternetOn) },
|
||||||
))
|
))
|
||||||
|
|
||||||
jar, err := cookies.NewCookieJar(settingsObj)
|
jar, err := cookies.NewCookieJar(settingsObj)
|
||||||
@ -236,7 +239,7 @@ func New( // nolint[funlen]
|
|||||||
}
|
}
|
||||||
|
|
||||||
autostart := &autostart.App{
|
autostart := &autostart.App{
|
||||||
Name: appName,
|
Name: startupNameForRebranding(appName),
|
||||||
DisplayName: appName,
|
DisplayName: appName,
|
||||||
Exec: []string{exe, "--" + FlagNoWindow},
|
Exec: []string{exe, "--" + FlagNoWindow},
|
||||||
}
|
}
|
||||||
@ -324,7 +327,7 @@ func (b *Base) AddTeardownAction(fn func() error) {
|
|||||||
b.teardown = append(b.teardown, fn)
|
b.teardown = append(b.teardown, fn)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Base) wrapMainLoop(appMainLoop func(*Base, *cli.Context) error) cli.ActionFunc { // nolint[funlen]
|
func (b *Base) wrapMainLoop(appMainLoop func(*Base, *cli.Context) error) cli.ActionFunc { //nolint:funlen
|
||||||
return func(c *cli.Context) error {
|
return func(c *cli.Context) error {
|
||||||
defer b.CrashHandler.HandlePanic()
|
defer b.CrashHandler.HandlePanic()
|
||||||
defer func() { _ = b.Lock.Close() }()
|
defer func() { _ = b.Lock.Close() }()
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package base
|
package base
|
||||||
|
|
||||||
@ -21,8 +21,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/ProtonMail/proton-bridge/internal/constants"
|
"github.com/ProtonMail/proton-bridge/v2/internal/constants"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/locations"
|
"github.com/ProtonMail/proton-bridge/v2/internal/locations"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ func migrateFiles(configName string) error {
|
|||||||
if err := migrateCacheFromBoth15xAnd16x(locations, userCacheDir); err != nil {
|
if err := migrateCacheFromBoth15xAnd16x(locations, userCacheDir); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := migrateUpdatesFrom16x(configName, locations); err != nil { //nolint[revive] It is more clear to structure this way
|
if err := migrateUpdatesFrom16x(configName, locations); err != nil { //nolint:revive It is more clear to structure this way
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
197
internal/app/base/migration_rebranding.go
Normal file
@ -0,0 +1,197 @@
|
|||||||
|
// Copyright (c) 2022 Proton AG
|
||||||
|
//
|
||||||
|
// This file is part of Proton Mail Bridge.
|
||||||
|
//
|
||||||
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
package base
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/ProtonMail/proton-bridge/v2/internal/config/settings"
|
||||||
|
"github.com/ProtonMail/proton-bridge/v2/pkg/keychain"
|
||||||
|
"github.com/hashicorp/go-multierror"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
|
)
|
||||||
|
|
||||||
|
const darwin = "darwin"
|
||||||
|
|
||||||
|
func migrateRebranding(settingsObj *settings.Settings, keychainName string) (result error) {
|
||||||
|
if err := migrateStartupBeforeRebranding(); err != nil {
|
||||||
|
result = multierror.Append(result, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
lastUsedVersion := settingsObj.Get(settings.LastVersionKey)
|
||||||
|
|
||||||
|
// Skipping migration: it is first bridge start or cache was cleared.
|
||||||
|
if lastUsedVersion == "" {
|
||||||
|
settingsObj.SetBool(settings.RebrandingMigrationKey, true)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Skipping rest of migration: already done
|
||||||
|
if settingsObj.GetBool(settings.RebrandingMigrationKey) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
switch runtime.GOOS {
|
||||||
|
case "windows", "linux":
|
||||||
|
// GODT-1260 we would need admin rights to changes desktop files
|
||||||
|
// and start menu items.
|
||||||
|
settingsObj.SetBool(settings.RebrandingMigrationKey, true)
|
||||||
|
case darwin:
|
||||||
|
if shouldContinue, err := isMacBeforeRebranding(); !shouldContinue || err != nil {
|
||||||
|
if err != nil {
|
||||||
|
result = multierror.Append(result, err)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := migrateMacKeychainBeforeRebranding(settingsObj, keychainName); err != nil {
|
||||||
|
result = multierror.Append(result, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
settingsObj.SetBool(settings.RebrandingMigrationKey, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
// migrateMacKeychainBeforeRebranding deals with write access restriction to
|
||||||
|
// mac keychain passwords which are caused by application renaming. The old
|
||||||
|
// passwords are copied under new name in order to have write access afer
|
||||||
|
// renaming.
|
||||||
|
func migrateMacKeychainBeforeRebranding(settingsObj *settings.Settings, keychainName string) error {
|
||||||
|
l := logrus.WithField("pkg", "app/base/migration")
|
||||||
|
l.Warn("Migrating mac keychain")
|
||||||
|
|
||||||
|
helperConstructor, ok := keychain.Helpers["macos-keychain"]
|
||||||
|
if !ok {
|
||||||
|
return errors.New("cannot find macos-keychain helper")
|
||||||
|
}
|
||||||
|
|
||||||
|
oldKC, err := helperConstructor("ProtonMailBridgeService")
|
||||||
|
if err != nil {
|
||||||
|
l.WithError(err).Error("Keychain constructor failed")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
idByURL, err := oldKC.List()
|
||||||
|
if err != nil {
|
||||||
|
l.WithError(err).Error("List old keychain failed")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
newKC, err := keychain.NewKeychain(settingsObj, keychainName)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
for url, id := range idByURL {
|
||||||
|
li := l.WithField("id", id).WithField("url", url)
|
||||||
|
userID, secret, err := oldKC.Get(url)
|
||||||
|
if err != nil {
|
||||||
|
li.WithField("userID", userID).
|
||||||
|
WithField("err", err).
|
||||||
|
Error("Faild to get old item")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, _, err := newKC.Get(userID); err == nil {
|
||||||
|
li.Warn("Skipping migration, item already exists.")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := newKC.Put(userID, secret); err != nil {
|
||||||
|
li.WithError(err).Error("Failed to migrate user")
|
||||||
|
}
|
||||||
|
|
||||||
|
li.Info("Item migrated")
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// migrateStartupBeforeRebranding removes old startup links. The creation of new links is
|
||||||
|
// handled by bridge initialisation.
|
||||||
|
func migrateStartupBeforeRebranding() error {
|
||||||
|
path, err := os.UserHomeDir()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
switch runtime.GOOS {
|
||||||
|
case "windows":
|
||||||
|
path = filepath.Join(path, `AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\ProtonMail Bridge.lnk`)
|
||||||
|
case "linux":
|
||||||
|
path = filepath.Join(path, `.config/autostart/ProtonMail Bridge.desktop`)
|
||||||
|
case darwin:
|
||||||
|
path = filepath.Join(path, `Library/LaunchAgents/ProtonMail Bridge.plist`)
|
||||||
|
default:
|
||||||
|
return errors.New("unknown GOOS")
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := os.Stat(path); os.IsNotExist(err) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
logrus.WithField("pkg", "app/base/migration").Warn("Migrating autostartup links")
|
||||||
|
return os.Remove(path)
|
||||||
|
}
|
||||||
|
|
||||||
|
// startupNameForRebranding returns the name for autostart launcher based on
|
||||||
|
// type of rebranded instance i.e. update or manual.
|
||||||
|
//
|
||||||
|
// This only affects darwin when udpate re-writes the old startup and then
|
||||||
|
// manual installed it would not run proper exe. Therefore we return "old" name
|
||||||
|
// for updates and "new" name for manual which would be properly migrated.
|
||||||
|
//
|
||||||
|
// For orther (linux and windows) the link is always pointing to launcher which
|
||||||
|
// path didn't changed.
|
||||||
|
func startupNameForRebranding(origin string) string {
|
||||||
|
if runtime.GOOS == darwin {
|
||||||
|
if path, err := os.Executable(); err == nil && strings.Contains(path, "ProtonMail Bridge") {
|
||||||
|
return "ProtonMail Bridge"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// No need to solve for other OS. See comment above.
|
||||||
|
return origin
|
||||||
|
}
|
||||||
|
|
||||||
|
// isBeforeRebranding decide if last used version was older than 2.2.0. If
|
||||||
|
// cannot decide it returns false with error.
|
||||||
|
func isMacBeforeRebranding() (bool, error) {
|
||||||
|
// previous version | update | do mac migration |
|
||||||
|
// | first | false |
|
||||||
|
// cleared-cache | manual | false |
|
||||||
|
// cleared-cache | in-app | false |
|
||||||
|
// old | in-app | false |
|
||||||
|
// old in-app | in-app | false |
|
||||||
|
// old | manual | true |
|
||||||
|
// old in-app | manual | true |
|
||||||
|
// manual | in-app | false |
|
||||||
|
|
||||||
|
// Skip if it was in-app update and not manual
|
||||||
|
if path, err := os.Executable(); err != nil || strings.Contains(path, "ProtonMail Bridge") {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package base
|
package base
|
||||||
|
|
||||||
|
|||||||
@ -1,28 +1,28 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package base
|
package base
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
"golang.org/x/sys/execabs"
|
||||||
)
|
)
|
||||||
|
|
||||||
// maxAllowedRestarts controls after how many crashes the app will give up restarting.
|
// maxAllowedRestarts controls after how many crashes the app will give up restarting.
|
||||||
@ -43,7 +43,7 @@ func (b *Base) restartApp(crash bool) error {
|
|||||||
WithField("args", args).
|
WithField("args", args).
|
||||||
Warn("Restarting")
|
Warn("Restarting")
|
||||||
|
|
||||||
return exec.Command(b.command, args...).Start() // nolint[gosec]
|
return execabs.Command(b.command, args...).Start() //nolint:gosec
|
||||||
}
|
}
|
||||||
|
|
||||||
// incrementRestartFlag increments the value of the restart flag.
|
// incrementRestartFlag increments the value of the restart flag.
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package base
|
package base
|
||||||
|
|
||||||
@ -21,11 +21,13 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/Masterminds/semver/v3"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestIncrementRestartFlag(t *testing.T) {
|
func TestIncrementRestartFlag(t *testing.T) {
|
||||||
var tests = []struct {
|
tests := []struct {
|
||||||
in []string
|
in []string
|
||||||
out []string
|
out []string
|
||||||
}{
|
}{
|
||||||
@ -47,3 +49,15 @@ func TestIncrementRestartFlag(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestVersionLessThan(t *testing.T) {
|
||||||
|
r := require.New(t)
|
||||||
|
|
||||||
|
old := semver.MustParse("1.1.0")
|
||||||
|
current := semver.MustParse("1.1.1")
|
||||||
|
newer := semver.MustParse("1.1.2")
|
||||||
|
|
||||||
|
r.True(old.LessThan(current))
|
||||||
|
r.False(current.LessThan(current))
|
||||||
|
r.False(newer.LessThan(current))
|
||||||
|
}
|
||||||
|
|||||||
101
internal/app/base/singleinstance_unix.go
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
// Copyright (c) 2022 Proton AG
|
||||||
|
//
|
||||||
|
// This file is part of Proton Mail Bridge.
|
||||||
|
//
|
||||||
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//go:build !windows
|
||||||
|
// +build !windows
|
||||||
|
|
||||||
|
package base
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/Masterminds/semver/v3"
|
||||||
|
"github.com/ProtonMail/proton-bridge/v2/internal/config/settings"
|
||||||
|
"github.com/ProtonMail/proton-bridge/v2/internal/constants"
|
||||||
|
"github.com/allan-simon/go-singleinstance"
|
||||||
|
"golang.org/x/sys/unix"
|
||||||
|
)
|
||||||
|
|
||||||
|
// checkSingleInstance returns error if a bridge instance is already running
|
||||||
|
// This instance should be stop and window of running window should be brought
|
||||||
|
// to focus.
|
||||||
|
//
|
||||||
|
// For macOS and Linux when already running version is older than this instance
|
||||||
|
// it will kill old and continue with this new bridge (i.e. no error returned).
|
||||||
|
func checkSingleInstance(lockFilePath string, settingsObj *settings.Settings) (*os.File, error) {
|
||||||
|
if lock, err := singleinstance.CreateLockFile(lockFilePath); err == nil {
|
||||||
|
// Bridge is not runnig, continue normally
|
||||||
|
return lock, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := runningVersionIsOlder(settingsObj); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
pid, err := getPID(lockFilePath)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := unix.Kill(pid, unix.SIGTERM); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Need to wait some time to release file lock
|
||||||
|
time.Sleep(time.Second)
|
||||||
|
|
||||||
|
return singleinstance.CreateLockFile(lockFilePath)
|
||||||
|
}
|
||||||
|
|
||||||
|
func getPID(lockFilePath string) (int, error) {
|
||||||
|
file, err := os.Open(filepath.Clean(lockFilePath))
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
defer func() { _ = file.Close() }()
|
||||||
|
|
||||||
|
rawPID := make([]byte, 10) // PID is probably up to 7 digits long, 10 should be enough
|
||||||
|
n, err := file.Read(rawPID)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return strconv.Atoi(strings.TrimSpace(string(rawPID[:n])))
|
||||||
|
}
|
||||||
|
|
||||||
|
func runningVersionIsOlder(settingsObj *settings.Settings) error {
|
||||||
|
currentVer, err := semver.StrictNewVersion(constants.Version)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
runningVer, err := semver.StrictNewVersion(settingsObj.Get(settings.LastVersionKey))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if !runningVer.LessThan(currentVer) {
|
||||||
|
return errors.New("running version is not older")
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
32
internal/app/base/singleinstance_windows.go
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
// Copyright (c) 2022 Proton AG
|
||||||
|
//
|
||||||
|
// This file is part of Proton Mail Bridge.
|
||||||
|
//
|
||||||
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//go:build windows
|
||||||
|
// +build windows
|
||||||
|
|
||||||
|
package base
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/ProtonMail/proton-bridge/v2/internal/config/settings"
|
||||||
|
"github.com/allan-simon/go-singleinstance"
|
||||||
|
)
|
||||||
|
|
||||||
|
func checkSingleInstance(lockFilePath string, _ *settings.Settings) (*os.File, error) {
|
||||||
|
return singleinstance.CreateLockFile(lockFilePath)
|
||||||
|
}
|
||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
// Package bridge implements the bridge CLI application.
|
// Package bridge implements the bridge CLI application.
|
||||||
package bridge
|
package bridge
|
||||||
@ -22,20 +22,20 @@ import (
|
|||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ProtonMail/proton-bridge/internal/api"
|
"github.com/ProtonMail/proton-bridge/v2/internal/api"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/app/base"
|
"github.com/ProtonMail/proton-bridge/v2/internal/app/base"
|
||||||
pkgBridge "github.com/ProtonMail/proton-bridge/internal/bridge"
|
pkgBridge "github.com/ProtonMail/proton-bridge/v2/internal/bridge"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/config/settings"
|
"github.com/ProtonMail/proton-bridge/v2/internal/config/settings"
|
||||||
pkgTLS "github.com/ProtonMail/proton-bridge/internal/config/tls"
|
pkgTLS "github.com/ProtonMail/proton-bridge/v2/internal/config/tls"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/constants"
|
"github.com/ProtonMail/proton-bridge/v2/internal/constants"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/frontend"
|
"github.com/ProtonMail/proton-bridge/v2/internal/frontend"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/frontend/types"
|
"github.com/ProtonMail/proton-bridge/v2/internal/frontend/types"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/imap"
|
"github.com/ProtonMail/proton-bridge/v2/internal/imap"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/smtp"
|
"github.com/ProtonMail/proton-bridge/v2/internal/smtp"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/store"
|
"github.com/ProtonMail/proton-bridge/v2/internal/store"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/store/cache"
|
"github.com/ProtonMail/proton-bridge/v2/internal/store/cache"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/updater"
|
"github.com/ProtonMail/proton-bridge/v2/internal/updater"
|
||||||
"github.com/ProtonMail/proton-bridge/pkg/message"
|
"github.com/ProtonMail/proton-bridge/v2/pkg/message"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
@ -57,19 +57,22 @@ func New(base *base.Base) *cli.App {
|
|||||||
app.Flags = append(app.Flags, []cli.Flag{
|
app.Flags = append(app.Flags, []cli.Flag{
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: flagLogIMAP,
|
Name: flagLogIMAP,
|
||||||
Usage: "Enable logging of IMAP communications (all|client|server) (may contain decrypted data!)"},
|
Usage: "Enable logging of IMAP communications (all|client|server) (may contain decrypted data!)",
|
||||||
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: flagLogSMTP,
|
Name: flagLogSMTP,
|
||||||
Usage: "Enable logging of SMTP communications (may contain decrypted data!)"},
|
Usage: "Enable logging of SMTP communications (may contain decrypted data!)",
|
||||||
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: flagNonInteractive,
|
Name: flagNonInteractive,
|
||||||
Usage: "Start Bridge entirely noninteractively"},
|
Usage: "Start Bridge entirely noninteractively",
|
||||||
|
},
|
||||||
}...)
|
}...)
|
||||||
|
|
||||||
return app
|
return app
|
||||||
}
|
}
|
||||||
|
|
||||||
func mailLoop(b *base.Base, c *cli.Context) error { // nolint[funlen]
|
func mailLoop(b *base.Base, c *cli.Context) error { //nolint:funlen
|
||||||
tlsConfig, err := loadTLSConfig(b)
|
tlsConfig, err := loadTLSConfig(b)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -305,7 +308,6 @@ func loadMessageCache(b *base.Base) (cache.Cache, error) {
|
|||||||
ConcurrentRead: b.Settings.GetInt(settings.CacheConcurrencyRead),
|
ConcurrentRead: b.Settings.GetInt(settings.CacheConcurrencyRead),
|
||||||
ConcurrentWrite: b.Settings.GetInt(settings.CacheConcurrencyWrite),
|
ConcurrentWrite: b.Settings.GetInt(settings.CacheConcurrencyWrite),
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cache.NewInMemoryCache(inMemoryCacheLimnit), err
|
return cache.NewInMemoryCache(inMemoryCacheLimnit), err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,31 +1,38 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
// Package bridge provides core functionality of Bridge app.
|
// Package bridge provides core functionality of Bridge app.
|
||||||
package bridge
|
package bridge
|
||||||
|
|
||||||
|
import "github.com/ProtonMail/proton-bridge/v2/internal/config/settings"
|
||||||
|
|
||||||
|
// IsAutostartEnabled checks if link file exits.
|
||||||
func (b *Bridge) IsAutostartEnabled() bool {
|
func (b *Bridge) IsAutostartEnabled() bool {
|
||||||
return b.autostart.IsEnabled()
|
return b.autostart.IsEnabled()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EnableAutostart creates link and sets the preferences.
|
||||||
func (b *Bridge) EnableAutostart() error {
|
func (b *Bridge) EnableAutostart() error {
|
||||||
|
b.settings.SetBool(settings.AutostartKey, true)
|
||||||
return b.autostart.Enable()
|
return b.autostart.Enable()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DisableAutostart removes link and sets the preferences.
|
||||||
func (b *Bridge) DisableAutostart() error {
|
func (b *Bridge) DisableAutostart() error {
|
||||||
|
b.settings.SetBool(settings.AutostartKey, false)
|
||||||
return b.autostart.Disable()
|
return b.autostart.Disable()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
// Package bridge provides core functionality of Bridge app.
|
// Package bridge provides core functionality of Bridge app.
|
||||||
package bridge
|
package bridge
|
||||||
@ -26,21 +26,21 @@ import (
|
|||||||
|
|
||||||
"github.com/Masterminds/semver/v3"
|
"github.com/Masterminds/semver/v3"
|
||||||
"github.com/ProtonMail/go-autostart"
|
"github.com/ProtonMail/go-autostart"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/config/settings"
|
"github.com/ProtonMail/proton-bridge/v2/internal/config/settings"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/constants"
|
"github.com/ProtonMail/proton-bridge/v2/internal/constants"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/metrics"
|
"github.com/ProtonMail/proton-bridge/v2/internal/metrics"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/sentry"
|
"github.com/ProtonMail/proton-bridge/v2/internal/sentry"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/store/cache"
|
"github.com/ProtonMail/proton-bridge/v2/internal/store/cache"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/updater"
|
"github.com/ProtonMail/proton-bridge/v2/internal/updater"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/users"
|
"github.com/ProtonMail/proton-bridge/v2/internal/users"
|
||||||
"github.com/ProtonMail/proton-bridge/pkg/message"
|
"github.com/ProtonMail/proton-bridge/v2/pkg/message"
|
||||||
"github.com/ProtonMail/proton-bridge/pkg/pmapi"
|
"github.com/ProtonMail/proton-bridge/v2/pkg/pmapi"
|
||||||
|
|
||||||
"github.com/ProtonMail/proton-bridge/pkg/listener"
|
"github.com/ProtonMail/proton-bridge/v2/pkg/listener"
|
||||||
logrus "github.com/sirupsen/logrus"
|
logrus "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
var log = logrus.WithField("pkg", "bridge") //nolint[gochecknoglobals]
|
var log = logrus.WithField("pkg", "bridge") //nolint:gochecknoglobals
|
||||||
|
|
||||||
var ErrLocalCacheUnavailable = errors.New("local cache is unavailable")
|
var ErrLocalCacheUnavailable = errors.New("local cache is unavailable")
|
||||||
|
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package bridge
|
package bridge
|
||||||
|
|
||||||
@ -28,12 +28,14 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
"github.com/ProtonMail/proton-bridge/internal/logging"
|
"github.com/ProtonMail/proton-bridge/v2/internal/logging"
|
||||||
"github.com/ProtonMail/proton-bridge/pkg/pmapi"
|
"github.com/ProtonMail/proton-bridge/v2/pkg/pmapi"
|
||||||
)
|
)
|
||||||
|
|
||||||
const MaxAttachmentSize = 7 * 1024 * 1024 // 7 MB total limit
|
const (
|
||||||
const MaxCompressedFilesCount = 6
|
MaxAttachmentSize = 7 * 1024 * 1024 // 7 MB total limit
|
||||||
|
MaxCompressedFilesCount = 6
|
||||||
|
)
|
||||||
|
|
||||||
var ErrSizeTooLarge = errors.New("file is too big")
|
var ErrSizeTooLarge = errors.New("file is too big")
|
||||||
|
|
||||||
@ -153,7 +155,7 @@ func zipFiles(filenames []string) (io.Reader, error) {
|
|||||||
buf := NewLimitedBuffer(MaxAttachmentSize)
|
buf := NewLimitedBuffer(MaxAttachmentSize)
|
||||||
|
|
||||||
w := zip.NewWriter(buf)
|
w := zip.NewWriter(buf)
|
||||||
defer w.Close() //nolint[errcheck]
|
defer w.Close() //nolint:errcheck
|
||||||
|
|
||||||
for _, file := range filenames {
|
for _, file := range filenames {
|
||||||
err := addFileToZip(file, w)
|
err := addFileToZip(file, w)
|
||||||
@ -174,7 +176,7 @@ func addFileToZip(filename string, writer *zip.Writer) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer fileReader.Close() //nolint[errcheck]
|
defer fileReader.Close() //nolint:errcheck,gosec
|
||||||
|
|
||||||
fileInfo, err := fileReader.Stat()
|
fileInfo, err := fileReader.Stat()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package bridge
|
package bridge
|
||||||
|
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
// Code generated by ./release-notes.sh at 'Fri Jan 22 11:01:06 AM CET 2021'. DO NOT EDIT.
|
// Code generated by ./release-notes.sh at 'Fri Jan 22 11:01:06 AM CET 2021'. DO NOT EDIT.
|
||||||
|
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package bridge
|
package bridge
|
||||||
|
|
||||||
@ -21,12 +21,12 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/ProtonMail/proton-bridge/internal/sentry"
|
"github.com/ProtonMail/proton-bridge/v2/internal/sentry"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/store"
|
"github.com/ProtonMail/proton-bridge/v2/internal/store"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/store/cache"
|
"github.com/ProtonMail/proton-bridge/v2/internal/store/cache"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/users"
|
"github.com/ProtonMail/proton-bridge/v2/internal/users"
|
||||||
"github.com/ProtonMail/proton-bridge/pkg/listener"
|
"github.com/ProtonMail/proton-bridge/v2/pkg/listener"
|
||||||
"github.com/ProtonMail/proton-bridge/pkg/message"
|
"github.com/ProtonMail/proton-bridge/v2/pkg/message"
|
||||||
)
|
)
|
||||||
|
|
||||||
type storeFactory struct {
|
type storeFactory struct {
|
||||||
|
|||||||
@ -1,26 +1,26 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package bridge
|
package bridge
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Masterminds/semver/v3"
|
"github.com/Masterminds/semver/v3"
|
||||||
|
|
||||||
"github.com/ProtonMail/proton-bridge/internal/updater"
|
"github.com/ProtonMail/proton-bridge/v2/internal/updater"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Locator interface {
|
type Locator interface {
|
||||||
|
|||||||
14
internal/config/cache/cache.go
vendored
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
// Package cache provides access to contents inside a cache directory.
|
// Package cache provides access to contents inside a cache directory.
|
||||||
package cache
|
package cache
|
||||||
@ -22,7 +22,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/ProtonMail/proton-bridge/pkg/files"
|
"github.com/ProtonMail/proton-bridge/v2/pkg/files"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Cache struct {
|
type Cache struct {
|
||||||
@ -30,7 +30,7 @@ type Cache struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func New(dir, version string) (*Cache, error) {
|
func New(dir, version string) (*Cache, error) {
|
||||||
if err := os.MkdirAll(filepath.Join(dir, version), 0700); err != nil {
|
if err := os.MkdirAll(filepath.Join(dir, version), 0o700); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
12
internal/config/cache/cache_test.go
vendored
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package cache
|
package cache
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ func TestRemoveOldVersions(t *testing.T) {
|
|||||||
|
|
||||||
func createFilesInDir(t *testing.T, dir string, files ...string) {
|
func createFilesInDir(t *testing.T, dir string, files ...string) {
|
||||||
for _, target := range files {
|
for _, target := range files {
|
||||||
require.NoError(t, os.MkdirAll(filepath.Dir(filepath.Join(dir, target)), 0700))
|
require.NoError(t, os.MkdirAll(filepath.Dir(filepath.Join(dir, target)), 0o700))
|
||||||
|
|
||||||
f, err := os.Create(filepath.Join(dir, target))
|
f, err := os.Create(filepath.Join(dir, target))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package settings
|
package settings
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ func (p *keyValueStore) load() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer f.Close() //nolint[errcheck]
|
defer f.Close() //nolint:errcheck,gosec
|
||||||
|
|
||||||
return json.NewDecoder(f).Decode(&p.cache)
|
return json.NewDecoder(f).Decode(&p.cache)
|
||||||
}
|
}
|
||||||
@ -79,7 +79,7 @@ func (p *keyValueStore) save() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return ioutil.WriteFile(p.path, b, 0600)
|
return ioutil.WriteFile(p.path, b, 0o600)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *keyValueStore) setDefault(key, value string) {
|
func (p *keyValueStore) setDefault(key, value string) {
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package settings
|
package settings
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ func TestLoadBadKeyValueStore(t *testing.T) {
|
|||||||
path, clean := newTmpFile(r)
|
path, clean := newTmpFile(r)
|
||||||
defer clean()
|
defer clean()
|
||||||
|
|
||||||
r.NoError(ioutil.WriteFile(path, []byte("{\"key\":\"MISSING_QUOTES"), 0700))
|
r.NoError(ioutil.WriteFile(path, []byte("{\"key\":\"MISSING_QUOTES"), 0o700))
|
||||||
pref := newKeyValueStore(path)
|
pref := newKeyValueStore(path)
|
||||||
r.Equal("", pref.Get("key"))
|
r.Equal("", pref.Get("key"))
|
||||||
}
|
}
|
||||||
@ -131,7 +131,7 @@ func newTestEmptyKeyValueStore(r *require.Assertions) (*keyValueStore, func()) {
|
|||||||
|
|
||||||
func newTestKeyValueStore(r *require.Assertions) (*keyValueStore, func()) {
|
func newTestKeyValueStore(r *require.Assertions) (*keyValueStore, func()) {
|
||||||
path, clean := newTmpFile(r)
|
path, clean := newTmpFile(r)
|
||||||
r.NoError(ioutil.WriteFile(path, []byte("{\"str\":\"value\",\"int\":\"42\",\"bool\":\"true\",\"falseBool\":\"t\"}"), 0700))
|
r.NoError(ioutil.WriteFile(path, []byte("{\"str\":\"value\",\"int\":\"42\",\"bool\":\"true\",\"falseBool\":\"t\"}"), 0o700))
|
||||||
return newKeyValueStore(path), clean
|
return newKeyValueStore(path), clean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
// Package settings provides access to persistent user settings.
|
// Package settings provides access to persistent user settings.
|
||||||
package settings
|
package settings
|
||||||
@ -54,6 +54,7 @@ const (
|
|||||||
FetchWorkers = "fetch_workers"
|
FetchWorkers = "fetch_workers"
|
||||||
AttachmentWorkers = "attachment_workers"
|
AttachmentWorkers = "attachment_workers"
|
||||||
ColorScheme = "color_scheme"
|
ColorScheme = "color_scheme"
|
||||||
|
RebrandingMigrationKey = "rebranding_migrated"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
@ -89,7 +90,7 @@ func (s *Settings) setDefaultValues() {
|
|||||||
s.setDefault(ReportOutgoingNoEncKey, "false")
|
s.setDefault(ReportOutgoingNoEncKey, "false")
|
||||||
s.setDefault(LastVersionKey, "")
|
s.setDefault(LastVersionKey, "")
|
||||||
s.setDefault(UpdateChannelKey, "")
|
s.setDefault(UpdateChannelKey, "")
|
||||||
s.setDefault(RolloutKey, fmt.Sprintf("%v", rand.Float64())) //nolint[gosec] G404 It is OK to use weak random number generator here
|
s.setDefault(RolloutKey, fmt.Sprintf("%v", rand.Float64())) //nolint:gosec // G404 It is OK to use weak random number generator here
|
||||||
s.setDefault(PreferredKeychainKey, "")
|
s.setDefault(PreferredKeychainKey, "")
|
||||||
s.setDefault(CacheEnabledKey, "true")
|
s.setDefault(CacheEnabledKey, "true")
|
||||||
s.setDefault(CacheCompressionKey, "true")
|
s.setDefault(CacheCompressionKey, "true")
|
||||||
|
|||||||
@ -1,26 +1,26 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package tls
|
package tls
|
||||||
|
|
||||||
import "os/exec"
|
import "golang.org/x/sys/execabs"
|
||||||
|
|
||||||
func addTrustedCert(certPath string) error {
|
func addTrustedCert(certPath string) error {
|
||||||
return exec.Command( // nolint[gosec]
|
return execabs.Command( //nolint:gosec
|
||||||
"/usr/bin/security",
|
"/usr/bin/security",
|
||||||
"execute-with-privileges",
|
"execute-with-privileges",
|
||||||
"/usr/bin/security",
|
"/usr/bin/security",
|
||||||
@ -34,7 +34,7 @@ func addTrustedCert(certPath string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func removeTrustedCert(certPath string) error {
|
func removeTrustedCert(certPath string) error {
|
||||||
return exec.Command( // nolint[gosec]
|
return execabs.Command( //nolint:gosec
|
||||||
"/usr/bin/security",
|
"/usr/bin/security",
|
||||||
"execute-with-privileges",
|
"execute-with-privileges",
|
||||||
"/usr/bin/security",
|
"/usr/bin/security",
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package tls
|
package tls
|
||||||
|
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package tls
|
package tls
|
||||||
|
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package tls
|
package tls
|
||||||
|
|
||||||
@ -55,8 +55,8 @@ func NewTLSTemplate() (*x509.Certificate, error) {
|
|||||||
SerialNumber: serialNumber,
|
SerialNumber: serialNumber,
|
||||||
Subject: pkix.Name{
|
Subject: pkix.Name{
|
||||||
Country: []string{"CH"},
|
Country: []string{"CH"},
|
||||||
Organization: []string{"Proton Technologies AG"},
|
Organization: []string{"Proton AG"},
|
||||||
OrganizationalUnit: []string{"ProtonMail"},
|
OrganizationalUnit: []string{"Proton Mail"},
|
||||||
CommonName: "127.0.0.1",
|
CommonName: "127.0.0.1",
|
||||||
},
|
},
|
||||||
KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,
|
KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,
|
||||||
@ -110,17 +110,17 @@ func (t *TLS) GenerateCerts(template *x509.Certificate) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer certOut.Close() // nolint[errcheck]
|
defer certOut.Close() //nolint:errcheck,gosec
|
||||||
|
|
||||||
if err := pem.Encode(certOut, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}); err != nil {
|
if err := pem.Encode(certOut, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
keyOut, err := os.OpenFile(t.getTLSKeyPath(), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)
|
keyOut, err := os.OpenFile(t.getTLSKeyPath(), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer keyOut.Close() // nolint[errcheck]
|
defer keyOut.Close() //nolint:errcheck,gosec
|
||||||
|
|
||||||
return pem.Encode(keyOut, &pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(priv)})
|
return pem.Encode(keyOut, &pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(priv)})
|
||||||
}
|
}
|
||||||
@ -144,7 +144,7 @@ func (t *TLS) GetConfig() (*tls.Config, error) {
|
|||||||
caCertPool := x509.NewCertPool()
|
caCertPool := x509.NewCertPool()
|
||||||
caCertPool.AddCert(c.Leaf)
|
caCertPool.AddCert(c.Leaf)
|
||||||
|
|
||||||
// nolint[gosec]: We need to support older TLS versions for AppleMail and Outlook.
|
//nolint:gosec // We need to support older TLS versions for AppleMail and Outlook
|
||||||
return &tls.Config{
|
return &tls.Config{
|
||||||
Certificates: []tls.Certificate{c},
|
Certificates: []tls.Certificate{c},
|
||||||
ServerName: "127.0.0.1",
|
ServerName: "127.0.0.1",
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package tls
|
package tls
|
||||||
|
|
||||||
|
|||||||
@ -1,24 +1,23 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package useragent
|
package useragent
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os/exec"
|
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -35,20 +34,20 @@ func IsBigSurOrNewer() bool {
|
|||||||
return isThisDarwinNewerOrEqual(getMinBigSur())
|
return isThisDarwinNewerOrEqual(getMinBigSur())
|
||||||
}
|
}
|
||||||
|
|
||||||
func getMinCatalina() *semver.Version { return semver.MustParse("10.15.0") }
|
func getMinCatalina() *semver.Version { return semver.MustParse("19.0.0") }
|
||||||
func getMinBigSur() *semver.Version { return semver.MustParse("10.16.0") }
|
func getMinBigSur() *semver.Version { return semver.MustParse("20.0.0") }
|
||||||
|
|
||||||
func isThisDarwinNewerOrEqual(minVersion *semver.Version) bool {
|
func isThisDarwinNewerOrEqual(minVersion *semver.Version) bool {
|
||||||
if runtime.GOOS != "darwin" {
|
if runtime.GOOS != "darwin" {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
rawVersion, err := exec.Command("sw_vers", "-productVersion").Output()
|
rawVersion, err := getDarwinVersion()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return isVersionEqualOrNewer(minVersion, strings.TrimSpace(string(rawVersion)))
|
return isVersionEqualOrNewer(minVersion, strings.TrimSpace(rawVersion))
|
||||||
}
|
}
|
||||||
|
|
||||||
// isVersionEqualOrNewer is separated to be able to run test on other than darwin.
|
// isVersionEqualOrNewer is separated to be able to run test on other than darwin.
|
||||||
|
|||||||
29
internal/config/useragent/platform_darwin.go
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// Copyright (c) 2022 Proton AG
|
||||||
|
//
|
||||||
|
// This file is part of Proton Mail Bridge.
|
||||||
|
//
|
||||||
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//go:build darwin
|
||||||
|
// +build darwin
|
||||||
|
|
||||||
|
package useragent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"syscall"
|
||||||
|
)
|
||||||
|
|
||||||
|
func getDarwinVersion() (string, error) {
|
||||||
|
return syscall.Sysctl("kern.osrelease")
|
||||||
|
}
|
||||||
27
internal/config/useragent/platform_default.go
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// Copyright (c) 2022 Proton AG
|
||||||
|
//
|
||||||
|
// This file is part of Proton Mail Bridge.
|
||||||
|
//
|
||||||
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//go:build !darwin
|
||||||
|
// +build !darwin
|
||||||
|
|
||||||
|
package useragent
|
||||||
|
|
||||||
|
import "errors"
|
||||||
|
|
||||||
|
func getDarwinVersion() (string, error) {
|
||||||
|
return "", errors.New("implemented only for darwin")
|
||||||
|
}
|
||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package useragent
|
package useragent
|
||||||
|
|
||||||
@ -25,16 +25,11 @@ import (
|
|||||||
|
|
||||||
func TestIsVersionCatalinaOrNewer(t *testing.T) {
|
func TestIsVersionCatalinaOrNewer(t *testing.T) {
|
||||||
testData := map[struct{ version string }]bool{
|
testData := map[struct{ version string }]bool{
|
||||||
{""}: false,
|
{""}: false,
|
||||||
{"9.0.0"}: false,
|
{"18.0.0"}: false,
|
||||||
{"9.15.0"}: false,
|
{"19.0.0"}: true,
|
||||||
{"10.13.0"}: false,
|
{"20.0.0"}: true,
|
||||||
{"10.14.0"}: false,
|
{"21.0.0"}: true,
|
||||||
{"10.14.99"}: false,
|
|
||||||
{"10.15.0"}: true,
|
|
||||||
{"10.16.0"}: true,
|
|
||||||
{"11.0.0"}: true,
|
|
||||||
{"11.1"}: true,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for args, exp := range testData {
|
for args, exp := range testData {
|
||||||
@ -45,16 +40,11 @@ func TestIsVersionCatalinaOrNewer(t *testing.T) {
|
|||||||
|
|
||||||
func TestIsVersionBigSurOrNewer(t *testing.T) {
|
func TestIsVersionBigSurOrNewer(t *testing.T) {
|
||||||
testData := map[struct{ version string }]bool{
|
testData := map[struct{ version string }]bool{
|
||||||
{""}: false,
|
{""}: false,
|
||||||
{"9.0.0"}: false,
|
{"18.0.0"}: false,
|
||||||
{"9.15.0"}: false,
|
{"19.0.0"}: false,
|
||||||
{"10.13.0"}: false,
|
{"20.0.0"}: true,
|
||||||
{"10.14.0"}: false,
|
{"21.0.0"}: true,
|
||||||
{"10.14.99"}: false,
|
|
||||||
{"10.15.0"}: false,
|
|
||||||
{"10.16.0"}: true,
|
|
||||||
{"11.0.0"}: true,
|
|
||||||
{"11.1"}: true,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for args, exp := range testData {
|
for args, exp := range testData {
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package useragent
|
package useragent
|
||||||
|
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package useragent
|
package useragent
|
||||||
|
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.Bridge.
|
// This file is part of Proton Mail Bridge.Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
// Package constants contains variables that are set via ldflags during build.
|
// Package constants contains variables that are set via ldflags during build.
|
||||||
package constants
|
package constants
|
||||||
@ -22,7 +22,7 @@ import "fmt"
|
|||||||
|
|
||||||
const VendorName = "protonmail"
|
const VendorName = "protonmail"
|
||||||
|
|
||||||
// nolint[gochecknoglobals]
|
//nolint:gochecknoglobals
|
||||||
var (
|
var (
|
||||||
// Version of the build.
|
// Version of the build.
|
||||||
Version = ""
|
Version = ""
|
||||||
|
|||||||
@ -1,28 +1,29 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//go:build !build_qa
|
||||||
// +build !build_qa
|
// +build !build_qa
|
||||||
|
|
||||||
package constants
|
package constants
|
||||||
|
|
||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
// nolint[gochecknoglobals]
|
//nolint:gochecknoglobals
|
||||||
var (
|
var (
|
||||||
// UpdateCheckInterval defines how often we check for new version
|
// UpdateCheckInterval defines how often we check for new version.
|
||||||
UpdateCheckInterval = time.Hour //nolint[gochecknoglobals]
|
UpdateCheckInterval = time.Hour //nolint:gochecknoglobals
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,27 +1,28 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//go:build build_qa
|
||||||
// +build build_qa
|
// +build build_qa
|
||||||
|
|
||||||
package constants
|
package constants
|
||||||
|
|
||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
// nolint[gochecknoglobals]
|
//nolint:gochecknoglobals
|
||||||
var (
|
var (
|
||||||
// UpdateCheckInterval defines how often we check for new version
|
// UpdateCheckInterval defines how often we check for new version
|
||||||
UpdateCheckInterval = time.Duration(5 * time.Minute)
|
UpdateCheckInterval = time.Duration(5 * time.Minute)
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
// Package cookies implements a persistent cookie jar which satisfies the http.CookieJar interface.
|
// Package cookies implements a persistent cookie jar which satisfies the http.CookieJar interface.
|
||||||
package cookies
|
package cookies
|
||||||
@ -27,7 +27,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ProtonMail/proton-bridge/internal/config/settings"
|
"github.com/ProtonMail/proton-bridge/v2/internal/config/settings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type cookiesByHost map[string][]*http.Cookie
|
type cookiesByHost map[string][]*http.Cookie
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package cookies
|
package cookies
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ProtonMail/proton-bridge/internal/config/settings"
|
"github.com/ProtonMail/proton-bridge/v2/internal/config/settings"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package crash
|
package crash
|
||||||
|
|
||||||
|
|||||||
@ -1,25 +1,25 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
// Package crash implements a crash handler with configurable recovery actions.
|
// Package crash implements a crash handler with configurable recovery actions.
|
||||||
package crash
|
package crash
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/ProtonMail/proton-bridge/internal/sentry"
|
"github.com/ProtonMail/proton-bridge/v2/internal/sentry"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package crash
|
package crash
|
||||||
|
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
// Package events provides names of events used by the event listener in bridge.
|
// Package events provides names of events used by the event listener in bridge.
|
||||||
package events
|
package events
|
||||||
@ -21,7 +21,7 @@ package events
|
|||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ProtonMail/proton-bridge/pkg/listener"
|
"github.com/ProtonMail/proton-bridge/v2/pkg/listener"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Constants of events used by the event listener in bridge.
|
// Constants of events used by the event listener in bridge.
|
||||||
@ -34,8 +34,9 @@ const (
|
|||||||
AddressChangedLogoutEvent = "addressChangedLogout"
|
AddressChangedLogoutEvent = "addressChangedLogout"
|
||||||
UserRefreshEvent = "userRefresh"
|
UserRefreshEvent = "userRefresh"
|
||||||
RestartBridgeEvent = "restartBridge"
|
RestartBridgeEvent = "restartBridge"
|
||||||
InternetOffEvent = "internetOff"
|
InternetConnChangedEvent = "internetChanged"
|
||||||
InternetOnEvent = "internetOn"
|
InternetOff = "internetOff"
|
||||||
|
InternetOn = "internetOn"
|
||||||
SecondInstanceEvent = "secondInstance"
|
SecondInstanceEvent = "secondInstance"
|
||||||
OutgoingNoEncEvent = "outgoingNoEncryption"
|
OutgoingNoEncEvent = "outgoingNoEncryption"
|
||||||
NoActiveKeyForRecipientEvent = "noActiveKeyForRecipient"
|
NoActiveKeyForRecipientEvent = "noActiveKeyForRecipient"
|
||||||
@ -52,7 +53,7 @@ func SetupEvents(listener listener.Listener) {
|
|||||||
listener.SetLimit(LogoutEvent, LogoutEventTimeout)
|
listener.SetLimit(LogoutEvent, LogoutEventTimeout)
|
||||||
listener.SetBuffer(ErrorEvent)
|
listener.SetBuffer(ErrorEvent)
|
||||||
listener.SetBuffer(CredentialsErrorEvent)
|
listener.SetBuffer(CredentialsErrorEvent)
|
||||||
listener.SetBuffer(InternetOffEvent)
|
listener.SetBuffer(InternetConnChangedEvent)
|
||||||
listener.SetBuffer(UpgradeApplicationEvent)
|
listener.SetBuffer(UpgradeApplicationEvent)
|
||||||
listener.SetBuffer(TLSCertIssue)
|
listener.SetBuffer(TLSCertIssue)
|
||||||
listener.SetBuffer(UserRefreshEvent)
|
listener.SetBuffer(UserRefreshEvent)
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package cli
|
package cli
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/ProtonMail/proton-bridge/internal/frontend/types"
|
"github.com/ProtonMail/proton-bridge/v2/internal/frontend/types"
|
||||||
"github.com/abiosoft/ishell"
|
"github.com/abiosoft/ishell"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package cli
|
package cli
|
||||||
|
|
||||||
@ -21,9 +21,9 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/ProtonMail/proton-bridge/internal/bridge"
|
"github.com/ProtonMail/proton-bridge/v2/internal/bridge"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/config/settings"
|
"github.com/ProtonMail/proton-bridge/v2/internal/config/settings"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/frontend/types"
|
"github.com/ProtonMail/proton-bridge/v2/internal/frontend/types"
|
||||||
"github.com/abiosoft/ishell"
|
"github.com/abiosoft/ishell"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ func (f *frontendCLI) showAccountAddressInfo(user types.User, address string) {
|
|||||||
f.Println("")
|
f.Println("")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *frontendCLI) loginAccount(c *ishell.Context) { // nolint[funlen]
|
func (f *frontendCLI) loginAccount(c *ishell.Context) { //nolint:funlen
|
||||||
f.ShowPrompt(false)
|
f.ShowPrompt(false)
|
||||||
defer f.ShowPrompt(true)
|
defer f.ShowPrompt(true)
|
||||||
|
|
||||||
|
|||||||
@ -1,38 +1,36 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
// Package cli provides CLI interface of the Bridge.
|
// Package cli provides CLI interface of the Bridge.
|
||||||
package cli
|
package cli
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/ProtonMail/proton-bridge/internal/config/settings"
|
"github.com/ProtonMail/proton-bridge/v2/internal/config/settings"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/events"
|
"github.com/ProtonMail/proton-bridge/v2/internal/events"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/frontend/types"
|
"github.com/ProtonMail/proton-bridge/v2/internal/frontend/types"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/locations"
|
"github.com/ProtonMail/proton-bridge/v2/internal/locations"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/updater"
|
"github.com/ProtonMail/proton-bridge/v2/internal/updater"
|
||||||
"github.com/ProtonMail/proton-bridge/pkg/listener"
|
"github.com/ProtonMail/proton-bridge/v2/pkg/listener"
|
||||||
|
|
||||||
"github.com/abiosoft/ishell"
|
"github.com/abiosoft/ishell"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var log = logrus.WithField("pkg", "frontend/cli") //nolint:gochecknoglobals
|
||||||
log = logrus.WithField("pkg", "frontend/cli") //nolint[gochecknoglobals]
|
|
||||||
)
|
|
||||||
|
|
||||||
type frontendCLI struct {
|
type frontendCLI struct {
|
||||||
*ishell.Shell
|
*ishell.Shell
|
||||||
@ -47,7 +45,7 @@ type frontendCLI struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// New returns a new CLI frontend configured with the given options.
|
// New returns a new CLI frontend configured with the given options.
|
||||||
func New( //nolint[funlen]
|
func New( //nolint:funlen
|
||||||
panicHandler types.PanicHandler,
|
panicHandler types.PanicHandler,
|
||||||
|
|
||||||
locations *locations.Locations,
|
locations *locations.Locations,
|
||||||
@ -56,7 +54,7 @@ func New( //nolint[funlen]
|
|||||||
updater types.Updater,
|
updater types.Updater,
|
||||||
bridge types.Bridger,
|
bridge types.Bridger,
|
||||||
restarter types.Restarter,
|
restarter types.Restarter,
|
||||||
) *frontendCLI { //nolint[golint]
|
) *frontendCLI { //nolint:revive
|
||||||
fe := &frontendCLI{
|
fe := &frontendCLI{
|
||||||
Shell: ishell.New(),
|
Shell: ishell.New(),
|
||||||
|
|
||||||
@ -70,21 +68,25 @@ func New( //nolint[funlen]
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clear commands.
|
// Clear commands.
|
||||||
clearCmd := &ishell.Cmd{Name: "clear",
|
clearCmd := &ishell.Cmd{
|
||||||
|
Name: "clear",
|
||||||
Help: "remove stored accounts and preferences. (alias: cl)",
|
Help: "remove stored accounts and preferences. (alias: cl)",
|
||||||
Aliases: []string{"cl"},
|
Aliases: []string{"cl"},
|
||||||
}
|
}
|
||||||
clearCmd.AddCmd(&ishell.Cmd{Name: "cache",
|
clearCmd.AddCmd(&ishell.Cmd{
|
||||||
|
Name: "cache",
|
||||||
Help: "remove stored preferences for accounts (aliases: c, prefs, preferences)",
|
Help: "remove stored preferences for accounts (aliases: c, prefs, preferences)",
|
||||||
Aliases: []string{"c", "prefs", "preferences"},
|
Aliases: []string{"c", "prefs", "preferences"},
|
||||||
Func: fe.deleteCache,
|
Func: fe.deleteCache,
|
||||||
})
|
})
|
||||||
clearCmd.AddCmd(&ishell.Cmd{Name: "accounts",
|
clearCmd.AddCmd(&ishell.Cmd{
|
||||||
|
Name: "accounts",
|
||||||
Help: "remove all accounts from keychain. (aliases: a, k, keychain)",
|
Help: "remove all accounts from keychain. (aliases: a, k, keychain)",
|
||||||
Aliases: []string{"a", "k", "keychain"},
|
Aliases: []string{"a", "k", "keychain"},
|
||||||
Func: fe.deleteAccounts,
|
Func: fe.deleteAccounts,
|
||||||
})
|
})
|
||||||
clearCmd.AddCmd(&ishell.Cmd{Name: "everything",
|
clearCmd.AddCmd(&ishell.Cmd{
|
||||||
|
Name: "everything",
|
||||||
Help: "remove everything",
|
Help: "remove everything",
|
||||||
Aliases: []string{"a", "k", "keychain"},
|
Aliases: []string{"a", "k", "keychain"},
|
||||||
Func: fe.deleteEverything,
|
Func: fe.deleteEverything,
|
||||||
@ -92,22 +94,26 @@ func New( //nolint[funlen]
|
|||||||
fe.AddCmd(clearCmd)
|
fe.AddCmd(clearCmd)
|
||||||
|
|
||||||
// Change commands.
|
// Change commands.
|
||||||
changeCmd := &ishell.Cmd{Name: "change",
|
changeCmd := &ishell.Cmd{
|
||||||
|
Name: "change",
|
||||||
Help: "change server or account settings (aliases: ch, switch)",
|
Help: "change server or account settings (aliases: ch, switch)",
|
||||||
Aliases: []string{"ch", "switch"},
|
Aliases: []string{"ch", "switch"},
|
||||||
}
|
}
|
||||||
changeCmd.AddCmd(&ishell.Cmd{Name: "mode",
|
changeCmd.AddCmd(&ishell.Cmd{
|
||||||
|
Name: "mode",
|
||||||
Help: "switch between combined addresses and split addresses mode for account. Use index or account name as parameter. (alias: m)",
|
Help: "switch between combined addresses and split addresses mode for account. Use index or account name as parameter. (alias: m)",
|
||||||
Aliases: []string{"m"},
|
Aliases: []string{"m"},
|
||||||
Func: fe.changeMode,
|
Func: fe.changeMode,
|
||||||
Completer: fe.completeUsernames,
|
Completer: fe.completeUsernames,
|
||||||
})
|
})
|
||||||
changeCmd.AddCmd(&ishell.Cmd{Name: "port",
|
changeCmd.AddCmd(&ishell.Cmd{
|
||||||
|
Name: "port",
|
||||||
Help: "change port numbers of IMAP and SMTP servers. (alias: p)",
|
Help: "change port numbers of IMAP and SMTP servers. (alias: p)",
|
||||||
Aliases: []string{"p"},
|
Aliases: []string{"p"},
|
||||||
Func: fe.changePort,
|
Func: fe.changePort,
|
||||||
})
|
})
|
||||||
changeCmd.AddCmd(&ishell.Cmd{Name: "smtp-security",
|
changeCmd.AddCmd(&ishell.Cmd{
|
||||||
|
Name: "smtp-security",
|
||||||
Help: "change port numbers of IMAP and SMTP servers.(alias: ssl, starttls)",
|
Help: "change port numbers of IMAP and SMTP servers.(alias: ssl, starttls)",
|
||||||
Aliases: []string{"ssl", "starttls"},
|
Aliases: []string{"ssl", "starttls"},
|
||||||
Func: fe.changeSMTPSecurity,
|
Func: fe.changeSMTPSecurity,
|
||||||
@ -115,113 +121,136 @@ func New( //nolint[funlen]
|
|||||||
fe.AddCmd(changeCmd)
|
fe.AddCmd(changeCmd)
|
||||||
|
|
||||||
// DoH commands.
|
// DoH commands.
|
||||||
dohCmd := &ishell.Cmd{Name: "proxy",
|
dohCmd := &ishell.Cmd{
|
||||||
|
Name: "proxy",
|
||||||
Help: "allow or disallow bridge to securely connect to proton via a third party when it is being blocked",
|
Help: "allow or disallow bridge to securely connect to proton via a third party when it is being blocked",
|
||||||
}
|
}
|
||||||
dohCmd.AddCmd(&ishell.Cmd{Name: "allow",
|
dohCmd.AddCmd(&ishell.Cmd{
|
||||||
|
Name: "allow",
|
||||||
Help: "allow bridge to securely connect to proton via a third party when it is being blocked",
|
Help: "allow bridge to securely connect to proton via a third party when it is being blocked",
|
||||||
Func: fe.allowProxy,
|
Func: fe.allowProxy,
|
||||||
})
|
})
|
||||||
dohCmd.AddCmd(&ishell.Cmd{Name: "disallow",
|
dohCmd.AddCmd(&ishell.Cmd{
|
||||||
|
Name: "disallow",
|
||||||
Help: "disallow bridge to securely connect to proton via a third party when it is being blocked",
|
Help: "disallow bridge to securely connect to proton via a third party when it is being blocked",
|
||||||
Func: fe.disallowProxy,
|
Func: fe.disallowProxy,
|
||||||
})
|
})
|
||||||
fe.AddCmd(dohCmd)
|
fe.AddCmd(dohCmd)
|
||||||
|
|
||||||
// Cache-On-Disk commands.
|
// Cache-On-Disk commands.
|
||||||
codCmd := &ishell.Cmd{Name: "local-cache",
|
codCmd := &ishell.Cmd{
|
||||||
|
Name: "local-cache",
|
||||||
Help: "manage the local encrypted message cache",
|
Help: "manage the local encrypted message cache",
|
||||||
}
|
}
|
||||||
codCmd.AddCmd(&ishell.Cmd{Name: "enable",
|
codCmd.AddCmd(&ishell.Cmd{
|
||||||
|
Name: "enable",
|
||||||
Help: "enable the local cache",
|
Help: "enable the local cache",
|
||||||
Func: fe.enableCacheOnDisk,
|
Func: fe.enableCacheOnDisk,
|
||||||
})
|
})
|
||||||
codCmd.AddCmd(&ishell.Cmd{Name: "disable",
|
codCmd.AddCmd(&ishell.Cmd{
|
||||||
|
Name: "disable",
|
||||||
Help: "disable the local cache",
|
Help: "disable the local cache",
|
||||||
Func: fe.disableCacheOnDisk,
|
Func: fe.disableCacheOnDisk,
|
||||||
})
|
})
|
||||||
codCmd.AddCmd(&ishell.Cmd{Name: "change-location",
|
codCmd.AddCmd(&ishell.Cmd{
|
||||||
|
Name: "change-location",
|
||||||
Help: "change the location of the local cache",
|
Help: "change the location of the local cache",
|
||||||
Func: fe.setCacheOnDiskLocation,
|
Func: fe.setCacheOnDiskLocation,
|
||||||
})
|
})
|
||||||
fe.AddCmd(codCmd)
|
fe.AddCmd(codCmd)
|
||||||
|
|
||||||
// Updates commands.
|
// Updates commands.
|
||||||
updatesCmd := &ishell.Cmd{Name: "updates",
|
updatesCmd := &ishell.Cmd{
|
||||||
|
Name: "updates",
|
||||||
Help: "manage bridge updates",
|
Help: "manage bridge updates",
|
||||||
}
|
}
|
||||||
updatesCmd.AddCmd(&ishell.Cmd{Name: "check",
|
updatesCmd.AddCmd(&ishell.Cmd{
|
||||||
|
Name: "check",
|
||||||
Help: "check for Bridge updates",
|
Help: "check for Bridge updates",
|
||||||
Func: fe.checkUpdates,
|
Func: fe.checkUpdates,
|
||||||
})
|
})
|
||||||
autoUpdatesCmd := &ishell.Cmd{Name: "autoupdates",
|
autoUpdatesCmd := &ishell.Cmd{
|
||||||
|
Name: "autoupdates",
|
||||||
Help: "manage bridge updates",
|
Help: "manage bridge updates",
|
||||||
}
|
}
|
||||||
updatesCmd.AddCmd(autoUpdatesCmd)
|
updatesCmd.AddCmd(autoUpdatesCmd)
|
||||||
autoUpdatesCmd.AddCmd(&ishell.Cmd{Name: "enable",
|
autoUpdatesCmd.AddCmd(&ishell.Cmd{
|
||||||
|
Name: "enable",
|
||||||
Help: "automatically keep bridge up to date",
|
Help: "automatically keep bridge up to date",
|
||||||
Func: fe.enableAutoUpdates,
|
Func: fe.enableAutoUpdates,
|
||||||
})
|
})
|
||||||
autoUpdatesCmd.AddCmd(&ishell.Cmd{Name: "disable",
|
autoUpdatesCmd.AddCmd(&ishell.Cmd{
|
||||||
|
Name: "disable",
|
||||||
Help: "require bridge to be manually updated",
|
Help: "require bridge to be manually updated",
|
||||||
Func: fe.disableAutoUpdates,
|
Func: fe.disableAutoUpdates,
|
||||||
})
|
})
|
||||||
updatesChannelCmd := &ishell.Cmd{Name: "channel",
|
updatesChannelCmd := &ishell.Cmd{
|
||||||
|
Name: "channel",
|
||||||
Help: "switch updates channel",
|
Help: "switch updates channel",
|
||||||
}
|
}
|
||||||
updatesCmd.AddCmd(updatesChannelCmd)
|
updatesCmd.AddCmd(updatesChannelCmd)
|
||||||
updatesChannelCmd.AddCmd(&ishell.Cmd{Name: "early",
|
updatesChannelCmd.AddCmd(&ishell.Cmd{
|
||||||
|
Name: "early",
|
||||||
Help: "switch to the early-access updates channel",
|
Help: "switch to the early-access updates channel",
|
||||||
Func: fe.selectEarlyChannel,
|
Func: fe.selectEarlyChannel,
|
||||||
})
|
})
|
||||||
updatesChannelCmd.AddCmd(&ishell.Cmd{Name: "stable",
|
updatesChannelCmd.AddCmd(&ishell.Cmd{
|
||||||
|
Name: "stable",
|
||||||
Help: "switch to the stable updates channel",
|
Help: "switch to the stable updates channel",
|
||||||
Func: fe.selectStableChannel,
|
Func: fe.selectStableChannel,
|
||||||
})
|
})
|
||||||
fe.AddCmd(updatesCmd)
|
fe.AddCmd(updatesCmd)
|
||||||
|
|
||||||
// Print info commands.
|
// Print info commands.
|
||||||
fe.AddCmd(&ishell.Cmd{Name: "log-dir",
|
fe.AddCmd(&ishell.Cmd{
|
||||||
|
Name: "log-dir",
|
||||||
Help: "print path to directory with logs. (aliases: log, logs)",
|
Help: "print path to directory with logs. (aliases: log, logs)",
|
||||||
Aliases: []string{"log", "logs"},
|
Aliases: []string{"log", "logs"},
|
||||||
Func: fe.printLogDir,
|
Func: fe.printLogDir,
|
||||||
})
|
})
|
||||||
fe.AddCmd(&ishell.Cmd{Name: "manual",
|
fe.AddCmd(&ishell.Cmd{
|
||||||
|
Name: "manual",
|
||||||
Help: "print URL with instructions. (alias: man)",
|
Help: "print URL with instructions. (alias: man)",
|
||||||
Aliases: []string{"man"},
|
Aliases: []string{"man"},
|
||||||
Func: fe.printManual,
|
Func: fe.printManual,
|
||||||
})
|
})
|
||||||
|
|
||||||
fe.AddCmd(&ishell.Cmd{Name: "credits",
|
fe.AddCmd(&ishell.Cmd{
|
||||||
|
Name: "credits",
|
||||||
Help: "print used resources.",
|
Help: "print used resources.",
|
||||||
Func: fe.printCredits,
|
Func: fe.printCredits,
|
||||||
})
|
})
|
||||||
|
|
||||||
// Account commands.
|
// Account commands.
|
||||||
fe.AddCmd(&ishell.Cmd{Name: "list",
|
fe.AddCmd(&ishell.Cmd{
|
||||||
|
Name: "list",
|
||||||
Help: "print the list of accounts. (aliases: l, ls)",
|
Help: "print the list of accounts. (aliases: l, ls)",
|
||||||
Func: fe.noAccountWrapper(fe.listAccounts),
|
Func: fe.noAccountWrapper(fe.listAccounts),
|
||||||
Aliases: []string{"l", "ls"},
|
Aliases: []string{"l", "ls"},
|
||||||
})
|
})
|
||||||
fe.AddCmd(&ishell.Cmd{Name: "info",
|
fe.AddCmd(&ishell.Cmd{
|
||||||
|
Name: "info",
|
||||||
Help: "print the configuration for account. Use index or account name as parameter. (alias: i)",
|
Help: "print the configuration for account. Use index or account name as parameter. (alias: i)",
|
||||||
Func: fe.noAccountWrapper(fe.showAccountInfo),
|
Func: fe.noAccountWrapper(fe.showAccountInfo),
|
||||||
Completer: fe.completeUsernames,
|
Completer: fe.completeUsernames,
|
||||||
Aliases: []string{"i"},
|
Aliases: []string{"i"},
|
||||||
})
|
})
|
||||||
fe.AddCmd(&ishell.Cmd{Name: "login",
|
fe.AddCmd(&ishell.Cmd{
|
||||||
|
Name: "login",
|
||||||
Help: "login procedure to add or connect account. Optionally use index or account as parameter. (aliases: a, add, con, connect)",
|
Help: "login procedure to add or connect account. Optionally use index or account as parameter. (aliases: a, add, con, connect)",
|
||||||
Func: fe.loginAccount,
|
Func: fe.loginAccount,
|
||||||
Aliases: []string{"add", "a", "con", "connect"},
|
Aliases: []string{"add", "a", "con", "connect"},
|
||||||
Completer: fe.completeUsernames,
|
Completer: fe.completeUsernames,
|
||||||
})
|
})
|
||||||
fe.AddCmd(&ishell.Cmd{Name: "logout",
|
fe.AddCmd(&ishell.Cmd{
|
||||||
|
Name: "logout",
|
||||||
Help: "disconnect the account. Use index or account name as parameter. (aliases: d, disconnect)",
|
Help: "disconnect the account. Use index or account name as parameter. (aliases: d, disconnect)",
|
||||||
Func: fe.noAccountWrapper(fe.logoutAccount),
|
Func: fe.noAccountWrapper(fe.logoutAccount),
|
||||||
Aliases: []string{"d", "disconnect"},
|
Aliases: []string{"d", "disconnect"},
|
||||||
Completer: fe.completeUsernames,
|
Completer: fe.completeUsernames,
|
||||||
})
|
})
|
||||||
fe.AddCmd(&ishell.Cmd{Name: "delete",
|
fe.AddCmd(&ishell.Cmd{
|
||||||
|
Name: "delete",
|
||||||
Help: "remove the account from keychain. Use index or account name as parameter. (aliases: del, rm, remove)",
|
Help: "remove the account from keychain. Use index or account name as parameter. (aliases: del, rm, remove)",
|
||||||
Func: fe.noAccountWrapper(fe.deleteAccount),
|
Func: fe.noAccountWrapper(fe.deleteAccount),
|
||||||
Aliases: []string{"del", "rm", "remove"},
|
Aliases: []string{"del", "rm", "remove"},
|
||||||
@ -229,7 +258,8 @@ func New( //nolint[funlen]
|
|||||||
})
|
})
|
||||||
|
|
||||||
// System commands.
|
// System commands.
|
||||||
fe.AddCmd(&ishell.Cmd{Name: "restart",
|
fe.AddCmd(&ishell.Cmd{
|
||||||
|
Name: "restart",
|
||||||
Help: "restart the bridge.",
|
Help: "restart the bridge.",
|
||||||
Func: fe.restart,
|
Func: fe.restart,
|
||||||
})
|
})
|
||||||
@ -244,8 +274,7 @@ func New( //nolint[funlen]
|
|||||||
func (f *frontendCLI) watchEvents() {
|
func (f *frontendCLI) watchEvents() {
|
||||||
errorCh := f.eventListener.ProvideChannel(events.ErrorEvent)
|
errorCh := f.eventListener.ProvideChannel(events.ErrorEvent)
|
||||||
credentialsErrorCh := f.eventListener.ProvideChannel(events.CredentialsErrorEvent)
|
credentialsErrorCh := f.eventListener.ProvideChannel(events.CredentialsErrorEvent)
|
||||||
internetOffCh := f.eventListener.ProvideChannel(events.InternetOffEvent)
|
internetConnChangedCh := f.eventListener.ProvideChannel(events.InternetConnChangedEvent)
|
||||||
internetOnCh := f.eventListener.ProvideChannel(events.InternetOnEvent)
|
|
||||||
addressChangedCh := f.eventListener.ProvideChannel(events.AddressChangedEvent)
|
addressChangedCh := f.eventListener.ProvideChannel(events.AddressChangedEvent)
|
||||||
addressChangedLogoutCh := f.eventListener.ProvideChannel(events.AddressChangedLogoutEvent)
|
addressChangedLogoutCh := f.eventListener.ProvideChannel(events.AddressChangedLogoutEvent)
|
||||||
logoutCh := f.eventListener.ProvideChannel(events.LogoutEvent)
|
logoutCh := f.eventListener.ProvideChannel(events.LogoutEvent)
|
||||||
@ -256,10 +285,13 @@ func (f *frontendCLI) watchEvents() {
|
|||||||
f.Println("Bridge failed:", errorDetails)
|
f.Println("Bridge failed:", errorDetails)
|
||||||
case <-credentialsErrorCh:
|
case <-credentialsErrorCh:
|
||||||
f.notifyCredentialsError()
|
f.notifyCredentialsError()
|
||||||
case <-internetOffCh:
|
case stat := <-internetConnChangedCh:
|
||||||
f.notifyInternetOff()
|
if stat == events.InternetOff {
|
||||||
case <-internetOnCh:
|
f.notifyInternetOff()
|
||||||
f.notifyInternetOn()
|
}
|
||||||
|
if stat == events.InternetOn {
|
||||||
|
f.notifyInternetOn()
|
||||||
|
}
|
||||||
case address := <-addressChangedCh:
|
case address := <-addressChangedCh:
|
||||||
f.Printf("Address changed for %s. You may need to reconfigure your email client.", address)
|
f.Printf("Address changed for %s. You may need to reconfigure your email client.", address)
|
||||||
case address := <-addressChangedLogoutCh:
|
case address := <-addressChangedLogoutCh:
|
||||||
@ -279,7 +311,7 @@ func (f *frontendCLI) watchEvents() {
|
|||||||
// Loop starts the frontend loop with an interactive shell.
|
// Loop starts the frontend loop with an interactive shell.
|
||||||
func (f *frontendCLI) Loop() error {
|
func (f *frontendCLI) Loop() error {
|
||||||
f.Print(`
|
f.Print(`
|
||||||
Welcome to ProtonMail Bridge interactive shell
|
Welcome to Proton Mail Bridge interactive shell
|
||||||
___....___
|
___....___
|
||||||
^^ __..-:'':__:..:__:'':-..__
|
^^ __..-:'':__:..:__:'':-..__
|
||||||
_.-:__:.-:'': : : :'':-.:__:-._
|
_.-:__:.-:'': : : :'':-.:__:-._
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package cli
|
package cli
|
||||||
|
|
||||||
@ -23,14 +23,12 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/ProtonMail/proton-bridge/internal/config/settings"
|
"github.com/ProtonMail/proton-bridge/v2/internal/config/settings"
|
||||||
"github.com/ProtonMail/proton-bridge/pkg/ports"
|
"github.com/ProtonMail/proton-bridge/v2/pkg/ports"
|
||||||
"github.com/abiosoft/ishell"
|
"github.com/abiosoft/ishell"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var currentPort = "" //nolint:gochecknoglobals
|
||||||
currentPort = "" //nolint[gochecknoglobals]
|
|
||||||
)
|
|
||||||
|
|
||||||
func (f *frontendCLI) restart(c *ishell.Context) {
|
func (f *frontendCLI) restart(c *ishell.Context) {
|
||||||
if f.yesNoQuestion("Are you sure you want to restart the Bridge") {
|
if f.yesNoQuestion("Are you sure you want to restart the Bridge") {
|
||||||
|
|||||||
@ -1,28 +1,28 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package cli
|
package cli
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/ProtonMail/proton-bridge/internal/bridge"
|
"github.com/ProtonMail/proton-bridge/v2/internal/bridge"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/config/settings"
|
"github.com/ProtonMail/proton-bridge/v2/internal/config/settings"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/updater"
|
"github.com/ProtonMail/proton-bridge/v2/internal/updater"
|
||||||
"github.com/abiosoft/ishell"
|
"github.com/abiosoft/ishell"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -1,26 +1,26 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
package cli
|
package cli
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
pmapi "github.com/ProtonMail/proton-bridge/pkg/pmapi"
|
pmapi "github.com/ProtonMail/proton-bridge/v2/pkg/pmapi"
|
||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -28,9 +28,7 @@ const (
|
|||||||
maxInputRepeat = 2
|
maxInputRepeat = 2
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var bold = color.New(color.Bold).SprintFunc() //nolint:gochecknoglobals
|
||||||
bold = color.New(color.Bold).SprintFunc() //nolint[gochecknoglobals]
|
|
||||||
)
|
|
||||||
|
|
||||||
func isNotEmpty(val string) bool {
|
func isNotEmpty(val string) bool {
|
||||||
return val != ""
|
return val != ""
|
||||||
@ -103,7 +101,7 @@ func (f *frontendCLI) notifyNeedUpgrade() {
|
|||||||
|
|
||||||
func (f *frontendCLI) notifyCredentialsError() {
|
func (f *frontendCLI) notifyCredentialsError() {
|
||||||
// Print in 80-column width.
|
// Print in 80-column width.
|
||||||
f.Println("ProtonMail Bridge is not able to detect a supported password manager")
|
f.Println("Proton Mail Bridge is not able to detect a supported password manager")
|
||||||
f.Println("(secret-service or pass). Please install and set up a supported password manager")
|
f.Println("(secret-service or pass). Please install and set up a supported password manager")
|
||||||
f.Println("and restart the application.")
|
f.Println("and restart the application.")
|
||||||
}
|
}
|
||||||
@ -114,15 +112,15 @@ func (f *frontendCLI) notifyCertIssue() {
|
|||||||
be insecure.
|
be insecure.
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
ProtonMail Bridge was not able to establish a secure connection to Proton
|
Proton Mail Bridge was not able to establish a secure connection to Proton
|
||||||
servers due to a TLS certificate error. This means your connection may
|
servers due to a TLS certificate error. This means your connection may
|
||||||
potentially be insecure and susceptible to monitoring by third parties.
|
potentially be insecure and susceptible to monitoring by third parties.
|
||||||
|
|
||||||
Recommendation:
|
Recommendation:
|
||||||
* If you trust your network operator, you can continue to use ProtonMail
|
* If you trust your network operator, you can continue to use Proton Mail
|
||||||
as usual.
|
as usual.
|
||||||
* If you don't trust your network operator, reconnect to ProtonMail over a VPN
|
* If you don't trust your network operator, reconnect to Proton Mail over a VPN
|
||||||
(such as ProtonVPN) which encrypts your Internet connection, or use
|
(such as ProtonVPN) which encrypts your Internet connection, or use
|
||||||
a different network to access ProtonMail.
|
a different network to access Proton Mail.
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
// Package clientconfig provides automatic config of IMAP and SMTP.
|
// Package clientconfig provides automatic config of IMAP and SMTP.
|
||||||
// For now only for Apple Mail.
|
// For now only for Apple Mail.
|
||||||
@ -22,9 +22,9 @@ package clientconfig
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/ProtonMail/proton-bridge/internal/config/settings"
|
"github.com/ProtonMail/proton-bridge/v2/internal/config/settings"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/config/useragent"
|
"github.com/ProtonMail/proton-bridge/v2/internal/config/useragent"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/frontend/types"
|
"github.com/ProtonMail/proton-bridge/v2/internal/frontend/types"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ type AutoConfig interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
available = map[string]AutoConfig{} //nolint[gochecknoglobals]
|
available = map[string]AutoConfig{} //nolint:gochecknoglobals
|
||||||
ErrNotAvailable = errors.New("configuration not available")
|
ErrNotAvailable = errors.New("configuration not available")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -1,20 +1,21 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//go:build darwin
|
||||||
// +build darwin
|
// +build darwin
|
||||||
|
|
||||||
package clientconfig
|
package clientconfig
|
||||||
@ -22,23 +23,23 @@ package clientconfig
|
|||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ProtonMail/proton-bridge/internal/bridge"
|
"github.com/ProtonMail/proton-bridge/v2/internal/bridge"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/config/useragent"
|
"github.com/ProtonMail/proton-bridge/v2/internal/config/useragent"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/frontend/types"
|
"github.com/ProtonMail/proton-bridge/v2/internal/frontend/types"
|
||||||
"github.com/ProtonMail/proton-bridge/pkg/mobileconfig"
|
"github.com/ProtonMail/proton-bridge/v2/pkg/mobileconfig"
|
||||||
|
"golang.org/x/sys/execabs"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
bigSurPreferncesPane = "/System/Library/PreferencePanes/Profiles.prefPane"
|
bigSurPreferncesPane = "/System/Library/PreferencePanes/Profiles.prefPane"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() { //nolint[gochecknoinit]
|
func init() { //nolint:gochecknoinit
|
||||||
available[AppleMailClient] = &appleMail{}
|
available[AppleMailClient] = &appleMail{}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,10 +56,10 @@ func (c *appleMail) Configure(imapPort, smtpPort int, imapSSL, smtpSSL bool, use
|
|||||||
}
|
}
|
||||||
|
|
||||||
if useragent.IsBigSurOrNewer() {
|
if useragent.IsBigSurOrNewer() {
|
||||||
return exec.Command("open", bigSurPreferncesPane, confPath).Run() //nolint[gosec] G204: open command is safe, mobileconfig is generated by us
|
return execabs.Command("open", bigSurPreferncesPane, confPath).Run() //nolint:gosec G204: open command is safe, mobileconfig is generated by us
|
||||||
}
|
}
|
||||||
|
|
||||||
return exec.Command("open", confPath).Run() //nolint[gosec] G204: open command is safe, mobileconfig is generated by us
|
return execabs.Command("open", confPath).Run() //nolint:gosec G204: open command is safe, mobileconfig is generated by us
|
||||||
}
|
}
|
||||||
|
|
||||||
func prepareMobileConfig(imapPort, smtpPort int, imapSSL, smtpSSL bool, user types.User, address string) *mobileconfig.Config {
|
func prepareMobileConfig(imapPort, smtpPort int, imapSSL, smtpSSL bool, user types.User, address string) *mobileconfig.Config {
|
||||||
@ -106,7 +107,7 @@ func saveConfigTemporarily(mc *mobileconfig.Config) (fname string, err error) {
|
|||||||
|
|
||||||
// Make sure the file is only readable for the current user.
|
// Make sure the file is only readable for the current user.
|
||||||
fname = filepath.Clean(filepath.Join(dir, "protonmail.mobileconfig"))
|
fname = filepath.Clean(filepath.Join(dir, "protonmail.mobileconfig"))
|
||||||
f, err := os.OpenFile(fname, os.O_RDWR|os.O_CREATE, 0600)
|
f, err := os.OpenFile(fname, os.O_RDWR|os.O_CREATE, 0o600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,33 +1,33 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
// Package frontend provides all interfaces of the Bridge.
|
// Package frontend provides all interfaces of the Bridge.
|
||||||
package frontend
|
package frontend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/ProtonMail/proton-bridge/internal/bridge"
|
"github.com/ProtonMail/proton-bridge/v2/internal/bridge"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/config/settings"
|
"github.com/ProtonMail/proton-bridge/v2/internal/config/settings"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/config/useragent"
|
"github.com/ProtonMail/proton-bridge/v2/internal/config/useragent"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/frontend/cli"
|
"github.com/ProtonMail/proton-bridge/v2/internal/frontend/cli"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/frontend/qt"
|
"github.com/ProtonMail/proton-bridge/v2/internal/frontend/qt"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/frontend/types"
|
"github.com/ProtonMail/proton-bridge/v2/internal/frontend/types"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/locations"
|
"github.com/ProtonMail/proton-bridge/v2/internal/locations"
|
||||||
"github.com/ProtonMail/proton-bridge/internal/updater"
|
"github.com/ProtonMail/proton-bridge/v2/internal/updater"
|
||||||
"github.com/ProtonMail/proton-bridge/pkg/listener"
|
"github.com/ProtonMail/proton-bridge/v2/pkg/listener"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Frontend interface {
|
type Frontend interface {
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) 2022 Proton Technologies AG
|
// Copyright (c) 2022 Proton AG
|
||||||
//
|
//
|
||||||
// This file is part of ProtonMail Bridge.
|
// This file is part of Proton Mail Bridge.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import QtQuick 2.13
|
import QtQuick 2.13
|
||||||
import QtQuick.Layouts 1.12
|
import QtQuick.Layouts 1.12
|
||||||
@ -27,7 +27,7 @@ Item {
|
|||||||
property ColorScheme colorScheme
|
property ColorScheme colorScheme
|
||||||
property var user
|
property var user
|
||||||
|
|
||||||
property var _spacing: 12
|
property var _spacing: 12 * ProtonStyle.px
|
||||||
|
|
||||||
property color usedSpaceColor : {
|
property color usedSpaceColor : {
|
||||||
if (!root.enabled) return root.colorScheme.text_weak
|
if (!root.enabled) return root.colorScheme.text_weak
|
||||||
@ -86,7 +86,7 @@ Item {
|
|||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.preferredWidth: height
|
Layout.preferredWidth: height
|
||||||
|
|
||||||
radius: 4
|
radius: ProtonStyle.avatar_radius
|
||||||
|
|
||||||
color: root.colorScheme.background_avatar
|
color: root.colorScheme.background_avatar
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ Item {
|
|||||||
elide: Text.ElideMiddle
|
elide: Text.ElideMiddle
|
||||||
}
|
}
|
||||||
|
|
||||||
Item { implicitHeight: root.type == AccountDelegate.LargeView ? 6 : 0 }
|
Item { implicitHeight: root.type == AccountDelegate.LargeView ? 6 * ProtonStyle.px : 0 }
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
spacing: 0
|
spacing: 0
|
||||||
@ -161,14 +161,16 @@ Item {
|
|||||||
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
id: storage_bar
|
||||||
visible: root.user ? root.type == AccountDelegate.LargeView : false
|
visible: root.user ? root.type == AccountDelegate.LargeView : false
|
||||||
width: 140
|
width: 140 * ProtonStyle.px
|
||||||
height: 4
|
height: 4 * ProtonStyle.px
|
||||||
radius: 3
|
radius: ProtonStyle.storage_bar_radius
|
||||||
color: root.colorScheme.border_weak
|
color: root.colorScheme.border_weak
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
radius: 3
|
id: storage_bar_filled
|
||||||
|
radius: ProtonStyle.storage_bar_radius
|
||||||
color: root.usedSpaceColor
|
color: root.usedSpaceColor
|
||||||
visible: root.user ? parent.visible && root.user.loggedIn : false
|
visible: root.user ? parent.visible && root.user.loggedIn : false
|
||||||
anchors {
|
anchors {
|
||||||
|
|||||||