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

[Frontend Migration]: Add API endpoint /api/config/application/ #718

Open
MerlinScheurer opened this issue May 19, 2024 · 5 comments
Open
Labels
backend react migration Tracking our new React based frontend

Comments

@MerlinScheurer
Copy link
Collaborator

MerlinScheurer commented May 19, 2024

Domain

Backend

Description

Is your feature request related to a problem? Please describe.

Data for the page /settings/application/ is missing in the api endpoints.

Describe the solution you'd like

The Api endpoint /api/config/application/ has been implemented simmilar to /api/config/user/

Additional context

/api/config/application/ ( POST, GET )

GET response body & POST body:

{
 "api_token": "<token>",
 "subscriptions": {
   "channel_size": 69,
   "live_channel_size": 69,
   "shorts_channel_size": 69,
   "auto_start": false
 },
 "downloads": {
   "limit_speed": false,
   "sleep_interval": 3,
   "autodelete_days": false,
   "format": false,
   "format_sort": false,
   "add_metadata": false,
   "add_thumbnail": false,
   "subtitle": false,
   "subtitle_source": false,
   "subtitle_index": false,
   "comment_max": false,
   "comment_sort": "top",
   "cookie_import": false,
   "throttledratelimit": false,
   "extractor_lang": false,
   "integrate_ryd": false,
   "integrate_sponsorblock": false
 },
 "application": {
   "enable_snapshot": true
 }
}
@bbilly1 bbilly1 added react migration Tracking our new React based frontend and removed react migration Tracking our new React based frontend labels May 19, 2024
@bbilly1 bbilly1 changed the title [Feature Request]: API endpoint /api/config/application/ [Frontend Migration]: API endpoint /api/config/application/ May 19, 2024
@MerlinScheurer MerlinScheurer changed the title [Frontend Migration]: API endpoint /api/config/application/ [Frontend Migration]: Add API endpoint /api/config/application/ May 19, 2024
@bbilly1
Copy link
Member

bbilly1 commented Aug 3, 2024

Implemented at: /api/appsettings/config/, for details see doc string:

def post(request):
"""
update config values
data object where key is flatted CONFIG_DEFAULTS separated by '.', e.g.
{"subscriptions.channel_size": 5, "subscriptions.live_channel_size": 5}
"""

@MerlinScheurer
Copy link
Collaborator Author

MerlinScheurer commented Aug 4, 2024

What about the api_token for the browser extension?

And why are the keys flattened?

bbilly1 added a commit that referenced this issue Aug 10, 2024
@MerlinScheurer
Copy link
Collaborator Author

Updating the user config seems to fail silently now.
( POST, /api/user/me/ )

tubearchivist    | {"_index":"ta_config","_id":"appsettings","found":false}
tubearchivist    | {"error":{"root_cause":[{"type":"parsing_exception","reason":"[_na] query malformed, must start with start_object","line":1,"col":34}],"type":"x_content_parse_exception","reason":"[1:34] [bool] failed to parse field [must]","caused_by":{"type":"parsing_exception","reason":"[_na] query malformed, must start with start_object","line":1,"col":34}},"status":400}
tubearchivist    | {'error': {'root_cause': [{'type': 'parsing_exception', 'reason': '[_na] query malformed, must start with start_object', 'line': 1, 'col': 34}], 'type': 'x_content_parse_exception', 'reason': '[1:34] [bool] failed to parse field [must]', 'caused_by': {'type': 'parsing_exception', 'reason': '[_na] query malformed, must start with start_object', 'line': 1, 'col': 34}}, 'status': 400}

@bbilly1
Copy link
Member

bbilly1 commented Aug 23, 2024

updating user config through POST /api/user/me/ works fine for me on latest commit from refactor-react-migration branch. Maybe your migrations didn't run correctly in the backend? e.g. python manage.py ta_startup.

@MerlinScheurer
Copy link
Collaborator Author

Hmm, yeah it works, but the exception is still thrown 😅
( even after nuking all docker volumes and applying the migration in a running container )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend react migration Tracking our new React based frontend
Projects
Status: No status
Development

No branches or pull requests

2 participants