Commit graph

58 commits

Author SHA1 Message Date
Jonathan Zernik
93da9c0c97
Fix handling of p2p server port config (#2232) 2022-06-17 19:04:31 -07:00
Jonathan Zernik
afd3af091a
Use default peer port config when port not specified (#2218) 2022-05-24 21:41:56 -07:00
Jonathan Zernik
50af9bb905
Fix conflicting sent offers by address (#2075)
* Don't check for existing sent offer when getting requested sent offer.

* Check if received offer is already saved before requesting from peer.
2022-03-29 20:27:08 -07:00
Jonathan Zernik
bff7bbbc4b
Use squeak store to encapsulate all core fns (#2030)
* Revert "Remove usage of squeak_core from squeak_store (#2029)"

This reverts commit bd15c653aa.

* Add make squeak method to squeak store class

* Add pay offer method to squeak store

* Remove squeak_core from controller constructor

* Remove default port param from controller constructor

* Fix broken itests

* Got download single squeak working synchronously
2022-03-26 20:42:42 -07:00
Jonathan Zernik
bd15c653aa
Remove usage of squeak_core from squeak_store (#2029)
* Remove usage of squeak_core from squeak_store

* Remove default peer port arg from controller constructor
2022-03-26 18:42:00 -07:00
Jonathan Zernik
8a89dbfa10
Make peer client connect with tor (#2018) 2022-03-25 23:12:43 -07:00
Jonathan Zernik
fbc66c9813
Fix change profile name default (#2013)
* Fix default value for change profile name

* Partially fix set sell price dialog

* Fix itest in progress

* Fix get sell price
2022-03-17 23:24:50 -07:00
Jonathan Zernik
68e69e55c8
Use http for peer connection (#2002)
* Got basic web server running for peer

* Got squeak route and lookup route working

* Got secret key route working

* Got offer endpoint working

* Remove old comment

* Move peer server code to server subdir

* Create client subdir for peer client

* Return empty list for lookup when pubkeys is empty

* Add peer client and network controller class

* Remove old network code

* Remove old block subscription worker

* Remove network handler class

* Remove more old classes

* Add back twitter forwarder worker

* Remove download methods from controller

* Add websocket endpoint

* Add websocket subscribe method

* Add websocket client library

* Fetch squeaks from peer (slowly) on UI timeline load

* Fetch squeaks from peer (slowly) on UI pubkey squeaks load

* Got download squeaks working with HTTP requests

* Fixed external address method in controller

* Remove download pubkey squeak button and action

* Remove unused connection displays from peer ana peers page

* Fix 404 not found for offer endpoint

* Better handling of null cases in peer client downloader

* Simplify peer downloader

* Create subclass for range download

* Got single squeak download working

* Fix itest for get external address
2022-03-17 14:38:46 -07:00
Jonathan Zernik
ac3279c532
Improve node init (#1940)
* Eliminate squeak params from controller and network manager

* Separate instantiation from initialization of objects in node class
2022-02-13 03:23:11 -08:00
Jonathan Zernik
75d0b0634d
Split save secret key and unlock content methods (#1909)
* Split save secret key and unlock content methods of squeak store

* Unlock squeak content automatically after saving private key when squeak is not private
2021-12-27 21:13:56 -08:00
Jonathan Zernik
aef9afda61
Split set secret key and set decrypted content into separate methods of squeak db class (#1908) 2021-12-27 19:53:35 -08:00
Jonathan Zernik
e827db2ef7
Refactor unlock squeak method of squeak store (#1907) 2021-12-27 19:28:14 -08:00
Jonathan Zernik
9a2d37edb6
Add more tests for squeak store (#1905)
* Use mock db for tests in squeak store

* Add assertion about event listener call in save squeak test

* Add test for save squeak when max squeaks is exceeded

* Add test for save squeak when max squeaks per pubkey per block is exceeded
2021-12-27 17:56:05 -08:00
Jonathan Zernik
d2e61a02f4
Validate squeak against blockchain inside squeak store class (#1902) 2021-12-27 17:00:03 -08:00
Jonathan Zernik
cf64664a44
Update squeaklib to support private messages (#1898)
* Update squeaklib and update import from keys module

* Rename signing key variable to private key in test util

* Fix calling make squeak function

* Update db data file to v3

* Add recipient public key column to squeak table

* Got squeak entry db query working with alias for profiles table

* Add test for make squeak with recipient

* Add test case for get profile from squeak entry query

* Got outer join with recipient profile working

* Use outer join to get recipient profile for all squeak entry db queries

* Got itest passing with refactored squeak_store

* Remove unused config from squeak store class
2021-12-27 01:15:05 -08:00
Jonathan Zernik
0ecb73fac3
Update squeaklib and use new msg type (#1894)
* Use updated squeaklib with offer msg removed

* Bump squeaklib version and use methods to check if message has offer
2021-12-25 19:47:07 -08:00
Jonathan Zernik
b5801097b8
Implement squeak store v3 (#1886)
* Add test for insert squeak in squeak store

* Add test for delete squeak in squeak store

* Add test for save and get sent offer

* Add test for get received offer in squeak store

* Add subscription methods for squeak store

* Use squeak store in squeak controller

* Use squeak store for save squeak method in controller

* Use squeak store for unlock squeak method in controller

* Add comment to make squeak method

* Use squeak_store for more methods in controller

* Use squeak_store for price policy in controller

* Use squeak_store for create signing profile in controller

* Use squeak_store for more profile methods in controller

* Use squeak_store for more profile methods in controller

* Use squeak_store for create peer method in controller

* Use squeak_store for more peer methods in controller

* Use squeak_store for pay offer method in controller

* Use squeak_store for get sent payments and received payments method in controller

* Use squeak_store for get received offers method in controller

* Use squeak store for delete expired offers method

* Use squeak store for get squeak entries methods

* Use squeak store for save received offer method of controller

* Use squeak store for get followed public keys method of controller

* Use squeak store for reprocess received payments method of controller

* Use squeak store for delete old squeaks method of controller

* Use squeak store for like and unlike squeak method of controller

* Use squeak store for get connected peers method of controller

* Use squeak store for add and remove twitter account methods of controller

* Remove squeak_db param from controller constructor

* Use squeak core in squeak store for save squeak andunlock squeak

* Use squeak core in squeak store for make and get sent offer

* Remove old comments

* Remove more old comments

* Use squeak core in squeak store for save received offer

* Use squeak core in squeak store for pay received offer

* Use squeak core in squeak store for get interested struct

* Update twitter forwarder to use squeak store instead of squeak controller

* Update squeak deletion worker to use squeak store instead of squeak controller

* Delete old comments with lines about squeak controller

* Update squeak forwarder worker to use squeak store instead of squeak controller

* Update squeak secret key forwarder worker to use squeak store instead of squeak controller

* Update delete expired offers worker to use squeak store instead of squeak controller

* Update peer subscription workers to use squeak store instead of squeak controller

* Update peer autoconnect worker to use squeak store instead of squeak controller

* Remove usage of squeak controller in download manager start method.

* Add network handler class

* Remove unused constructor params from network handler

* Remove old comments
2021-12-25 09:47:55 -08:00
Jonathan Zernik
c2aeb344bc
Implement node settings (#1884)
* Implement node settings class

* Fix price policy for zero price

* Remove old comment

* Remove old comments

* Remove old comments
2021-12-23 08:33:40 -08:00
Jonathan Zernik
5198467889
Use new squeak protocol with schnorr and pubkey as identifier (#1870)
* Got all tests in core dir passing

* Got all tests in db dir passing

* Got tests for admin dir passing

* Got all unit tests passing

* Added migration for squeak table and profile table using new pubkey

* Re-start db migrations with new data-v2.db file

* Fix column type for profile public key

* Got all itests passing

* Log the public key in hex in create contact profile handle fn

* Rename rpc methods to use pubkey instead of address

* Got frontend mostly working with new profile pubkey

* Update frontend to use pubkey instead of address

* Change size of squeak profile detail item

* Update create contact profile dialog to use pubkey

* Update twitter account item to use pubkey

* Include label for pubkey in profile detail item

* Decrease size of profile detail item

* Update frontend build

* Improve logging of requests in handler
2021-12-20 09:28:38 -08:00
Jonathan Zernik
ed9cf92ccc
Use custom class for get secret key reply to peer (#1831)
* Use custom class for get secret key reply to peer

* Update connection class to use secret key reply

* Rename get secret key reply method
2021-11-29 01:56:57 -08:00
Jonathan Zernik
0a5d0d1d10
Remove profile custom price (#1807)
* Remove custom price from profile

* Remove profile custom price from frontend

* Update frontend build
2021-11-19 00:04:07 -08:00
Jonathan Zernik
488ed5dfc4
Add global sell price setting (#1791)
* Add sell price setting to db

* Add rpc method for set and get sell price setting

* Fix servicer methods for get and set sell price

* Add settings page in frontend

* Include default sell price in get sell price rpc

* Show sell price in settings page

* Got set sell price working in frontend

* Remove frontend validation of sell price dialog

* Use sell price from settings when determining price

* Add rpc to clear sell price setting

* Add clear sell price to frontend

* Remove unused imports in frontend

* Update frontend build
2021-11-10 01:53:55 -08:00
Jonathan Zernik
de2f84e6f8
Use polymorphic class for downloaded object (#1787) 2021-11-07 18:50:27 -08:00
Jonathan Zernik
c96f7c7f7f
Add price policy class to determine sell price (#1785) 2021-11-07 04:40:17 -08:00
Jonathan Zernik
c0141effcb
Implement share for free with saved peer (#1782)
* Add share_for_free column to peer table in db and to core struct

* Got set share for free toggle working in frontend

* Got share for free working with price zero in controller
2021-11-07 02:21:13 -08:00
Jonathan Zernik
6c40891ad8
Add twitter forwarder (#1755)
* Add twitter stream class

* Got twitter forwarder subscription working

* Add config table in db with twitter bearer token

* Only run forward tweets task when twitter bearer token and twitter handles are not null

* Add twitter page to frontend and add button to set bearer token

* Reload bearer token in ui after setting value

* Add twitter accounts table to db

* Got get twitter accounts request working

* Display twitter account list items in twitter page

* Show twitter accounts in twitter page

* Got create squeak from tweet working

* Update twitter stream upon twitter accounts changes

* Got terminate twitter stream connection working

* Update frontend build

* Remove print statements from itest

* Remove main function from twitter stream module

* Make tweet forwarder worker run as daemon thread

* Use custom config for subscribe tweets retry interval
2021-11-04 19:10:00 -07:00
Jonathan Zernik
8daeee2717
Return immediately from download when zero connected peers (#1733) 2021-10-26 15:27:06 -07:00
Jonathan Zernik
00eb68cf72
Add test for is interested for download interest (#1728) 2021-10-25 16:49:25 -07:00
Jonathan Zernik
635dff92ac
Fix shutdown threadpool in download manager (#1727)
* Fix shutdown threadpool in download manager

* Call event.wait with timeout value so it stops eventually

* Cancel all running downloads when download manager shuts down
2021-10-25 16:24:19 -07:00
Jonathan Zernik
dbc6c31381
Make download async (#1725)
* Use active download class for explicit downloads

* Delete old temporary interest manager and expiringdict dependency

* Delete old comments related to temporary interest manager

* Add log line after successful download single squeak

* Add unit test for mark download complete

* Add unit test for wait for stop method of download

* Add test for download hash not interested

* Add test for get download result

* Add test for initiate download for hash download

* Add test for initiate download for interest download

* Rename interest download

* Remove commented old method

* Remove another comment from active download

* Use limit 1 for hash download

* Rename wait for complete method of download
2021-10-25 14:48:12 -07:00
Jonathan Zernik
eb52cc8bb1
Disable test start and stop squeak node unit test (#1574) 2021-10-12 01:36:39 -07:00
Jonathan Zernik
956390e1fb
Mock out more workers in squeak node unit test (#1565) 2021-10-11 19:12:26 -07:00
Jonathan Zernik
4ca835b2fb
Replace use_tor field with network in peer address (#1558)
* Replace use_tor field with network in peer address

* Got itest passing with network column in db.

* Got frontend working with network (ipv4 or torv3) configurable

* Fix go to peer address page navigation from sent payment and received payment
2021-10-10 21:00:56 -07:00
Jonathan Zernik
9f6307cbb3
Add rpc to get default peer port (#1556)
* Added get default peer port rpc command

* Use default port in connect peer dialog

* Got default port working on create peer dialog

* Got default port working in both connect peer and create peer.

* Remove default peer usage in create peer backend

* Remove default peer handling for connect peer in backend

* Reset port back to empty when use custom is checked or unchecked.
2021-10-10 00:30:27 -07:00
Jonathan Zernik
12f7b62349
Add toggle for connect with tor (#1550)
* Added use_tor option to peer address class and grpc message

* Got itest passing without tor

* Got peer connection working in UI with tor toggle

* Able to connect to with and without tor

* Got save peer working with tor and without tor

* Add use_tor field to peer address everywhere.

* Fix usage of useMemo in peer address page
2021-10-09 22:26:54 -07:00
Jonathan Zernik
c62dc14d65
Mock out more components in unit test for squeak node (#1505) 2021-10-04 20:52:32 -07:00
Jonathan Zernik
70511ea291
Remove print statements from unit test (#1487) 2021-10-03 19:53:06 -07:00
Jonathan Zernik
24e64fc30b
Mock out db in unit test (#1485)
* Simplify fixtures in squeak node unit test

* Mock out get connection string which creates data dir
2021-10-03 19:49:22 -07:00
Jonathan Zernik
be8ebe7f42
Add config to enable squeak node test to cover everything (#1484)
* Add config to enable squeak node test to cover everything

* Add separate test for webadmin enabled
2021-10-03 16:14:42 -07:00
Jonathan Zernik
4fe0953f43
Got test passing for start stop squeaknode (#1483)
* Got test passing for start stop squeaknode

* Remove print statements from test
2021-10-03 15:24:24 -07:00
Jonathan Zernik
c9b88ffd4a
Send secret key when profile configured to free (#1197)
* Set up itest for sending free secret key

* Got itest working for download and unlock free squeak

* Simplified getting offer or free secret key from controller

* Rename get offer method of controller
2021-09-05 14:38:52 -07:00
Jonathan Zernik
512129b8ec
Implement per address rate limit (#1102)
* Add check for per address rate limit in controller

* Delete rate limiter class

* Add check for interest and rate limit to save received squeak

* Got single squeak download working using temporary interest

* Use polymorphic interest classes for temporary interest manager

* Change order of checking temporary interests before permanent interests

* Used timed dict for temporary interests

* Include check for limit in temporary interest
2021-08-29 06:36:14 -07:00
Jonathan Zernik
620cdae96c
Add license headers (#1080)
* Add pre-commit hook for license headers

* Configure pre-commit hook for license headers only for python

* Add license headers to python files
2021-08-27 18:31:53 -07:00
Jonathan Zernik
dba7c525e9
Rename core config to node config (#1045) 2021-08-24 01:13:24 -07:00
Jonathan Zernik
b9ac4b86b4
Use peer address struct in requests (#1004)
* Update connect peer and disconnect peer rpc to use peer addrss struct

* Update get connected peer rpc to use peer addrss struct

* Use peer address struct in create saved peer rpc

* Use peer address struct in squeak peer struct

* Use peer address for requests functions in frontend

* Update frontend build
2021-08-21 00:54:48 -07:00
Jonathan Zernik
f9197f7035
Remove uploading and downloading fields and add autoconnect field in … (#993)
* Remove uploading and downloading fields and add autoconnect field in all backend code

* Remove uploading and downloading fields and add autoconnect in frontend

* Update frontend build
2021-08-20 15:46:54 -07:00
Jonathan Zernik
4cc617a94c
Refactor network commands into network manager (#949)
* Refactor network commands into network manager

* Start and stop peer server and peer client inside network manager

* Pass handle connection fn to peer handler instead of self object

* Remove old comments
2021-08-15 22:15:42 -07:00
Jonathan Zernik
78b7f9a7f1
Fix default port for create peer command (#905) 2021-08-10 21:29:24 -07:00
Jonathan Zernik
7d266cdf5e
Split peer server client (#901)
* Split peer server and peer client

* Got itest passing

* Catch exception when closing peer socket

* Reconfigure all itests to run
2021-08-10 02:16:46 -07:00
Jonathan Zernik
f652915355
Use tcp peer connection (#900)
* Got basic tcp connection working

* Got passing itest for open tcp connection

* Got most of protocol working. still need to send offer correctly

* Got offer from peer over tcp connectrion

* Got single squeak download working on tcp connection

* Remove rpc peer client

* Remove old rpc clients

* Remove old squeak client modules

* Got sharesqueaks peer message working

* Remove peer rpc server

* Remove server rpc fixtures

* Remove old itests

* Remove old sync modules

* Run worker background task to keep peers synced

* Add peer connection worker

* Add test for disconnect peer

* Remove old itest util

* Delete old peer rpc client helpers.

* Handle insert duplicate received offer

* Use more specific exception handling for duplicate offer insert
2021-07-09 21:07:46 -07:00