Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow per-user settings and store them in database #639

Merged
merged 68 commits into from
Oct 15, 2023
Merged
Show file tree
Hide file tree
Changes from 59 commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
3d5778f
create needed field in sqlite database
Monirzadeh Jul 9, 2023
c574a7e
update account model
Monirzadeh Jul 10, 2023
53314e5
update Account struct for save Account options
Monirzadeh Jul 10, 2023
ab0b922
update sqlite database return account settings
Monirzadeh Jul 10, 2023
c6fdddc
save configure in sqlite as text and return that
Monirzadeh Jul 16, 2023
8d68fb5
read configure from user account and defualt configure for shiori
Monirzadeh Jul 16, 2023
f32dfd8
add api/ui for update settings in database user can save settings in …
Monirzadeh Jul 16, 2023
c106749
check configures be in json format before save in database
Monirzadeh Jul 17, 2023
440a125
support MariaDB
Monirzadeh Jul 17, 2023
b872736
fix wrong comment
Monirzadeh Jul 17, 2023
e950ff4
support PostgreSQL
Monirzadeh Jul 17, 2023
fcaa29b
revert unneeded change in new logic
Monirzadeh Jul 17, 2023
a77fe7e
change configures to config
Monirzadeh Jul 18, 2023
3c2a961
change SaveAccount to SaveAccountSettings
Monirzadeh Jul 18, 2023
741af23
add migrate database scripts
Monirzadeh Jul 18, 2023
353b10b
change default in migration scrtipts
Monirzadeh Jul 19, 2023
dbe0773
update model
Monirzadeh Jul 19, 2023
e7ca00a
read config field as json from database
Monirzadeh Jul 22, 2023
17854a2
fix parse value config value & update config update
Monirzadeh Jul 22, 2023
e215a58
update default value for new user
Monirzadeh Jul 22, 2023
8e8ab72
update settings variable name to reflect database value in UI
Monirzadeh Jul 22, 2023
f0fd7a9
fix typo
Monirzadeh Jul 22, 2023
e880efb
not panic if user not exist and update worng comment
Monirzadeh Jul 22, 2023
463684e
visitor user can update there settings now
Monirzadeh Jul 22, 2023
d4a2449
remove unneeded loading dialog
Monirzadeh Jul 22, 2023
b17a3b3
fix typo
Monirzadeh Jul 22, 2023
75777dd
update function for pg and mysql
Monirzadeh Jul 22, 2023
3e0519e
remove IsJson
Monirzadeh Jul 22, 2023
7a37dcb
move scan method to model
Monirzadeh Jul 22, 2023
5a9bb0b
simplify jsonify
Monirzadeh Jul 22, 2023
039be53
simplify assignees value to account.Config
Monirzadeh Jul 22, 2023
1398279
missing part of function
Monirzadeh Jul 22, 2023
0f4df09
fix some typo and unneeded field in struct
Monirzadeh Jul 23, 2023
c70dd9d
add down migrate script for all database
Monirzadeh Jul 23, 2023
0121f62
change createEbook to CreateEbook
Monirzadeh Jul 23, 2023
e4ec3f2
use json instead of text in mysql and postgres
Monirzadeh Jul 23, 2023
006f52c
implement
Monirzadeh Jul 23, 2023
80a84c3
remove unneeded part
Monirzadeh Jul 23, 2023
26f7232
remove unneeded jsonify in code
Monirzadeh Jul 23, 2023
30f75b3
return SelectContext and GetContext
Monirzadeh Jul 23, 2023
7eba991
remove defualt config in reques for new user it will be set in backend
Monirzadeh Jul 23, 2023
04299a0
merge with master and resolved conflict
Monirzadeh Jul 24, 2023
a06e8a2
New API
Monirzadeh Jul 24, 2023
c108f25
remove legacy API
Monirzadeh Jul 24, 2023
ec72e75
remove validateSessionWithoutOwnerStatus
Monirzadeh Jul 24, 2023
465abde
remove Jsonify function don't need that anymore
Monirzadeh Jul 24, 2023
f6d06b7
add unit test for database
Monirzadeh Jul 24, 2023
567a376
update migrate script name
Monirzadeh Jul 25, 2023
84ab1fc
change put to patch
Monirzadeh Jul 25, 2023
6bdb106
return PUT
Monirzadeh Jul 25, 2023
93d4cd7
fix Patch problem and now use PATCH instead of PUT
Monirzadeh Jul 25, 2023
cb186e7
remove unneeded retuen
Monirzadeh Jul 25, 2023
9c57905
more cleaner code for request new settings
Monirzadeh Jul 26, 2023
34c7426
fix bug to handle string in Scan method thanks to fmartingr
Monirzadeh Jul 26, 2023
5043acb
fix Authorization & use GetAccount & remove username from request
Monirzadeh Aug 1, 2023
0b611ad
shiori-settings remove and it read from shiori-account
Monirzadeh Aug 1, 2023
f9c60e2
add swagger documentation
Monirzadeh Aug 1, 2023
bce2321
API unit test
Monirzadeh Aug 1, 2023
3f60ad5
fix typo
Monirzadeh Aug 1, 2023
f9c91be
remove unneeded coment
Monirzadeh Aug 12, 2023
9f62b1e
better Documentation
Monirzadeh Aug 12, 2023
f6314ae
shiori-toke remove on logout
Monirzadeh Aug 12, 2023
f256392
fix typo
Monirzadeh Aug 12, 2023
8f564cd
add unit test check update config in database
Monirzadeh Aug 14, 2023
4a3b07b
update swag documentation
Monirzadeh Aug 14, 2023
c2572b5
Merge branch 'master' into settings-per-user
Monirzadeh Aug 14, 2023
aa1b558
fix swag formaing error
Monirzadeh Aug 14, 2023
f268858
Merge branch 'master' into settings-per-user
Monirzadeh Oct 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 85 additions & 5 deletions docs/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

