Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Notification system #1766

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
403 commits
Select commit Hold shift + click to select a range
87da0d7
added websocket reconnect javascript
relativisticelectron Jul 6, 2022
3e740d3
timeout fix
relativisticelectron Jul 6, 2022
77752d8
FIXED server timout issue
relativisticelectron Jul 7, 2022
5de1e35
working port config
relativisticelectron Jul 7, 2022
e732f04
added websockets
relativisticelectron Jul 7, 2022
8381877
fixed cypress test
relativisticelectron Jul 7, 2022
ab71c85
graceful exit, but client is slow
relativisticelectron Jul 8, 2022
9229214
fast shutdown
relativisticelectron Jul 8, 2022
f76639b
Switch to other port, if this one is blocked
relativisticelectron Jul 8, 2022
06cc9f4
better error handling
relativisticelectron Jul 8, 2022
daee7a8
Merge branch '20220703_websockets' into 20220616_notification_system
relativisticelectron Jul 8, 2022
71815ae
undid the port retrying
relativisticelectron Jul 8, 2022
cf38f78
Merge branch '20220703_websockets' into 20220616_notification_system
relativisticelectron Jul 8, 2022
88dd2be
trying CI with different port for websockets
relativisticelectron Jul 10, 2022
ebf452a
Merge branch '20220703_websockets' into 20220616_notification_system
relativisticelectron Jul 10, 2022
9f2cce3
added getting port from ENV
relativisticelectron Jul 10, 2022
883fe97
test CI with longer wait time for cypress
relativisticelectron Jul 10, 2022
6013ce1
Merge branch '20220703_websockets' into 20220616_notification_system
relativisticelectron Jul 10, 2022
090bb1e
reset wait time to 1000
relativisticelectron Jul 10, 2022
dde8bd3
Merge branch '20220703_websockets' into 20220616_notification_system
relativisticelectron Jul 10, 2022
42585f9
test fix
relativisticelectron Jul 12, 2022
608fe31
Merge branch '20220703_websockets' into 20220616_notification_system
relativisticelectron Jul 12, 2022
ecad4db
doc
relativisticelectron Jul 12, 2022
da546c8
Bugfix: Flash cannot be called without a context.
relativisticelectron Jul 12, 2022
a78ecdf
Merge branch '20220703_websockets' into 20220616_notification_system
relativisticelectron Jul 12, 2022
16f7d92
restore feature that the WebAPI permission is updated
relativisticelectron Jul 13, 2022
45c62ec
Merge branch '20220703_websockets' into 20220616_notification_system
relativisticelectron Jul 13, 2022
135d58d
js formatting
relativisticelectron Jul 13, 2022
9ac7861
doc and reshuffling methods
relativisticelectron Jul 13, 2022
32ae2dd
localhost fix for cypress
relativisticelectron Jul 13, 2022
b9da0be
fixed bug that i introduced recently.
relativisticelectron Jul 13, 2022
71cdf22
doc
relativisticelectron Jul 13, 2022
2fc1010
refactoring
relativisticelectron Jul 13, 2022
a997f5a
refactoring
relativisticelectron Jul 13, 2022
b616cce
fix bug and refactoring
relativisticelectron Jul 13, 2022
0e0e734
removed use_reloader=false
relativisticelectron Jul 14, 2022
a992739
made the CreateNotification more robust
relativisticelectron Jul 14, 2022
d24735f
better log
relativisticelectron Jul 14, 2022
b914f29
bug fix
relativisticelectron Jul 14, 2022
da35a16
pytest fix
relativisticelectron Jul 14, 2022
df9f84c
bug fix
relativisticelectron Jul 14, 2022
870cb1e
pytest works... but ugly
relativisticelectron Jul 14, 2022
1485057
Merge remote-tracking branch 'cryptoadvance/master' into 20220616_not…
relativisticelectron Jul 14, 2022
800dfc6
do not start the websockets server in the tests
relativisticelectron Jul 14, 2022
765d621
Introducing SPECTER_WEBSOCKET_ACTIVE
relativisticelectron Jul 16, 2022
9a9ae30
fix for incomplete SPECTER_WEBSOCKET_ACTIVE
relativisticelectron Jul 17, 2022
0385380
fix for incomplete SPECTER_WEBSOCKET_ACTIVE
relativisticelectron Jul 17, 2022
4007287
working websockets server shutdown when main thread dies
relativisticelectron Jul 17, 2022
90cd49b
Merge branch 'master' into 20220616_notification_system
relativisticelectron Jul 17, 2022
2a0e48c
Merge remote-tracking branch 'cryptoadvance/master' into 20220616_not…
relativisticelectron Jul 19, 2022
d471be3
doc
relativisticelectron Jul 19, 2022
80d2ff9
Merge branch 'master' into 20220616_notification_system
relativisticelectron Jul 20, 2022
d71d674
camelCase for js
relativisticelectron Jul 21, 2022
ef14ff2
better naming
relativisticelectron Jul 22, 2022
5150e5e
ssl working for python client and server, but not javascript
relativisticelectron Jul 22, 2022
be6a3b4
minimal working example for self-signed ssl
relativisticelectron Jul 23, 2022
b6f9ac0
working minimal echo server in specter
relativisticelectron Jul 23, 2022
aeb2e8d
working user recognition
relativisticelectron Jul 23, 2022
806ce67
working websocket server. The client shows an ssl error
relativisticelectron Jul 23, 2022
f14f618
added ssl_context, but doesn't work yet
relativisticelectron Jul 23, 2022
cd8aa1d
no error... not tested yet
relativisticelectron Jul 23, 2022
9b400b4
working
relativisticelectron Jul 23, 2022
363bd19
working, but not in js yet
relativisticelectron Jul 23, 2022
1e504e9
almost working!!!
relativisticelectron Jul 23, 2022
b5f1005
client is not working
relativisticelectron Jul 23, 2022
c9850fb
still cannot get a 1 server to many clients working
relativisticelectron Jul 23, 2022
276f89a
minimal client example
relativisticelectron Jul 24, 2022
e824434
working minimal exaple to send to all connected clients
relativisticelectron Jul 24, 2022
982d146
working (at first, but then disconnecting)
relativisticelectron Jul 24, 2022
9c5c9db
working. but cient needs some simplifications
relativisticelectron Jul 24, 2022
afc00d3
working great!!!
relativisticelectron Jul 24, 2022
272aec6
fix closing connection handling
relativisticelectron Jul 24, 2022
26dc848
also for non ssl working
relativisticelectron Jul 24, 2022
4beace3
doc and requirements
relativisticelectron Jul 24, 2022
d655105
better config
relativisticelectron Jul 24, 2022
d6f4d0d
fix for multiple connections of 1 user
relativisticelectron Jul 24, 2022
bcc03d5
imports
relativisticelectron Jul 24, 2022
eb0addb
doc
relativisticelectron Jul 24, 2022
05d8cae
better logging
relativisticelectron Jul 24, 2022
57fe201
Merge remote-tracking branch 'cryptoadvance/master' into 202207723_si…
relativisticelectron Jul 24, 2022
5f50da6
Merge branch '202207723_simple_websocket' into 20220616_notification_…
relativisticelectron Jul 24, 2022
2626f39
added endpoint to test
relativisticelectron Jul 24, 2022
4af5e53
Merge branch '202207723_simple_websocket' into 20220616_notification_…
relativisticelectron Jul 24, 2022
88d3319
cleanup
relativisticelectron Jul 24, 2022
d0ee5e2
added a possibility to quit websocket connections via a special command.
relativisticelectron Jul 24, 2022
df996de
Merge branch '202207723_simple_websocket' into 20220616_notification_…
relativisticelectron Jul 24, 2022
8cc0134
fix error message
relativisticelectron Jul 25, 2022
007e9fa
Merge branch '202207723_simple_websocket' into 20220616_notification_…
relativisticelectron Jul 25, 2022
114653d
doc
relativisticelectron Jul 25, 2022
1513060
Merge branch '202207723_simple_websocket' into 20220616_notification_…
relativisticelectron Jul 25, 2022
262a91c
Merge branch 'master' into 20220616_notification_system
relativisticelectron Jul 29, 2022
99bdbcd
refactoring
relativisticelectron Jul 29, 2022
487a604
remove old code
relativisticelectron Jul 29, 2022
f6ee846
undo
relativisticelectron Jul 30, 2022
3ce4936
Docs: Add mobile access question to the FAQ (#1829)
moneymanolis Jul 29, 2022
d3aa53d
starting pytest
relativisticelectron Jul 30, 2022
f78f544
better descriptions
relativisticelectron Jul 31, 2022
c66dac0
more notification arguments
relativisticelectron Jul 31, 2022
48fb2b2
added pytest
relativisticelectron Aug 4, 2022
4b9d085
Merge remote-tracking branch 'cryptoadvance/master' into 20220616_not…
relativisticelectron Aug 4, 2022
486a528
Merge remote-tracking branch 'cryptoadvance/master' into 20220616_not…
relativisticelectron Aug 6, 2022
e7e469a
Merge remote-tracking branch 'cryptoadvance/master' into 20220616_not…
relativisticelectron Aug 18, 2022
7a39a36
move notifications.js such that it is always available
relativisticelectron Aug 18, 2022
c3b4b39
fix css issue
relativisticelectron Aug 19, 2022
a8c8f44
A test-page in the devhelper extension
k9ert Aug 19, 2022
c970e5f
defaults that shows a message without changing values
relativisticelectron Aug 19, 2022
9a40294
doc and rename: clarifying point about the flask flash
relativisticelectron Aug 20, 2022
5eb1f53
Merge remote-tracking branch 'cryptoadvance/master' into 20220616_not…
relativisticelectron Aug 25, 2022
cac9351
improved logging formatting
relativisticelectron Aug 25, 2022
57b55b7
js_message_box reflects noy the notification_type
relativisticelectron Aug 25, 2022
fc831bd
doc
relativisticelectron Aug 25, 2022
950cc4f
doc
relativisticelectron Aug 25, 2022
7b829a0
fix pytest
relativisticelectron Aug 25, 2022
df7d9ee
Merge branch 'master' into 20220616_notification_system
relativisticelectron Aug 25, 2022
bb15384
Merge remote-tracking branch 'cryptoadvance/master' into 20220616_not…
relativisticelectron Sep 6, 2022
2449e80
doc and use get instead of []
relativisticelectron Sep 6, 2022
1364cbc
redirect flash call
k9ert Sep 12, 2022
c204691
Merge branch 'master' into flash_refactoring
k9ert Sep 12, 2022
fde650b
Merge branch 'master' into menu_extensions
k9ert Sep 12, 2022
71e02b7
feature now complete
k9ert Sep 12, 2022
f71f0d5
documentation
k9ert Sep 12, 2022
1856bf6
rename callback
k9ert Sep 12, 2022
3fdbfac
Adding add_wallettab
k9ert Sep 12, 2022
0e9631e
Merge branch 'master' into menu_extensions
k9ert Sep 12, 2022
930bb11
moving to server_endpoints
k9ert Sep 13, 2022
cdc0edd
proper removal
k9ert Sep 13, 2022
19530fd
Merge branch 'master' into flash_refactoring
k9ert Sep 13, 2022
09e4ee0
Merge branch 'master' into 20220616_notification_system
k9ert Sep 13, 2022
a78a516
Merge branch '20220616_notification_system' of github.com:relativisti…
k9ert Sep 13, 2022
38fd496
refactor robust_json_dumps import
k9ert Sep 13, 2022
b98b120
forgot one reference of robust_json_dumps
k9ert Sep 13, 2022
46fd940
remove unintended changes
k9ert Sep 14, 2022
fcf7326
Merge branch 'master' into flash_refactoring
moneymanolis Sep 15, 2022
f15dc42
import fixes and polishing
k9ert Sep 15, 2022
6c53bb2
Merge branch 'flash_refactoring' of github.com:k9ert/specter-desktop …
k9ert Sep 15, 2022
b49c098
docs revised
moneymanolis Sep 15, 2022
f362ace
Merge remote-tracking branch 'k9ert/menu_extensions' into 20220916_no…
relativisticelectron Sep 16, 2022
b482fd5
Merge remote-tracking branch 'k9ert/flash_refactoring' into 20220916_…
relativisticelectron Sep 16, 2022
a598f6b
working notifications
relativisticelectron Sep 16, 2022
6150d23
working
relativisticelectron Sep 16, 2022
87e28dc
not working yet.... somehow sending to the server doesn't work.
relativisticelectron Sep 16, 2022
61172d7
working
relativisticelectron Sep 16, 2022
3f1e79f
added TODO
relativisticelectron Sep 16, 2022
68aea9e
redirect flash
relativisticelectron Sep 16, 2022
54dc449
fix for flash
relativisticelectron Sep 16, 2022
681358b
implemented callbacks
relativisticelectron Sep 17, 2022
d945862
invisible in sidebar and enabled by default
relativisticelectron Sep 17, 2022
7f683f3
added logo
relativisticelectron Sep 17, 2022
24747f1
adding wallet_alias and docs
k9ert Sep 19, 2022
9c1f016
Merge branch 'menu_extensions' of github.com:k9ert/specter-desktop in…
k9ert Sep 19, 2022
5570487
pictures for the docs
k9ert Sep 19, 2022
e5b1530
added import
k9ert Sep 19, 2022
c388e9f
Merge branch 'master' into menu_extensions
k9ert Sep 19, 2022
9547f89
Merge branch 'master' into menu_extensions
k9ert Sep 20, 2022
892e954
Merge branch 'master' into menu_extensions
k9ert Sep 20, 2022
747b8ab
Merge branch 'menu_extensions' of github.com:k9ert/specter-desktop in…
k9ert Sep 20, 2022
9804aae
Merge remote-tracking branch 'cryptoadvance/master' into 20220916_not…
relativisticelectron Sep 20, 2022
5d7b69a
Merge remote-tracking branch 'k9ert/menu_extensions' into 20220916_no…
relativisticelectron Sep 20, 2022
e1dcaac
forgotten change
k9ert Sep 20, 2022
1c4ca08
Merge branch '20220916_notification_extension' into 20220616_notifica…
relativisticelectron Sep 20, 2022
7ac33b8
pytest fix
relativisticelectron Sep 20, 2022
51acbbc
forgotten part 2
k9ert Sep 20, 2022
d2ca3ae
add HOST to config and fix pytest
relativisticelectron Sep 20, 2022
29329be
examples in settings and wallet menu
moneymanolis Sep 20, 2022
2083ce0
app is not required in callback_after_serverpy_init_app
relativisticelectron Sep 20, 2022
8666666
better error logging
relativisticelectron Sep 20, 2022
aff8b58
fix: better error logging
relativisticelectron Sep 20, 2022
20686ad
fix: include
relativisticelectron Sep 20, 2022
d329b82
Removing Werkzeug Request logs for Cypress
k9ert Sep 20, 2022
41f0125
Merge branch 'menu_extensions' of github.com:k9ert/specter-desktop in…
k9ert Sep 20, 2022
5058fa7
selectWallet twice to fix weird issues
k9ert Sep 20, 2022
0fa1fa8
Merge remote-tracking branch 'k9ert/menu_extensions' into 20220616_no…
relativisticelectron Sep 20, 2022
d2a2493
explicitly returing None if no user found
relativisticelectron Sep 21, 2022
7ea2762
Merge remote-tracking branch 'cryptoadvance/master' into 20220616_not…
relativisticelectron Sep 22, 2022
4242331
better structuring in server function
relativisticelectron Sep 22, 2022
d7a64ee
reset lots of flash changes
relativisticelectron Sep 22, 2022
5032353
add timeout for websocket server connections
relativisticelectron Sep 22, 2022
5c7a7e9
reset helpers.py
relativisticelectron Sep 22, 2022
bc72ab9
added connection_report
relativisticelectron Sep 22, 2022
27b0539
better default services in user.py
relativisticelectron Sep 22, 2022
80075c9
tiny cleanup
relativisticelectron Sep 22, 2022
6f1f8cf
avoid slow_request_detection_stop
relativisticelectron Sep 22, 2022
7c5d0bc
move css
relativisticelectron Sep 23, 2022
5930358
typo
relativisticelectron Sep 23, 2022
acba2fa
callback_cleanup_on_exit
relativisticelectron Sep 23, 2022
bae090d
Merge remote-tracking branch 'cryptoadvance/master' into 20220616_not…
relativisticelectron Sep 23, 2022
9125fbe
move also css colors to service
relativisticelectron Sep 23, 2022
2eb3b35
upgrade simple_websocket got rid of ssl error on close connection
relativisticelectron Sep 26, 2022
22fd26e
fix tests
k9ert Sep 21, 2022
ecf5da0
better default loading of notifications
relativisticelectron Sep 26, 2022
e8ec387
fix bug
relativisticelectron Sep 26, 2022
514401b
better callback_cleanup_on_exit
relativisticelectron Sep 26, 2022
2de3e1e
deleted files
relativisticelectron Sep 26, 2022
3fb7b86
fix 1 pytest
relativisticelectron Sep 26, 2022
b968828
removed example code
relativisticelectron Sep 26, 2022
7046d75
cleaned up js logic for the initial connection
relativisticelectron Sep 26, 2022
7b16578
Merge remote-tracking branch 'cryptoadvance/master' into 20220616_not…
relativisticelectron Sep 26, 2022
9ffaa84
moved sendRequest
relativisticelectron Sep 26, 2022
7c43706
doc
relativisticelectron Sep 26, 2022
e01b9ed
doc
relativisticelectron Sep 27, 2022
7b0ef55
increase ping/timeout interval, because the websocket connection clos…
relativisticelectron Sep 27, 2022
04cca9c
increase migration count
relativisticelectron Sep 27, 2022
6dbd0f1
renaming
relativisticelectron Sep 28, 2022
4e051d7
Merge branch 'master' into 20220616_notification_system
relativisticelectron Oct 2, 2022
1985baf
changed order of notifications cypress test
relativisticelectron Oct 2, 2022
370e1d5
disable the websockets during all pytest
relativisticelectron Oct 2, 2022
3f2dd38
reenable websockets for cypress
relativisticelectron Oct 2, 2022
c7cd147
fix bug
relativisticelectron Oct 3, 2022
7aa4882
Merge branch '20221003_wrong_service_config' into 20220616_notificati…
relativisticelectron Oct 3, 2022
ccee38f
pytest debugging ONLY. Have to rollback
relativisticelectron Oct 3, 2022
361eb04
Revert "pytest debugging ONLY. Have to rollback"
relativisticelectron Oct 3, 2022
07f3aaa
info output for pytest debugging
relativisticelectron Oct 3, 2022
10773d7
pytest experiment... Can be rolled back.
relativisticelectron Oct 4, 2022
ab2ad8e
Revert "info output for pytest debugging"
relativisticelectron Oct 4, 2022
3c64660
fix
relativisticelectron Oct 4, 2022
18ec3d8
Merge branch '20221003_wrong_service_config' into 20220616_notificati…
relativisticelectron Oct 4, 2022
95528f8
added view_functions comment
relativisticelectron Oct 4, 2022
640b727
trying to fix flaky cpyress
relativisticelectron Oct 4, 2022
cf1ccca
Merge remote-tracking branch 'cryptoadvance/master' into 20220616_not…
relativisticelectron Oct 6, 2022
be37033
fix for hardcoded url
relativisticelectron Oct 6, 2022
e2de832
added auto-reconnection on request failiure
relativisticelectron Oct 6, 2022
8d319a9
Merge remote-tracking branch 'cryptoadvance/master' into 20220616_not…
relativisticelectron Oct 10, 2022
9df5e4e
Merge remote-tracking branch 'cryptoadvance/master' into 20220616_not…
relativisticelectron Oct 22, 2022
314c282
Merge remote-tracking branch 'cryptoadvance/master' into 20220616_not…
relativisticelectron Oct 25, 2022
e53eeb9
remove user_secret_decrypted_required
relativisticelectron Oct 25, 2022
df3b90b
remove user_secret_decrypted_required
relativisticelectron Oct 25, 2022
e63d9a4
Removed verbose logging unless logging level < 10
relativisticelectron Oct 25, 2022
e4ff87f
Merge remote-tracking branch 'cryptoadvance/master' into 20220616_not…
relativisticelectron Oct 25, 2022
8148de7
remove verbose_debug from notification.id
relativisticelectron Oct 25, 2022
1a4bd46
Merge remote-tracking branch 'cryptoadvance/master' into 20220616_not…
relativisticelectron Oct 25, 2022
0806418
fix
relativisticelectron Oct 26, 2022
5555ed9
Merge remote-tracking branch 'cryptoadvance/master' into 20220616_not…
relativisticelectron Nov 24, 2022
569dfb7
fix pytest
relativisticelectron Nov 24, 2022
9df15d9
fix non-working migration
relativisticelectron Nov 25, 2022
08231bd
set devstatus_alpha and opt-in
relativisticelectron Dec 3, 2022
b2009da
delete cypress test and remove migration from pytest
relativisticelectron Dec 3, 2022
ef8dc7d
Merge remote-tracking branch 'cryptoadvance/master' into 20220616_not…
relativisticelectron Dec 3, 2022
6958242
len(classlist) seems to differ in CI and locally
relativisticelectron Dec 3, 2022
0fa5db4
remove useless code
relativisticelectron Dec 5, 2022
7f3bd1f
Merge branch 'master' into 20220616_notification_system
k9ert Dec 14, 2022
bf03c32
Merge branch 'master' into 20220616_notification_system
k9ert Dec 14, 2022
0d69ae8
done https://github.com/cryptoadvance/specter-desktop/pull/1766#discu…
relativisticelectron Dec 15, 2022
bac4422
moved service_manager_cleanup_on_exit
relativisticelectron Dec 15, 2022
e7dff40
added comment
relativisticelectron Dec 19, 2022
7040326
attempt to fix https://github.com/cryptoadvance/specter-desktop/pull/…
relativisticelectron Jan 11, 2023
4cec1f4
Merge branch 'master' into 20220616_notification_system
k9ert Jan 18, 2023
1f05655
Merge branch 'master' into 20220616_notification_system
k9ert Jan 18, 2023
a75d44f
Merge remote-tracking branch 'cryptoadvance/master' into 20220616_not…
relativisticelectron Jan 28, 2023
d77efed
pytest works. Was a variation in requirements.txt
relativisticelectron Jan 29, 2023
5aa0008
Merge branch 'master' into 20220616_notification_system
k9ert Jan 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ certifi==2022.12.7
chardet==3.0.4
Click==8.1.1
Flask==2.1.1
Werkzeug==2.0.0 # need to pin because Flask doesn't work with newer ones
Werkzeug==2.0.3 # need to pin because Flask doesn't work with newer ones
Flask-Babel==2.0.0
Flask-Cors==3.0.10
Flask-Login==0.5.0
Expand All @@ -25,6 +25,7 @@ mnemonic==0.20
cryptography==3.4.7
Flask-APScheduler==1.12.4
gunicorn==20.1.0
simple-websocket==0.8.1
protobuf==3.20.2
PyJWT==2.4.0
pytimeparse==1.1.8
Expand All @@ -34,4 +35,4 @@ cryptoadvance-liquidissuer==0.2.4
specterext-exfund==0.1.7
specterext-faucet==0.1.2
cryptoadvance.spectrum==0.3.1
specterext-stacktrack==0.2.1
specterext-stacktrack==0.2.1
82 changes: 47 additions & 35 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
#
# pip-compile --generate-hashes requirements.in
Expand All @@ -12,9 +12,9 @@ apscheduler==3.9.1 \
--hash=sha256:65e6574b6395498d371d045f2a8a7e4f7d50c6ad21ef7313d15b1c7cf20df1e3 \
--hash=sha256:ddc25a0ddd899de44d7f451f4375fb971887e65af51e41e5dcf681f59b8b2c9a
# via flask-apscheduler
babel==2.10.3 \
--hash=sha256:7614553711ee97490f732126dc077f8d0ae084ebc6a96e23db1482afabdb2c51 \
--hash=sha256:ff56f4892c1c4bf0d814575ea23471c230d544203c7748e8c68f0089478d48eb
babel==2.11.0 \
--hash=sha256:1ad3eca1c885218f6dce2ab67291178944f810a10a9b5f3cb8382a5a232b64fe \
--hash=sha256:5ef4b3226b0180dedded4229651c8b0e1a3a6a2837d45a073272f313e4cf97f6
# via flask-babel
base58==2.1.1 \
--hash=sha256:11a36f4d3ce51dfc1043f3218591ac4eb1ceb172919cebe05b52a5bcc8d245c2 \
Expand Down Expand Up @@ -119,7 +119,7 @@ cryptoadvance-liquidissuer==0.2.4 \
--hash=sha256:5a2c531801854c5a4a46daf184877e22f731cdb42d2cfb840785bda7371ba6fb \
--hash=sha256:9e468f3e35ecc566b3f74a2263677cf26632548abb194521dba15ad37acd1e9b
# via -r requirements.in
cryptoadvance.spectrum==0.3.1 \
cryptoadvance-spectrum==0.3.1 \
--hash=sha256:c0eedce7d88f28a1fbf3a5afbcf3b03f1effdb0983f07445953a1d9fbe789209 \
--hash=sha256:c8eba63d3aec6cc391784e5dde99ec39b13f719a062ef1ce786e5fdf850150d8
# via -r requirements.in
Expand Down Expand Up @@ -153,7 +153,21 @@ embit==0.6.1 \
--hash=sha256:16a84c6668dc9ffc907594457a46f7142cee379646bc009a5a9b77b0d2cb4e12
# via
# -r requirements.in
# cryptoadvance.spectrum
# cryptoadvance-spectrum
flask==2.1.1 \
--hash=sha256:8a4cf32d904cf5621db9f0c9fbcd7efabf3003f22a04e4d0ce790c7137ec5264 \
--hash=sha256:a8c9bd3e558ec99646d177a9739c41df1ded0629480b4c8d2975412f3c9519c8
# via
# -r requirements.in
# cryptoadvance-spectrum
# flask-apscheduler
# flask-babel
# flask-cors
# flask-httpauth
# flask-login
# flask-restful
# flask-sqlalchemy
# flask-wtf
flask-apscheduler==1.12.4 \
--hash=sha256:681dae34dc6cc9403ce674795e53abd0bff540472129cfd3d3c93e0e1d502da8
# via -r requirements.in
Expand All @@ -180,22 +194,8 @@ flask-restful==0.3.9 \
flask-sqlalchemy==2.5.1 \
--hash=sha256:2bda44b43e7cacb15d4e05ff3cc1f8bc97936cc464623424102bfc2c35e95912 \
--hash=sha256:f12c3d4cc5cc7fdcc148b9527ea05671718c3ea45d50c7e732cceb33f574b390
# via cryptoadvance.spectrum
flask==2.1.1 \
--hash=sha256:8a4cf32d904cf5621db9f0c9fbcd7efabf3003f22a04e4d0ce790c7137ec5264 \
--hash=sha256:a8c9bd3e558ec99646d177a9739c41df1ded0629480b4c8d2975412f3c9519c8
# via
# -r requirements.in
# cryptoadvance.spectrum
# flask-apscheduler
# flask-babel
# flask-cors
# flask-httpauth
# flask-login
# flask-restful
# flask-sqlalchemy
# flask-wtf
flask_wtf==0.15.1 \
# via cryptoadvance-spectrum
flask-wtf==0.15.1 \
--hash=sha256:6ff7af73458f182180906a37a783e290bdc8a3817fe4ad17227563137ca285bf \
--hash=sha256:ff177185f891302dc253437fe63081e7a46a4e99aca61dfe086fb23e54fff2dc
# via -r requirements.in
Expand Down Expand Up @@ -271,6 +271,10 @@ gunicorn==20.1.0 \
--hash=sha256:9dcc4547dbb1cb284accfb15ab5667a0e5d1881cc443e0677b4882a4067a807e \
--hash=sha256:e0a968b5ba15f8a328fdfd7ab1fcb5af4470c28aaf7e55df02a99bc13138e6e8
# via -r requirements.in
h11==0.14.0 \
--hash=sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d \
--hash=sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761
# via wsproto
hidapi==0.12.0.post2 \
--hash=sha256:00bad74617622b7b7abbb24eae5c11bd91957bb87217d62d8feea15c971a77b5 \
--hash=sha256:0292a29325b905fbfbb39cc368055cda63339fed684eceb7d4d241acc5e60d50 \
Expand Down Expand Up @@ -317,7 +321,7 @@ idna==3.4 \
--hash=sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4 \
--hash=sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2
# via requests
importlib_metadata==4.8.1 \
importlib-metadata==4.8.1 \
--hash=sha256:b618b6d2d5ffa2f16add5697cf57a46c76a56229b0ed1c438322e4e95645bd15 \
--hash=sha256:f284b3e11256ad1e5d03ab86bb2ccd6f5339688ff17a4d797a0fe7df326f23b1
# via -r requirements.in
Expand Down Expand Up @@ -594,7 +598,7 @@ psycopg2-binary==2.9.5 \
--hash=sha256:f95b8aca2703d6a30249f83f4fe6a9abf2e627aa892a5caaab2267d56be7ab69
# via
# -r requirements.in
# cryptoadvance.spectrum
# cryptoadvance-spectrum
pyaes==1.6.1 \
--hash=sha256:02c1b1405c38d3c370b085fb952dd8bea3fadcee6411ad99f312cc129c536d8f
# via hwi
Expand Down Expand Up @@ -637,29 +641,33 @@ pytimeparse==1.1.8 \
--hash=sha256:04b7be6cc8bd9f5647a6325444926c3ac34ee6bc7e69da4367ba282f076036bd \
--hash=sha256:e86136477be924d7e670646a98561957e8ca7308d44841e21f5ddea757556a0a
# via -r requirements.in
pytz-deprecation-shim==0.1.0.post0 \
--hash=sha256:8314c9692a636c8eb3bda879b9f119e350e93223ae83e70e80c31675a0fdc1a6 \
--hash=sha256:af097bae1b616dde5c5744441e2ddc69e74dfdcb0c263129610d85b87445a59d
# via tzlocal
pytz==2022.5 \
--hash=sha256:335ab46900b1465e714b4fda4963d87363264eb662aab5e65da039c25f1f5b22 \
--hash=sha256:c4d88f472f54d615e9cd582a5004d1e5f624854a6a27a6211591c251f22a6914
pytz==2022.7.1 \
--hash=sha256:01a0681c4b9684a28304615eba55d1ab31ae00bf68ec157ec3708a8182dbbcd0 \
--hash=sha256:78f4f37d8198e0627c5f1143240bb0206b8691d8d7ac6d78fee88b78733f8c4a
# via
# apscheduler
# babel
# flask-babel
# flask-restful
# pandas
pytz-deprecation-shim==0.1.0.post0 \
--hash=sha256:8314c9692a636c8eb3bda879b9f119e350e93223ae83e70e80c31675a0fdc1a6 \
--hash=sha256:af097bae1b616dde5c5744441e2ddc69e74dfdcb0c263129610d85b87445a59d
# via tzlocal
requests==2.26.0 \
--hash=sha256:6c1246513ecd5ecd4528a0906f910e8f0f9c6b8ec72030dc9fd154dc1a6efd24 \
--hash=sha256:b8aa58f8cf793ffd8782d3d8cb19e66ef36f7aba4353eec859e74678b01b07a7
# via
# -r requirements.in
# cryptoadvance.spectrum
# cryptoadvance-spectrum
semver==2.13.0 \
--hash=sha256:ced8b23dceb22134307c1b8abfa523da14198793d9787ac838e70e29e77458d4 \
--hash=sha256:fa0fe2722ee1c3f57eac478820c3a5ae2f624af8264cbdf9000c980ff7f75e3f
# via bitbox02
simple-websocket==0.8.1 \
--hash=sha256:0abe874f6a0c6ddd197dbd4f0ce5708b47610a0d14fa2b0762e515659573d44a \
--hash=sha256:bab2f34151d8b9abb1ea6d911e5edc8232fc203b6f814d179db0ba3f93e4e026
# via -r requirements.in
six==1.16.0 \
--hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \
--hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254
Expand Down Expand Up @@ -751,12 +759,16 @@ urllib3==1.26.12 \
--hash=sha256:3fa96cf423e6987997fc326ae8df396db2a8b7c667747d47ddd8ecba91f4a74e \
--hash=sha256:b930dd878d5a8afb066a637fbb35144fe7901e3b209d1cd4f524bd0e9deee997
# via requests
werkzeug==2.0.0 \
--hash=sha256:3389bbfe6d40c6dd25e6d3f974155163c8b3de5bbda6a89342d4ab93fae80ba0 \
--hash=sha256:64c02f6495ba01eddd6625b3675f357cd358a73f1e38458a56ad86c5baa30b53
werkzeug==2.0.3 \
--hash=sha256:1421ebfc7648a39a5c58c601b154165d05cf47a3cd0ccb70857cbdacf6c8f2b8 \
--hash=sha256:b863f8ff057c522164b6067c9e28b041161b4be5ba4d0daceeaa50a163822d3c
# via
# -r requirements.in
# flask
wsproto==1.2.0 \
--hash=sha256:ad565f26ecb92588a3e43bc3d96164de84cd9902482b130d0ddbaa9664a85065 \
--hash=sha256:b9acddd652b585d75b20477888c56642fdade28bdfd3579aa24a4d2c037dd736
# via simple-websocket
wtforms==3.0.1 \
--hash=sha256:6b351bbb12dd58af57ffef05bc78425d08d1914e0fd68ee14143b7ade023c5bc \
--hash=sha256:837f2f0e0ca79481b92884962b914eba4e72b7a2daaf1f939c890ed0124b834b
Expand Down
36 changes: 23 additions & 13 deletions src/cryptoadvance/specter/cli/cli_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,29 @@ def server(
if key:
app.config["KEY"] = key

# the app.config needs to be configured before init_app, such that the service callbacks
# like after_serverpy_init_app have this information available
if host != app.config["HOST"]:
app.config["HOST"] = host

# set up kwargs dict for app.run
kwargs = {
"host": host,
"port": app.config["PORT"],
}
# watch templates folder to reload when something changes
extra_dirs = ["templates"]
extra_files = extra_dirs[:]
for extra_dir in extra_dirs:
for dirname, dirs, files in os.walk(extra_dir):
for filename in files:
filename = os.path.join(dirname, filename)
if os.path.isfile(filename):
extra_files.append(filename)
kwargs["extra_files"] = extra_files

kwargs = configure_ssl(kwargs, app.config, ssl)

app.app_context().push()
init_app(app, hwibridge=hwibridge)

Expand All @@ -140,19 +163,6 @@ def server(

toraddr_file = path.join(app.specter.data_folder, "onion.txt")

# watch templates folder to reload when something changes
extra_dirs = ["templates"]
extra_files = extra_dirs[:]
for extra_dir in extra_dirs:
for dirname, dirs, files in os.walk(extra_dir):
for filename in files:
filename = os.path.join(dirname, filename)
if os.path.isfile(filename):
extra_files.append(filename)

kwargs = {"host": host, "port": app.config["PORT"], "extra_files": extra_files}
kwargs = configure_ssl(kwargs, app.config, ssl)

if hwibridge:
if kwargs.get("ssl_context"):
logger.error(
Expand Down
2 changes: 2 additions & 0 deletions src/cryptoadvance/specter/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class BaseConfig(object):
# The prefix for extensions which don't get access to the session cookie (if SPECTER_URL_PREFIX isn't compromised)
ISOLATED_CLIENT_EXT_URL_PREFIX = "/ext"

HOST = os.getenv("HOST", "127.0.0.1")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we move that to the config of the extension?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need the app.config["HOST"] in the notification extension. Adding it to the global BaseConfig, does make it consistent with PORT. And if another HOST value if given for the server then the config value is updated here https://github.com/relativisticelectron/specter-desktop/blob/bf03c3236958c49405b7d56c71e0b6ab67c9f5e4/src/cryptoadvance/specter/cli/cli_server.py#L127

I don't really see how to move this to the service.

PORT = os.getenv("PORT", 25441)
CONNECT_TOR = _get_bool_env_var(os.getenv("CONNECT_TOR", "False"))
SPECTER_DATA_FOLDER = os.path.expanduser(
Expand Down Expand Up @@ -183,6 +184,7 @@ class BaseConfig(object):
"cryptoadvance.specterext.swan.service",
"cryptoadvance.specterext.liquidissuer.service",
"cryptoadvance.specterext.devhelp.service",
"cryptoadvance.specterext.notifications.service",
"cryptoadvance.specterext.exfund.service",
"cryptoadvance.specterext.faucet.service",
"cryptoadvance.specterext.electrum.service",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from cryptoadvance.specter.util.specter_migrator import SpecterMigration

from ...services.service import Service
from ...services.service import Service, ServiceOptionality
from ...services import callbacks, ExtensionException
from ...util.reflection import (
_get_module_from_class,
Expand Down Expand Up @@ -395,6 +395,16 @@ def delete_services_with_unencrypted_storage(self, user: User):
self.specter.service_unencrypted_storage_manager.delete_all_service_data(user)
logger.debug(f"Deleted unencrypted services")

def add_required_services_to_users(self, users, force_opt_out=False):
"Adds the mandatory and opt_out (only if no services activated for user) services to users"
for service in self.services.values():
for user in users:
if service.optionality == ServiceOptionality.mandatory or (
service.optionality == ServiceOptionality.opt_out
and ((service.id not in user.services) or force_opt_out)
):
user.add_service(service.id)

@classmethod
def get_service_x_dirs(cls, x):
"""returns a list of package-directories which each represents a specific service.
Expand Down
20 changes: 18 additions & 2 deletions src/cryptoadvance/specter/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@ def init_app(app: SpecterFlask, hwibridge=False, specter=None):
specter=specter, devstatus_threshold=app.config["SERVICES_DEVSTATUS_THRESHOLD"]
)

def service_manager_cleanup_on_exit(signum, frame):
return specter.service_manager.execute_ext_callbacks(
callbacks.cleanup_on_exit, signum, frame
)

specter.call_functions_at_cleanup_on_exit.append(service_manager_cleanup_on_exit)

specter.initialize()

# HWI
Expand Down Expand Up @@ -206,9 +213,17 @@ def login(id, password: str = None):
from cryptoadvance.specter.server_endpoints import controller
from cryptoadvance.specter.services import controller as serviceController

# this number of view_functions needs to be updated by hand when some are added or removed.
number_of_expected_view_functions = 105
if app.config.get("TESTING"):
logger.info(f"We have {len(app.view_functions)} view Functions")
if app.config.get("TESTING") and len(app.view_functions) <= 51:
logger.info(
f"We have {len(app.view_functions)} view Functions. "
f"There should be {number_of_expected_view_functions}."
)
if (
app.config.get("TESTING")
and len(app.view_functions) < number_of_expected_view_functions
):
# Need to force a reload as otherwise the import is skipped
# in pytest, the app is created anew for each test
# But we shouldn't do that if not necessary as this would result in
Expand Down Expand Up @@ -277,6 +292,7 @@ def every5seconds():

scheduler.init_app(app)
scheduler.start()
specter.service_manager.add_required_services_to_users(specter.user_manager.users)
logger.info("----> starting service callback_after_serverpy_init_app ")
specter.service_manager.execute_ext_callbacks(
after_serverpy_init_app, scheduler=scheduler
Expand Down
11 changes: 10 additions & 1 deletion src/cryptoadvance/specter/server_endpoints/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
from flask import flash as flask_flash
from flask import current_app as app
from ..services import callbacks


def flash(*args, **kwargs):
"""An indirection in order to potentially handle a flash differently
This function could be placed in util but as it might
use the service_manager, we place it here for now.
"""
flask_flash(*args, **kwargs)

return_values = app.specter.service_manager.execute_ext_callbacks(
callbacks.flash, *args, **kwargs
)

# if no extension handled the callback
if not return_values:
flask_flash(*args, **kwargs)
1 change: 1 addition & 0 deletions src/cryptoadvance/specter/server_endpoints/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ def register():
plaintext_password=password,
config=config,
)
app.specter.service_manager.add_required_services_to_users([user])

flash(
_(
Expand Down
16 changes: 16 additions & 0 deletions src/cryptoadvance/specter/services/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,19 @@
Will get called right after having access to app.specter
"""
specter_added_to_flask_app = "specter_added_to_flask_app"

"""
Will get called when the server_endpoints.flash is called
"""
flash = "flash"

"""
Callback that is not used yet, but could be implmented in server_endpoints just as flash
"""
create_and_show_notification = "create_and_show_notification"


"""
Callback that is called last in specter.cleanup_on_exit()
"""
cleanup_on_exit = "cleanup_on_exit"
8 changes: 8 additions & 0 deletions src/cryptoadvance/specter/services/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
devstatus_prod = "prod"


class ServiceOptionality:
mandatory = "mandatory" # mandatory is not used yet by any service. Before it can be used it has to be clarified what happens in delete_services_with_encrypted_storage of mandatory services
opt_in = "opt_in"
opt_out = "opt_out"


class Service:
"""A base class for Services"""

Expand All @@ -38,6 +44,8 @@ class Service:
# If the blueprint gets a "/ext" prefix (isolated_client = True), the login cookie won't work for all specter core functionality
isolated_client = True
devstatus = devstatus_alpha
optionality = ServiceOptionality.opt_in
visible_in_sidebar = True
encrypt_data = False

def __init__(self, active, specter):
Expand Down
Loading