Make vital keys inmutable + changed API documentation
This commit is contained in:
parent
18419916ca
commit
6b04874e4e
30
README.md
30
README.md
|
@ -145,11 +145,41 @@ curl 127.0.0.1:8080/<username>/update`
|
|||
curl '127.0.0.1:8080/*/update'`
|
||||
```
|
||||
|
||||
**Configure parameters** of the Pixelfed account (on local mirror file-based DB)
|
||||
|
||||
```bash
|
||||
# Get the value of a parameter (except: password, cookie)
|
||||
curl 127.0.0.1:8080/<username>/cfg/var1
|
||||
|
||||
# Set the value of a parameter
|
||||
# this keys are inmutable: name, username, password, cookie
|
||||
curl 127.0.0.1:8080/<username>/cfg/var1?valueyouwant
|
||||
|
||||
|
||||
# CONFIGURABLE PARAMETERS:
|
||||
|
||||
# ------------------
|
||||
# "sched" key sets a weight schedule so you can make an account update less often.
|
||||
#
|
||||
# For example: if you set the value to "3", only 1 times out of 3 (counted) will actually update the account
|
||||
# "sched_now" is an automatic variable that counts the current status (used when "sched" is set).
|
||||
#
|
||||
# This will skip the account on wildcard or single /update action, until the count hits it's max value ("sched")
|
||||
# As in the example above (sched = 3), you would set this value like this:
|
||||
|
||||
curl 127.0.0.1:8080/<username>/cfg/sched?3
|
||||
# ------------------
|
||||
|
||||
|
||||
```
|
||||
|
||||
**Log in or log out** the account from Pixelfed.
|
||||
|
||||
```bash
|
||||
curl 127.0.0.1:8080/<username>/login
|
||||
curl '127.0.0.1:8080/*/login'
|
||||
curl 127.0.0.1:8080/<username>/logout
|
||||
curl '127.0.0.1:8080/*/logout'
|
||||
```
|
||||
In case of repeated posts or disaster, **prune/nuke all Pixelfed posts** from the given account.
|
||||
|
||||
|
|
|
@ -604,6 +604,10 @@ def account_config(acc_id, key, value):
|
|||
return False, 'Key does not exist yet: {}'.format(key)
|
||||
return True, accdata[key]
|
||||
|
||||
# protect inmutable keys
|
||||
if key in ['name', 'username', 'password', 'cookie']:
|
||||
return False, 'The given key is inmutable: {}'.format(key)
|
||||
|
||||
# value has something, so we set it
|
||||
accdata[key] = value
|
||||
db_set('accounts', acc_id, accdata)
|
||||
|
|
Loading…
Reference in New Issue