90 changes: 85 additions & 5 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,38 @@
"contact": {}
},
"paths": {
"/api/v1/auth/account": {
"patch": {
"produces": [
"application/json"
],
"tags": [
"Auth"
],
"summary": "Get config for the current logged in user and save that in database",
"parameters": [
{
"description": "Config data",
"name": "payload",
"in": "body",
"schema": {
"$ref": "#/definitions/api_v1.settingRequestPayload"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/model.Account"
}
},
"403": {
"description": "Token not provided/invalid"
}
}
}
},
"/api/v1/auth/login": {
"post": {
"consumes": [
Expand All @@ -22,15 +54,15 @@
"name": "payload",
"in": "body",
"schema": {
"$ref": "#/definitions/api.loginRequestPayload"
"$ref": "#/definitions/api_v1.loginRequestPayload"
}
}
],
"responses": {
"200": {
"description": "Login successful",
"schema": {
"$ref": "#/definitions/api.loginResponseMessage"
"$ref": "#/definitions/api_v1.loginResponseMessage"
}
},
"400": {
Expand Down Expand Up @@ -74,7 +106,7 @@
"200": {
"description": "Refresh successful",
"schema": {
"$ref": "#/definitions/api.loginResponseMessage"
"$ref": "#/definitions/api_v1.loginResponseMessage"
}
},
"403": {
Expand Down Expand Up @@ -130,7 +162,7 @@
}
},
"definitions": {
"api.loginRequestPayload": {
"api_v1.loginRequestPayload": {
"type": "object",
"required": [
"password",
Expand All @@ -148,17 +180,36 @@
}
}
},
"api.loginResponseMessage": {
"api_v1.loginResponseMessage": {
"type": "object",
"properties": {
"expires": {
"description": "Deprecated, used only for legacy APIs",
"type": "integer"
},
"session": {
"description": "Deprecated, used only for legacy APIs",
"type": "string"
},
"token": {
"type": "string"
}
}
},
"api_v1.settingRequestPayload": {
"type": "object",
"properties": {
"config": {
"$ref": "#/definitions/model.UserConfig"
}
}
},
"model.Account": {
"type": "object",
"properties": {
"config": {
"$ref": "#/definitions/model.UserConfig"
},
"id": {
"type": "integer"
},
Expand Down Expand Up @@ -186,6 +237,35 @@
"type": "string"
}
}
},
"model.UserConfig": {
"type": "object",
"properties": {
"HideExcerpt": {
"type": "boolean"
},
"HideThumbnail": {
"type": "boolean"
},
"KeepMetadata": {
"type": "boolean"
},
"ListMode": {
"type": "boolean"
},
"MakePublic": {
"type": "boolean"
},
"NightMode": {
"type": "boolean"
},
"ShowId": {
"type": "boolean"
},
"UseArchive": {
"type": "boolean"
}
}
}
}
}
Loading