mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-20 17:23:20 +03:00
Move user schemas so they can be imported
This commit is contained in:
@@ -695,35 +695,13 @@ paths:
|
|||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
type: object
|
$ref: '#/components/schemas/LoginResponse'
|
||||||
properties:
|
|
||||||
user:
|
|
||||||
$ref: '#/components/schemas/User'
|
|
||||||
token:
|
|
||||||
type: string
|
|
||||||
permissions:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
type: string
|
|
||||||
available_permissions:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
type: string
|
|
||||||
description: Use this method to log into a user using their username and password and receive a jwt auth token so you can send per-user requests.
|
description: Use this method to log into a user using their username and password and receive a jwt auth token so you can send per-user requests.
|
||||||
requestBody:
|
requestBody:
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
type: object
|
$ref: '#/components/schemas/LoginRequest'
|
||||||
properties:
|
|
||||||
userid:
|
|
||||||
type: string
|
|
||||||
description: 'This is the username, not the user uid'
|
|
||||||
password:
|
|
||||||
type: string
|
|
||||||
required:
|
|
||||||
- userid
|
|
||||||
- password
|
|
||||||
security:
|
security:
|
||||||
- Auth query parameter: []
|
- Auth query parameter: []
|
||||||
tags:
|
tags:
|
||||||
@@ -738,27 +716,13 @@ paths:
|
|||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
type: object
|
$ref: '#/components/schemas/RegisterResponse'
|
||||||
properties:
|
|
||||||
user:
|
|
||||||
$ref: '#/components/schemas/User'
|
|
||||||
description: Use this endpoint to register a user. It will only work if registration is enabled.
|
description: Use this endpoint to register a user. It will only work if registration is enabled.
|
||||||
requestBody:
|
requestBody:
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
type: object
|
$ref: '#/components/schemas/RegisterRequest'
|
||||||
properties:
|
|
||||||
userid:
|
|
||||||
type: string
|
|
||||||
username:
|
|
||||||
type: string
|
|
||||||
password:
|
|
||||||
type: string
|
|
||||||
required:
|
|
||||||
- userid
|
|
||||||
- username
|
|
||||||
- password
|
|
||||||
security:
|
security:
|
||||||
- Auth query parameter: []
|
- Auth query parameter: []
|
||||||
tags:
|
tags:
|
||||||
@@ -778,21 +742,7 @@ paths:
|
|||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
type: object
|
$ref: '#/components/schemas/UpdateUserRequest'
|
||||||
properties:
|
|
||||||
change_object:
|
|
||||||
required:
|
|
||||||
- uid
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
uid:
|
|
||||||
type: string
|
|
||||||
name:
|
|
||||||
type: string
|
|
||||||
role:
|
|
||||||
type: string
|
|
||||||
required:
|
|
||||||
- change_object
|
|
||||||
description: Updates certain properties for a user. Only two are possible right now.
|
description: Updates certain properties for a user. Only two are possible right now.
|
||||||
security:
|
security:
|
||||||
- Auth query parameter: []
|
- Auth query parameter: []
|
||||||
@@ -814,12 +764,7 @@ paths:
|
|||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
type: object
|
$ref: '#/components/schemas/DeleteUserRequest'
|
||||||
properties:
|
|
||||||
uid:
|
|
||||||
type: string
|
|
||||||
required:
|
|
||||||
- uid
|
|
||||||
security:
|
security:
|
||||||
- Auth query parameter: []
|
- Auth query parameter: []
|
||||||
tags:
|
tags:
|
||||||
@@ -834,25 +779,7 @@ paths:
|
|||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
type: object
|
$ref: '#/components/schemas/GetRolesResponse'
|
||||||
properties:
|
|
||||||
roles:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
admin:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
permissions:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
$ref: '#/components/schemas/UserPermission'
|
|
||||||
user:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
permissions:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
$ref: '#/components/schemas/UserPermission'
|
|
||||||
description: Gets the available roles and their permissions
|
description: Gets the available roles and their permissions
|
||||||
security:
|
security:
|
||||||
- Auth query parameter: []
|
- Auth query parameter: []
|
||||||
@@ -910,12 +837,7 @@ paths:
|
|||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
type: object
|
$ref: '#/components/schemas/GetUsersResponse'
|
||||||
properties:
|
|
||||||
users:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
$ref: '#/components/schemas/User'
|
|
||||||
description: 'Gets all users, returns a list of the user objects including their user permissions, videos, playlists, subscriptions, etc.'
|
description: 'Gets all users, returns a list of the user objects including their user permissions, videos, playlists, subscriptions, etc.'
|
||||||
security:
|
security:
|
||||||
- Auth query parameter: []
|
- Auth query parameter: []
|
||||||
@@ -1695,6 +1617,103 @@ components:
|
|||||||
properties:
|
properties:
|
||||||
id:
|
id:
|
||||||
type: string
|
type: string
|
||||||
|
RegisterRequest:
|
||||||
|
required:
|
||||||
|
- userid
|
||||||
|
- username
|
||||||
|
- password
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
userid:
|
||||||
|
type: string
|
||||||
|
username:
|
||||||
|
type: string
|
||||||
|
password:
|
||||||
|
type: string
|
||||||
|
RegisterResponse:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
user:
|
||||||
|
$ref: '#/components/schemas/User'
|
||||||
|
LoginRequest:
|
||||||
|
required:
|
||||||
|
- username
|
||||||
|
- password
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
username:
|
||||||
|
type: string
|
||||||
|
password:
|
||||||
|
type: string
|
||||||
|
LoginResponse:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
user:
|
||||||
|
$ref: '#/components/schemas/User'
|
||||||
|
token:
|
||||||
|
type: string
|
||||||
|
permissions:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/UserPermission'
|
||||||
|
available_permissions:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/UserPermission'
|
||||||
|
UpdateUserRequest:
|
||||||
|
required:
|
||||||
|
- change_object
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
change_object:
|
||||||
|
required:
|
||||||
|
- uid
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
uid:
|
||||||
|
type: string
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
role:
|
||||||
|
type: string
|
||||||
|
DeleteUserRequest:
|
||||||
|
required:
|
||||||
|
- uid
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
uid:
|
||||||
|
type: string
|
||||||
|
GetUsersResponse:
|
||||||
|
required:
|
||||||
|
- users
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
users:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/User'
|
||||||
|
GetRolesResponse:
|
||||||
|
required:
|
||||||
|
- roles
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
roles:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
admin:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
permissions:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/UserPermission'
|
||||||
|
user:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
permissions:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/UserPermission'
|
||||||
securitySchemes:
|
securitySchemes:
|
||||||
Auth query parameter:
|
Auth query parameter:
|
||||||
name: apiKey
|
name: apiKey
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import type {
|
|||||||
DeleteMp3Mp4Request,
|
DeleteMp3Mp4Request,
|
||||||
DeletePlaylistRequest,
|
DeletePlaylistRequest,
|
||||||
DeleteSubscriptionFileRequest,
|
DeleteSubscriptionFileRequest,
|
||||||
|
DeleteUserRequest,
|
||||||
DownloadArchiveRequest,
|
DownloadArchiveRequest,
|
||||||
DownloadFileRequest,
|
DownloadFileRequest,
|
||||||
FileType,
|
FileType,
|
||||||
@@ -34,13 +35,19 @@ import type {
|
|||||||
GetMp4sResponse,
|
GetMp4sResponse,
|
||||||
GetPlaylistRequest,
|
GetPlaylistRequest,
|
||||||
GetPlaylistResponse,
|
GetPlaylistResponse,
|
||||||
|
GetRolesResponse,
|
||||||
GetSubscriptionRequest,
|
GetSubscriptionRequest,
|
||||||
GetSubscriptionResponse,
|
GetSubscriptionResponse,
|
||||||
|
GetUsersResponse,
|
||||||
|
LoginRequest,
|
||||||
|
LoginResponse,
|
||||||
Mp3DownloadRequest,
|
Mp3DownloadRequest,
|
||||||
Mp3DownloadResponse,
|
Mp3DownloadResponse,
|
||||||
Mp4DownloadRequest,
|
Mp4DownloadRequest,
|
||||||
Mp4DownloadResponse,
|
Mp4DownloadResponse,
|
||||||
Playlist,
|
Playlist,
|
||||||
|
RegisterRequest,
|
||||||
|
RegisterResponse,
|
||||||
SetConfigRequest,
|
SetConfigRequest,
|
||||||
SharingToggle,
|
SharingToggle,
|
||||||
SubscribeRequest,
|
SubscribeRequest,
|
||||||
@@ -53,6 +60,7 @@ import type {
|
|||||||
UpdatePlaylistFilesRequest,
|
UpdatePlaylistFilesRequest,
|
||||||
UpdatePlaylistRequest,
|
UpdatePlaylistRequest,
|
||||||
UpdateServerRequest,
|
UpdateServerRequest,
|
||||||
|
UpdateUserRequest,
|
||||||
UserPermission,
|
UserPermission,
|
||||||
YesNo,
|
YesNo,
|
||||||
} from '../api-types';
|
} from '../api-types';
|
||||||
@@ -444,9 +452,9 @@ export class PostsService implements CanActivate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// user methods
|
// user methods
|
||||||
login(username, password) {
|
login(username: string, password: string) {
|
||||||
const call = this.http.post(this.path + 'auth/login', {username: username, password: password}, this.httpOptions);
|
const body: LoginRequest = {username: username, password: password};
|
||||||
return call;
|
return this.http.post<LoginResponse>(this.path + 'auth/login', body, this.httpOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
// user methods
|
// user methods
|
||||||
@@ -481,10 +489,11 @@ export class PostsService implements CanActivate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// user methods
|
// user methods
|
||||||
register(username, password) {
|
register(username: string, password: string) {
|
||||||
const call = this.http.post(this.path + 'auth/register', {userid: username,
|
const body: RegisterRequest = {userid: username,
|
||||||
username: username,
|
username: username,
|
||||||
password: password}, this.httpOptions);
|
password: password}
|
||||||
|
const call = this.http.post<RegisterResponse>(this.path + 'auth/register', body, this.httpOptions);
|
||||||
return call;
|
return call;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -529,10 +538,11 @@ export class PostsService implements CanActivate {
|
|||||||
return this.http.post(this.path + 'auth/adminExists', {}, this.httpOptions);
|
return this.http.post(this.path + 'auth/adminExists', {}, this.httpOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
createAdminAccount(password) {
|
createAdminAccount(password: string) {
|
||||||
return this.http.post(this.path + 'auth/register', {userid: 'admin',
|
const body: RegisterRequest = {userid: 'admin',
|
||||||
username: 'admin',
|
username: 'admin',
|
||||||
password: password}, this.httpOptions);
|
password: password};
|
||||||
|
return this.http.post<RegisterResponse>(this.path + 'auth/register', body, this.httpOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkAdminCreationStatus(force_show = false) {
|
checkAdminCreationStatus(force_show = false) {
|
||||||
@@ -547,12 +557,14 @@ export class PostsService implements CanActivate {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
changeUser(change_obj) {
|
changeUser(change_obj: UpdateUserRequest['change_object']) {
|
||||||
return this.http.post<SuccessObject>(this.path + 'updateUser', {change_object: change_obj}, this.httpOptions);
|
const body: UpdateUserRequest = {change_object: change_obj};
|
||||||
|
return this.http.post<SuccessObject>(this.path + 'updateUser', body, this.httpOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteUser(uid) {
|
deleteUser(uid: string) {
|
||||||
return this.http.post<SuccessObject>(this.path + 'deleteUser', {uid: uid}, this.httpOptions);
|
const body: DeleteUserRequest = {uid: uid};
|
||||||
|
return this.http.post<SuccessObject>(this.path + 'deleteUser', body, this.httpOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
changeUserPassword(user_uid, new_password) {
|
changeUserPassword(user_uid, new_password) {
|
||||||
@@ -560,11 +572,11 @@ export class PostsService implements CanActivate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getUsers() {
|
getUsers() {
|
||||||
return this.http.post(this.path + 'getUsers', {}, this.httpOptions);
|
return this.http.post<GetUsersResponse>(this.path + 'getUsers', {}, this.httpOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
getRoles() {
|
getRoles() {
|
||||||
return this.http.post(this.path + 'getRoles', {}, this.httpOptions);
|
return this.http.post<GetRolesResponse>(this.path + 'getRoles', {}, this.httpOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
setUserPermission(user_uid: string, permission: UserPermission, new_value: YesNo) {
|
setUserPermission(user_uid: string, permission: UserPermission, new_value: YesNo) {
|
||||||
|
|||||||
Reference in New Issue
Block a user