readme update, code uncomment

This commit is contained in:
mrfry 2023-04-27 16:36:54 +02:00
parent 88423719e5
commit 6d02af2fe1
2 changed files with 19 additions and 8 deletions

View file

@ -113,6 +113,17 @@ the public key.
To start syncing user \#1 should perform a get request to `/syncp2pdata`. Received new questions are To start syncing user \#1 should perform a get request to `/syncp2pdata`. Received new questions are
automatically sent to registered peers. automatically sent to registered peers.
`/syncp2pdata` accepts a few query parameters:
| Name | Type | Description |
| --- | --- | --- |
| allTime | boolean | If it should ignore the last sync date, and get all data |
| users | boolean | If it should sync users |
| questions | boolean | If it should sync questions |
If `users` and `questions` are all missing, then everything will be synced. The last sync date is
stored separately for them.
If the peer doesn't have a https server (only http) then `http: true` should be specified in If the peer doesn't have a https server (only http) then `http: true` should be specified in
`peers.json` `peers.json`

View file

@ -1338,15 +1338,15 @@ function setup(data: SubmoduleData): Submodule {
const questions = !!req.query.questions const questions = !!req.query.questions
const users = !!req.query.users const users = !!req.query.users
const allTime = !!req.query.allTime const allTime = !!req.query.allTime
// const user = req.session.user const user = req.session.user
// if (!user || user.id !== 1) { if (!user || user.id !== 1) {
// res.json({ res.json({
// status: 'error', status: 'error',
// message: 'only user 1 can call this EP', message: 'only user 1 can call this EP',
// }) })
// return return
// } }
// FIXME: /syncResult EP if this EP times out, but we still need the result // FIXME: /syncResult EP if this EP times out, but we still need the result
if (syncInProgress) { if (syncInProgress) {