diff options
author | nico <nico@magicbroccoli.de> | 2020-04-18 23:47:15 +0200 |
---|---|---|
committer | nico <nico@magicbroccoli.de> | 2020-04-18 23:47:15 +0200 |
commit | 36cf666a0c8ea32c702338e2931dc109859269a7 (patch) | |
tree | 7a9b3bfd89e29120c520c5f2fa37a250716de973 /static |
Initial release JoplinWebApi
Joplin WebAPI to manage Joplin users and the directory structure
+ add user creation endpoint
+ add user deletion endpoint
+ add user password change endpoint
+ add README and highlight css
+ add gitignore file
+ add uwsgi template file
Diffstat (limited to 'static')
-rw-r--r-- | static/Readme.md | 85 | ||||
-rw-r--r-- | static/hilite.css | 69 | ||||
-rw-r--r-- | static/joplinapi.uwsgi.ini | 20 |
3 files changed, 174 insertions, 0 deletions
diff --git a/static/Readme.md b/static/Readme.md new file mode 100644 index 0000000..3be39cb --- /dev/null +++ b/static/Readme.md @@ -0,0 +1,85 @@ +# Joplin UserManagement WebApi +## How To +The Joplin UserManagement WebApi utilizes [url encoded](https://en.wikipedia.org/wiki/Percent-encoding) parameter to manage the Joplin userbase. + +## create new user +**Definition** + +`POST /joplin/<string:username>/create` + +**Arguments** + +- `"password":string` user password +- `"invite-code":string` invite code to create an account +```json +{ + "password": "password", + "invite-code": "invite" +} +``` + +**Response** + +- `201 Created` user creation succeeded +- `409 Conflict` user creation failed due to a conflict +- `422 Unprocessable Entity` one or more parameter/s were not given +- `500 Internal Server Error` user directory creation failure + +**Example** +```bash +curl --data "password=super_secret&invite-code=nachos" https://domain.tld/joplin/jim/create +``` +--- + +## update user password +**Definition** + +`POST /joplin/<string:username>/changepw` + +**Arguments** + +- `"password": string` current user password +- `"new_password": string` new user password +```json +{ + "password": "password", + "new_password": "new_password" +} +``` + +**Response** + +- `200 OK` password change succeeded +- `401 Unauthorized` the request was not authorized +- `422 Unprocessable Entity` one or more parameter/s were not given + +**Example** +```bash +curl --data "password=super_secret&new_password=5up3r_53cr37" https://domain.tld/joplin/jim/changepw +``` +--- + +## delete user account +**Definition** + +`DELETE /joplin/<string:username>` + +**Arguments** + +- `"password": string` users password +```json +{ + "password": "password" +} +``` + +**Response** + +- `204 No Content` user deletion succeeded +- `401 Unauthorized` the request was not authorized +- `422 Unprocessable Entity` one or more parameter/s were not given + +**Example** +```bash +curl -X DELETE --data "password=super_secret" https://domain.tld/joplin/jim +``` diff --git a/static/hilite.css b/static/hilite.css new file mode 100644 index 0000000..5acc1f9 --- /dev/null +++ b/static/hilite.css @@ -0,0 +1,69 @@ +.codehilite .hll { background-color: #ffffcc } +.codehilite { background: #f8f8f8; } +.codehilite .c { color: #008800; font-style: italic } /* Comment */ +.codehilite .err { border: 1px solid #FF0000 } /* Error */ +.codehilite .k { color: #AA22FF; font-weight: bold } /* Keyword */ +.codehilite .o { color: #666666 } /* Operator */ +.codehilite .ch { color: #008800; font-style: italic } /* Comment.Hashbang */ +.codehilite .cm { color: #008800; font-style: italic } /* Comment.Multiline */ +.codehilite .cp { color: #008800 } /* Comment.Preproc */ +.codehilite .cpf { color: #008800; font-style: italic } /* Comment.PreprocFile */ +.codehilite .c1 { color: #008800; font-style: italic } /* Comment.Single */ +.codehilite .cs { color: #008800; font-weight: bold } /* Comment.Special */ +.codehilite .gd { color: #A00000 } /* Generic.Deleted */ +.codehilite .ge { font-style: italic } /* Generic.Emph */ +.codehilite .gr { color: #FF0000 } /* Generic.Error */ +.codehilite .gh { color: #000080; font-weight: bold } /* Generic.Heading */ +.codehilite .gi { color: #00A000 } /* Generic.Inserted */ +.codehilite .go { color: #888888 } /* Generic.Output */ +.codehilite .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ +.codehilite .gs { font-weight: bold } /* Generic.Strong */ +.codehilite .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.codehilite .gt { color: #0044DD } /* Generic.Traceback */ +.codehilite .kc { color: #AA22FF; font-weight: bold } /* Keyword.Constant */ +.codehilite .kd { color: #AA22FF; font-weight: bold } /* Keyword.Declaration */ +.codehilite .kn { color: #AA22FF; font-weight: bold } /* Keyword.Namespace */ +.codehilite .kp { color: #AA22FF } /* Keyword.Pseudo */ +.codehilite .kr { color: #AA22FF; font-weight: bold } /* Keyword.Reserved */ +.codehilite .kt { color: #00BB00; font-weight: bold } /* Keyword.Type */ +.codehilite .m { color: #666666 } /* Literal.Number */ +.codehilite .s { color: #BB4444 } /* Literal.String */ +.codehilite .na { color: #BB4444 } /* Name.Attribute */ +.codehilite .nb { color: #AA22FF } /* Name.Builtin */ +.codehilite .nc { color: #0000FF } /* Name.Class */ +.codehilite .no { color: #880000 } /* Name.Constant */ +.codehilite .nd { color: #AA22FF } /* Name.Decorator */ +.codehilite .ni { color: #999999; font-weight: bold } /* Name.Entity */ +.codehilite .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ +.codehilite .nf { color: #00A000 } /* Name.Function */ +.codehilite .nl { color: #A0A000 } /* Name.Label */ +.codehilite .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ +.codehilite .nt { color: #008000; font-weight: bold } /* Name.Tag */ +.codehilite .nv { color: #B8860B } /* Name.Variable */ +.codehilite .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ +.codehilite .w { color: #bbbbbb } /* Text.Whitespace */ +.codehilite .mb { color: #666666 } /* Literal.Number.Bin */ +.codehilite .mf { color: #666666 } /* Literal.Number.Float */ +.codehilite .mh { color: #666666 } /* Literal.Number.Hex */ +.codehilite .mi { color: #666666 } /* Literal.Number.Integer */ +.codehilite .mo { color: #666666 } /* Literal.Number.Oct */ +.codehilite .sa { color: #BB4444 } /* Literal.String.Affix */ +.codehilite .sb { color: #BB4444 } /* Literal.String.Backtick */ +.codehilite .sc { color: #BB4444 } /* Literal.String.Char */ +.codehilite .dl { color: #BB4444 } /* Literal.String.Delimiter */ +.codehilite .sd { color: #BB4444; font-style: italic } /* Literal.String.Doc */ +.codehilite .s2 { color: #BB4444 } /* Literal.String.Double */ +.codehilite .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ +.codehilite .sh { color: #BB4444 } /* Literal.String.Heredoc */ +.codehilite .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ +.codehilite .sx { color: #008000 } /* Literal.String.Other */ +.codehilite .sr { color: #BB6688 } /* Literal.String.Regex */ +.codehilite .s1 { color: #BB4444 } /* Literal.String.Single */ +.codehilite .ss { color: #B8860B } /* Literal.String.Symbol */ +.codehilite .bp { color: #AA22FF } /* Name.Builtin.Pseudo */ +.codehilite .fm { color: #00A000 } /* Name.Function.Magic */ +.codehilite .vc { color: #B8860B } /* Name.Variable.Class */ +.codehilite .vg { color: #B8860B } /* Name.Variable.Global */ +.codehilite .vi { color: #B8860B } /* Name.Variable.Instance */ +.codehilite .vm { color: #B8860B } /* Name.Variable.Magic */ +.codehilite .il { color: #666666 } /* Literal.Number.Integer.Long */
\ No newline at end of file diff --git a/static/joplinapi.uwsgi.ini b/static/joplinapi.uwsgi.ini new file mode 100644 index 0000000..84f3128 --- /dev/null +++ b/static/joplinapi.uwsgi.ini @@ -0,0 +1,20 @@ +[uwsgi] +master = true +project = JoplinWebApi +base = /var/www + +chdir = %(base)/%(project) +home = %(base)/%(project)/venv +module = joplinapi:app +plugins = python3 +manage-script-name = true + +processes = 3 +uid = www-data +gid = www-data +logto = /var/log/uwsgi/app/%(project).log +logformat = '%(addr) - %(host) ["%(ltime)"] "%(method) %(uri)" "%(status)" "%(cl)" "%(referrer)" rt="%(time)" ut="%(secs)' + +vacuum = true +die-on-term = true +touch-reload = %(chdir)/reload.file |