120 Commits

Author SHA1 Message Date
r1oga
26859c1835 feat: Containerize app (#69)
* Update dockerfiles

* check if docker env

* new line

* remove is-docker dep
2023-01-06 19:03:16 +01:00
r1oga
8f94aed344 chore: lint/format (#72)
* chore: lint/format

* Add validate script

* Update lock files
2023-01-06 17:43:43 +01:00
r1oga
6e40f76c4d chore: use @zkitter/eslint-config and @zkitter/prettier-config (#71)
* Add @zkitter/prettier-config and @zkitter/eslint-config

* Format/lint

* Update lock files

* Update lock files
2022-12-20 17:01:56 +01:00
r1oga
f9e00f3226 fix: add lru cache types stub (#70)
* fix: add lru cache types stub

* update package-lock.json

* skil failing test
2022-12-19 16:09:13 +01:00
tsukino
ab37881734 Auth redux (#67)
* wip

* fix github and twitter oauth

* uncomment code

* integrate with reddit oauth
2022-12-11 17:08:32 +08:00
tsukino
530bf9e036 use passport for twitter (#66) 2022-12-11 09:34:04 +08:00
r1oga
1da948027d chore:refactor: define import aliases (#47)
* chore:refactor: define import aliases

* chore: config eslint (#48)

* define eslint rules

* lint

* include format and lint check in GH workflow

Co-authored-by: tsukino <87639218+0xtsukino@users.noreply.github.com>

* fix: install module-alias

So that tape also knows about aliases

* ignore lint error

* delete left overs files from rebase

* fix: import missing auth model

* rebase

* Include lint check in GH workflow

* chore: fix lint errors

* revert botometer import syntax change

* fix scripts

Co-authored-by: tsukino <87639218+0xtsukino@users.noreply.github.com>
2022-12-10 10:30:32 +08:00
r1oga
762179c9b2 fix: Use pnpm for GitHub workflows (#65)
* fix: Use pnpm for GH workflows too

* fix install step in GH workflow
2022-12-09 13:56:40 +01:00
tsukino
606922d006 uncomment deadlines in gun.ts (#63) 2022-12-09 10:42:03 +08:00
tsukino
c392632fb3 Implement Notification API (#38)
* wip

* wip

* add notification and notification counts for accept, invite, reply, like, and repost

* add notification for mentions

* fix test

* add notifications for chat messages (#51)

* add notifications for chat messages

* update search query to allow multiple search params (#56)

* update search query to allow multiple search params

* fix and test search query's replacement regex (#57)

* fix and test search query's replacement regex

* fix interep http test

Co-authored-by: r1oga <38692952+r1oga@users.noreply.github.com>

* notifification: add table for storing last read timestamp (#62)

* update search query to allow multiple search params

* notifification: add table for storing last read timestamp

* save last read timestamp for zkchat in new table

* uncomment gun

Co-authored-by: r1oga <38692952+r1oga@users.noreply.github.com>

* refactor notification to match new architecture

* update sequelize and fix queries

Co-authored-by: r1oga <38692952+r1oga@users.noreply.github.com>
2022-12-09 09:53:08 +08:00
r1oga
4efacb2b40 refactor: extract routes from http service in separate controllers (#40)
* Move http service to separate folder

* Extract utils and constants

* Do not await sync calls

* Removed unused. Do not use unnecessary local var

* Fix ts warnings

* refactor: extract users route in own controller

* skip failing interep tests

* throw error instead of reject promise in `MainService.get`

* Extract posts routes in own controller

* Fix http test. Don't force EXIT

* Add further routes to Posts and Users controllers

* Extract tags route in own controller

* Extract zkchat routes in own controller

* Extract events route in own controller

* fix: use json parser middleware before add user route

* Extract Interep routes in own controller

* Extract Twitter routes in own controller

* refactor: add json parser as pre middleware to all controllers routes

* Remove unused imports

* Rename methods

* add missing `/post/:hash/retweets` route to posts controller

* Update test messages

* Remove unused import

* fixup! refactor: add json parser as pre middleware to all controllers routes

* fix: do not add `/v1` route prefix to twitter and interep controllers

* refactor: add log/json middleware directly at app rather than controllers level

* remove unnecessary `t.end()`

* fix: use last test to force exiting test process

* rename file

* update test script

* fix: use `epxress-async-errors` to catch async errors instead of `wrapHandler`

* add getGroups handler to Users controller

* extract merkle routes in own Controller

* extract static routes in own router/controller

* refactor `http.start`

* chore: order imports

* extract remaining routes in misc controller

* remove initControllers method

* Define SESSION_OPTIONS. Rename constants. Add `ms` dep

* remove console log

* rebase: add search posts endpoint to Posts Controller

* feat: use passport for github, reddit, twitter auth (#54)

* Define `Passport` service

* Define `GithubController`

* aggregate stars received by gh user

* rename `plan` to `proPlan`

* remove passport service

* get receivedStars/proPlan when authenticating

* remove console.logs

* calculate github interep reputation score in passport verify callback

* add types to passport verify cb

* gh auth callback redirects to `redirectUrl`

`redirectUrl` being the query param provided by the client

* remove import

* add types to github util

* fix redirect

* fix: do not reuse authenticate middleware on session endpoint

* fix include provider name in serialized user

* extract github session endpoint in Misc controller

* upsert GH accessToken in DB when authenticating

* can join a gh interep group

* ignore ts missing req.user.userId error

* fix test

* can logout

* chore: update .tool-versions, add pnpm-lock.yaml

* refactor use GitHub personal access token from config

* refactor: add token from db when deserializing

* refactor: extract /logout to Misc Controller

* add passport-witter-oauth2 dep

* add tw oauth config param

* refactor: define common Auth controller and DB

* update package-lock.json

* update config.test.json

* fix test

* uncomment twitter controller

* move session and logout endpoint to AuthController

* add reddit auth

* replace passport-reddit by @r1oga/passport-reddit

* can auth with reddit

* calculate reddit interep reputation on auth

* fix twitter auth scopes

* calculate twitter interep reputation

* refactor

* update config sample

* update package-lock.json

* cleanup: remove GitHub controller

* cleanup: remove githubAuth model

* refactor Auth controller

* catch and log error in passport verify callback

Co-authored-by: tsukino <87639218+0xtsukino@users.noreply.github.com>
2022-12-09 05:28:15 +08:00
r1oga
bfa24bde0c fix twitter POST request_token request param (#44)
Co-authored-by: tsukino <87639218+0xtsukino@users.noreply.github.com>
2022-12-09 05:27:38 +08:00
r1oga
1782812e4e feat: monitor security vulnerabilities with snyk GH workflow (#61) 2022-12-07 09:53:43 +01:00
r1oga
48965e9fc2 feat: use postgres tsquery to search by posts' text content (#36)
* fix db unit tests

Use cloud postgres DB instead of sqlite

* refactor: parallelize async calls

* chore: remove use of `test.db`

* chore: newline

* do not create new db connection, use cached Sequelize instance

* fix:test: force exit at end of DbService tests

* chore: use heroku postgres instance instead of elephantsql for testing

Heroku provides postgres 14.5.
elephantsql has only postgres 11.12

* fix db unit test

* remove unused (redeclared) `parse` function

* test: vectorize `posts.content` column (`tsvector`)

* chore: add `lastArbitrumBlock` config parameter

* feat: add new search endpoint that uses `tsquery`

* fix db unit test

* fix http unit test

* fix db unit test
2022-11-23 09:48:11 +08:00
r1oga
84606307f8 chore: use clean install without husky in GH action (#46) 2022-11-08 23:58:03 +01:00
r1oga
fedf416973 Update test DB details (#45) 2022-11-08 14:06:25 +01:00
r1oga
51de2f5498 chore: use cache in build-test GH workflow (#41)
* chore: Cache node deps in GH build-test workflow

* Bump actions versions
2022-11-04 16:02:53 +01:00
tsukino
22dc4113b3 fix: de-duplicate group member list (#39)
* fix: de-duplicate group member list

* uncomment
2022-11-04 02:41:43 +08:00
r1oga
f05391ac57 test:fix: use remote postgres db for tests and fix GH test workflow (#32)
* fix db unit tests

Use cloud postgres DB instead of sqlite

* refactor: parallelize async calls

* test: force resync in test scripts

To flush tables

* chore: remove use of `test.db`

* chore: newline

* fix: skip failing tests

* remove use of `getMockDB`

* skip process.exit

* do not create new db connection, use cached Sequelize instance

* fix:test: force exit at end of DbService tests

* run `npm run test` in GH test action

`npm run test:coverage` would always fail (we don't meet the coverage threshold)

* chore: use heroku postgres instance instead of elephantsql for testing

Heroku provides postgres 14.5.
elephantsql has only postgres 11.12

* fix db unit test

* remove unused (redeclared) `parse` function

Co-authored-by: tsukino <87639218+0xtsukino@users.noreply.github.com>
2022-11-04 02:38:40 +08:00
AtHeartEngineer
28a72cb622 Refactor name and links (#35) 2022-11-04 02:02:55 +08:00
r1oga
c74a746291 feat:test: get list of retweets (#31) 2022-10-27 02:13:04 +08:00
r1oga
30824fd6af chore: add .tool-versions (asdf) 2022-10-24 17:13:57 +02:00
r1oga
5f27de7abb feat: get likes/followers/followings (#23)
* feat:test: get likes/followers/followings

* fix typo
2022-10-21 02:13:32 +08:00
r1oga
8aaa70c560 chore: format 2022-10-20 13:24:56 +02:00
r1oga
cb2b6f6923 chore: format 2022-10-20 13:19:27 +02:00
r1oga
3b96c782d7 chore: format (#22)
* chore: add prettify pre commit hook

* chore: format
2022-10-20 13:15:17 +02:00
r1oga
c7f8ff3682 chore: bump libs, fix gh test action (#8)
* chore: bump webpack to `>5`

* fix: remove `inline` webpack cli option

Enabled by default since `v5`

* fix: set default env var values for environment plugin

To avoid raising undefined errors
Breaking change im v5
See  https://webpack.js.org/plugins/environment-plugin/#usage

* fix: rename `loaders` to `rules`

Breaking change in webpack v5

* chore: match 16.x (lts) node versions in GH build and test action

* chore: update `package-lock.json`

* chore: restrict node engine to `">=16 <17"`

* chore: update package-lock.json

* chore: npm audit fix

* chore: fix test GH action step (#1)

* chore: do not `useUnknownInCatchVariables`

* chore: define `goerliHttpProvider` in `config.test.json`

* remove unused constant

* fix db unit test (wrong extra arg)
2022-10-20 12:30:26 +08:00
r1oga
96504609cd refactor: do not await synchronous functions (db service start) (#11) 2022-10-19 12:48:40 +08:00
r1oga
b6329fc02e chore: add opened issues to GH project, link issues to PRs (#12)
* add-to-project

* issue-link

* # set minimum required permissions for automatic `GITHUB_TOKEN` token
2022-10-19 12:46:40 +08:00
tsukino
ec8154d5a5 fix: return correct proofs based on proof type (#20) 2022-10-19 12:40:11 +08:00
tsukino
15ac682aa9 implement custom group logic (#14) 2022-10-13 23:14:34 +08:00
0xtsukino
3049e46cd1 fix zkpr 2022-10-11 15:36:15 -05:00
tsukino
412f6107b8 update group id (#15) 2022-10-12 02:25:03 +08:00
r1oga
544ac261f4 chore: config prettier and format code (#9)
* chore: config prettier

* chore: format
2022-09-28 15:27:04 +08:00
r1oga
22d9d848a3 doc:chore: add web3StorageAPIKey to config.sample.json (#6)
* chore: add `web3StorageAPIkey` to config sample

* chore: new line
2022-09-27 15:24:09 +08:00
0xtsukino
86dd6d7cbd fix sequelize version 2022-09-26 23:26:45 -07:00
0xtsukino
29e088079e add back watch user 2022-09-26 23:03:10 -07:00
tsukino
55bd3bce65 Add TAZ Integration (#7)
* integrating with taz

* verify semaphore zkchat message
2022-09-27 13:36:37 +08:00
0xtsukino
bc4adf6e97 add docs for zkchat 2022-08-06 18:58:30 -07:00
0xtsukino
e4558e1e88 fix unit test 2022-08-05 16:59:30 -07:00
0xtsukino
15dc2cc8d8 increase max length for chat message 2022-08-04 16:20:39 -07:00
0xtsukino
fd5c13e536 only sync interrep 2022-08-03 19:29:36 -07:00
0xtsukino
2861e91b18 fixed gundb version 2022-08-03 19:24:13 -07:00
0xtsukino
bfec212b84 fix interrep onboarding 2022-08-03 18:14:57 -07:00
0xtsukino
dc4037ae51 find proof even wehn group is not specified 2022-08-03 13:02:40 -07:00
0xtsukino
57652095a8 fix queries 2022-08-03 04:21:08 -07:00
0xtsukino
3ee934d909 update query 2022-08-03 04:15:12 -07:00
0xtsukino
fbc8b3c3fd add gun libs 2022-08-03 03:43:32 -07:00
0xtsukino
1fd8b9cba3 change path 2022-08-03 03:34:42 -07:00
tsukino
9464f7cab6 implement zkchat and ipfs integration; update app to use rln proofs (#5)
* add ipfs upload

* add user auth for upload

* insert upload data to postgres

* limit upload to 100mb per user

* wip

* add zkchat endpoint

* update schema

* wip

* add group info

* remove log

* fix semaphore signal hash

* allow file upload for zk post

* udpating interep service

* return zk group type

* verify rln proof

* add server sent event
2022-08-03 17:33:36 +08:00