diff --git a/Public API v1.yaml b/Public API v1.yaml index 83c742e..603592e 100644 --- a/Public API v1.yaml +++ b/Public API v1.yaml @@ -678,22 +678,6 @@ paths: $ref: '#/components/schemas/SuccessObject' security: - Auth query parameter: [] - /api/isPinSet: - post: - tags: - - security - summary: Check if pin is set - description: Checks if the pin is set for settings - operationId: post-api-isPinSet - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/inline_response_200_15' - security: - - Auth query parameter: [] /api/generateNewAPIKey: post: tags: @@ -1311,6 +1295,48 @@ paths: - Auth query parameter: [] tags: - multi-user mode + /api/setPin: + post: + summary: Set settings pin + operationId: post-api-setPin + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/SuccessObject' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SetPinRequest' + description: 'Sets a pin for the settings' + security: + - Auth query parameter: [] + tags: + - security + /api/auth/pinLogin: + post: + summary: Pin login + operationId: post-api-pin-login + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/PinLoginResponse' + description: Use this endpoint to generate a JWT token for pin authentication. Put anything in the username field. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/LoginRequest' + security: + - Auth query parameter: [] + tags: + - security /api/getUsers: post: summary: Get all users @@ -3025,6 +3051,13 @@ components: type: string required: - role + SetPinRequest: + required: + - new_pin + type: object + properties: + new_pin: + type: string file: title: file type: object @@ -3074,6 +3107,13 @@ components: type: array items: $ref: '#/components/schemas/UserPermission' + PinLoginResponse: + required: + - pin_token + type: object + properties: + pin_token: + type: string UpdateUserRequest: required: - change_object diff --git a/backend/app.js b/backend/app.js index 33842d9..08a8856 100644 --- a/backend/app.js +++ b/backend/app.js @@ -742,6 +742,18 @@ const optionalJwt = async function (req, res, next) { return next(); }; +const optionalPin = async function (req, res, next) { + const use_pin = config_api.getConfigItem('ytdl_use_pin'); + if (use_pin && req.path.includes('/api/setConfig')) { + if (!req.query.pin_token) { + res.sendStatus(418); // I'm a teapot (RFC 2324) + return; + } + return next(); + } + return next(); +}; + app.get('/api/config', function(req, res) { let config_file = config_api.getConfigFile(); res.send({ @@ -750,7 +762,7 @@ app.get('/api/config', function(req, res) { }); }); -app.post('/api/setConfig', optionalJwt, function(req, res) { +app.post('/api/setConfig', optionalJwt, optionalPin, function(req, res) { let new_config_file = req.body.new_config_file; if (new_config_file && new_config_file['YoutubeDLMaterial']) { let success = config_api.setConfigFile(new_config_file); @@ -1934,12 +1946,23 @@ app.post('/api/auth/login' , auth_api.generateJWT , auth_api.returnAuthResponse ); +app.post('/api/auth/pinLogin' + , auth_api.passport.authenticate(['local_pin'], {}) + , auth_api.generatePinJWT + , auth_api.returnPinAuthResponse +); app.post('/api/auth/jwtAuth' , auth_api.passport.authenticate('jwt', { session: false }) , auth_api.passport.authorize('jwt') , auth_api.generateJWT , auth_api.returnAuthResponse ); +app.post('/api/auth/pinAuth' + , auth_api.passport.authenticate('pin', { session: false }) + , auth_api.passport.authorize('pin') + , auth_api.generatePinJWT + , auth_api.returnPinAuthResponse +); app.post('/api/auth/changePassword', optionalJwt, async (req, res) => { let user_uid = req.body.user_uid; let password = req.body.new_password; @@ -2029,6 +2052,13 @@ app.post('/api/changeRolePermissions', optionalJwt, async (req, res) => { res.send({success: success}); }); +app.post('/api/setPin', function(req, res) { + const success = auth_api.setPin(req.body.new_pin); + res.send({ + success: success + }); +}); + // notifications app.post('/api/getNotifications', optionalJwt, async (req, res) => { diff --git a/backend/authentication/auth.js b/backend/authentication/auth.js index 30e1e02..cbf56ab 100644 --- a/backend/authentication/auth.js +++ b/backend/authentication/auth.js @@ -15,7 +15,6 @@ var JwtStrategy = require('passport-jwt').Strategy, // other required vars let SERVER_SECRET = null; let JWT_EXPIRATION = null; -let opts = null; let saltRounds = null; exports.initialize = function () { @@ -50,11 +49,11 @@ exports.initialize = function () { db_api.users_db.set('jwt_secret', SERVER_SECRET).write(); } - opts = {} + const opts = {} opts.jwtFromRequest = ExtractJwt.fromUrlQueryParameter('jwt'); opts.secretOrKey = SERVER_SECRET; - exports.passport.use(new JwtStrategy(opts, async function(jwt_payload, done) { + exports.passport.use('jwt', new JwtStrategy(opts, async function(jwt_payload, done) { const user = await db_api.getRecord('users', {uid: jwt_payload.user}); if (user) { return done(null, user); @@ -63,6 +62,21 @@ exports.initialize = function () { // or you could create a new account } })); + + const pin_opts = {} + pin_opts.jwtFromRequest = ExtractJwt.fromUrlQueryParameter('pin_token'); + pin_opts.secretOrKey = SERVER_SECRET; + + exports.passport.use('pin', new JwtStrategy(pin_opts, { + passwordField: 'pin'}, + async function(username, password, done) { + if (await bcrypt.compare(password, config_api.getConfigItem('ytdl_pin_hash'))) { + return done(null, { success: true }); + } else { + return done(null, false, { message: 'Incorrect pin' }); + } + } + )); } const setupRoles = async () => { @@ -188,6 +202,10 @@ exports.login = async (username, password) => { return await bcrypt.compare(password, user.passhash) ? user : false; } +exports.pinLogin = async (pin) => { + return await bcrypt.compare(pin, config_api.getConfigItem('ytdl_pin_hash')); +} + exports.passport.use(new LocalStrategy({ usernameField: 'username', passwordField: 'password'}, @@ -196,6 +214,14 @@ exports.passport.use(new LocalStrategy({ } )); +exports.passport.use('local_pin', new LocalStrategy({ + usernameField: 'username', + passwordField: 'password'}, + async function(username, password, done) { + return done(null, await exports.pinLogin(password)); + } +)); + var getLDAPConfiguration = function(req, callback) { const ldap_config = config_api.getConfigItem('ytdl_ldap_config'); const opts = {server: ldap_config}; @@ -237,6 +263,14 @@ exports.generateJWT = function(req, res, next) { next(); } +exports.generatePinJWT = function(req, res, next) { + var payload = { + exp: Math.floor(Date.now() / 1000) + JWT_EXPIRATION + }; + req.token = jwt.sign(payload, SERVER_SECRET); + next(); +} + exports.returnAuthResponse = async function(req, res) { res.status(200).json({ user: req.user, @@ -246,6 +280,12 @@ exports.returnAuthResponse = async function(req, res) { }); } +exports.returnPinAuthResponse = async function(req, res) { + res.status(200).json({ + pin_token: req.token + }); +} + /*************************************** * Authorization: middleware that checks the * JWT token for validity before allowing @@ -439,6 +479,13 @@ exports.userPermissions = async function(user_uid) { return user_permissions; } +// pin + +exports.setPin = async (new_pin) => { + const pin_hash = await bcrypt.hash(new_pin, saltRounds); + return config_api.setConfigItem('ytdl_pin_hash', pin_hash); +} + function getToken(queryParams) { if (queryParams && queryParams.jwt) { var parted = queryParams.jwt.split(' '); @@ -450,7 +497,7 @@ function getToken(queryParams) { } else { return null; } -}; +} function generateUserObject(userid, username, hash, auth_method = 'internal') { let new_user = { diff --git a/backend/config.js b/backend/config.js index 28b58c2..bcf48c7 100644 --- a/backend/config.js +++ b/backend/config.js @@ -202,6 +202,8 @@ const DEFAULT_CONFIG = { "enable_all_notifications": true, "allowed_notification_types": [], "enable_rss_feed": false, + "use_pin": false, + "pin_hash": "", }, "API": { "use_API_key": false, diff --git a/backend/consts.js b/backend/consts.js index 506d545..916e26a 100644 --- a/backend/consts.js +++ b/backend/consts.js @@ -92,6 +92,14 @@ exports.CONFIG_ITEMS = { 'key': 'ytdl_enable_rss_feed', 'path': 'YoutubeDLMaterial.Extra.enable_rss_feed' }, + 'ytdl_use_pin': { + 'key': 'ytdl_use_pin', + 'path': 'YoutubeDLMaterial.Extra.use_pin' + }, + 'ytdl_pin_hash': { + 'key': 'ytdl_pin_hash', + 'path': 'YoutubeDLMaterial.Extra.pin_hash' + }, // API 'ytdl_use_api_key': { diff --git a/src/api-types/index.ts b/src/api-types/index.ts index 5da5b0a..a9d72b0 100644 --- a/src/api-types/index.ts +++ b/src/api-types/index.ts @@ -87,6 +87,7 @@ export type { LoginResponse } from './models/LoginResponse'; export type { Notification } from './models/Notification'; export { NotificationAction } from './models/NotificationAction'; export { NotificationType } from './models/NotificationType'; +export type { PinLoginResponse } from './models/PinLoginResponse'; export type { Playlist } from './models/Playlist'; export type { RegisterRequest } from './models/RegisterRequest'; export type { RegisterResponse } from './models/RegisterResponse'; @@ -95,6 +96,7 @@ export type { RestoreDBBackupRequest } from './models/RestoreDBBackupRequest'; export { Schedule } from './models/Schedule'; export type { SetConfigRequest } from './models/SetConfigRequest'; export type { SetNotificationsToReadRequest } from './models/SetNotificationsToReadRequest'; +export type { SetPinRequest } from './models/SetPinRequest'; export type { SharingToggle } from './models/SharingToggle'; export type { Sort } from './models/Sort'; export type { SubscribeRequest } from './models/SubscribeRequest'; diff --git a/src/api-types/models/AddFileToPlaylistRequest.ts b/src/api-types/models/AddFileToPlaylistRequest.ts index a08c586..bc5b21a 100644 --- a/src/api-types/models/AddFileToPlaylistRequest.ts +++ b/src/api-types/models/AddFileToPlaylistRequest.ts @@ -5,4 +5,4 @@ export type AddFileToPlaylistRequest = { file_uid: string; playlist_id: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/Archive.ts b/src/api-types/models/Archive.ts index 0c0e216..63ce05b 100644 --- a/src/api-types/models/Archive.ts +++ b/src/api-types/models/Archive.ts @@ -13,4 +13,4 @@ export type Archive = { sub_id?: string; timestamp: number; uid: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/BaseChangePermissionsRequest.ts b/src/api-types/models/BaseChangePermissionsRequest.ts index fd418de..912d429 100644 --- a/src/api-types/models/BaseChangePermissionsRequest.ts +++ b/src/api-types/models/BaseChangePermissionsRequest.ts @@ -8,4 +8,4 @@ import type { YesNo } from './YesNo'; export type BaseChangePermissionsRequest = { permission: UserPermission; new_value: YesNo; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/Category.ts b/src/api-types/models/Category.ts index cfabd8b..b03d891 100644 --- a/src/api-types/models/Category.ts +++ b/src/api-types/models/Category.ts @@ -12,4 +12,4 @@ export type Category = { * Overrides file output for downloaded files in category */ custom_output?: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/CategoryRule.ts b/src/api-types/models/CategoryRule.ts index e99cda1..ad13eb6 100644 --- a/src/api-types/models/CategoryRule.ts +++ b/src/api-types/models/CategoryRule.ts @@ -22,4 +22,4 @@ export namespace CategoryRule { } -} \ No newline at end of file +} diff --git a/src/api-types/models/ChangeRolePermissionsRequest.ts b/src/api-types/models/ChangeRolePermissionsRequest.ts index 9d786e7..e7e5051 100644 --- a/src/api-types/models/ChangeRolePermissionsRequest.ts +++ b/src/api-types/models/ChangeRolePermissionsRequest.ts @@ -6,4 +6,4 @@ import type { BaseChangePermissionsRequest } from './BaseChangePermissionsReques export type ChangeRolePermissionsRequest = (BaseChangePermissionsRequest & { role: string; -}); \ No newline at end of file +}); diff --git a/src/api-types/models/ChangeUserPermissionsRequest.ts b/src/api-types/models/ChangeUserPermissionsRequest.ts index ffa4817..780ceaa 100644 --- a/src/api-types/models/ChangeUserPermissionsRequest.ts +++ b/src/api-types/models/ChangeUserPermissionsRequest.ts @@ -6,4 +6,4 @@ import type { BaseChangePermissionsRequest } from './BaseChangePermissionsReques export type ChangeUserPermissionsRequest = (BaseChangePermissionsRequest & { user_uid: string; -}); \ No newline at end of file +}); diff --git a/src/api-types/models/CheckConcurrentStreamRequest.ts b/src/api-types/models/CheckConcurrentStreamRequest.ts index 7c30670..d117e3a 100644 --- a/src/api-types/models/CheckConcurrentStreamRequest.ts +++ b/src/api-types/models/CheckConcurrentStreamRequest.ts @@ -7,4 +7,4 @@ export type CheckConcurrentStreamRequest = { * UID of the concurrent stream */ uid: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/CheckConcurrentStreamResponse.ts b/src/api-types/models/CheckConcurrentStreamResponse.ts index 2d1df1c..54f03a2 100644 --- a/src/api-types/models/CheckConcurrentStreamResponse.ts +++ b/src/api-types/models/CheckConcurrentStreamResponse.ts @@ -6,4 +6,4 @@ import type { ConcurrentStream } from './ConcurrentStream'; export type CheckConcurrentStreamResponse = { stream: ConcurrentStream; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/ClearDownloadsRequest.ts b/src/api-types/models/ClearDownloadsRequest.ts index efee2c9..5603dc5 100644 --- a/src/api-types/models/ClearDownloadsRequest.ts +++ b/src/api-types/models/ClearDownloadsRequest.ts @@ -6,4 +6,4 @@ export type ClearDownloadsRequest = { clear_finished?: boolean; clear_paused?: boolean; clear_errors?: boolean; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/ConcurrentStream.ts b/src/api-types/models/ConcurrentStream.ts index 486cc57..ef475d6 100644 --- a/src/api-types/models/ConcurrentStream.ts +++ b/src/api-types/models/ConcurrentStream.ts @@ -6,4 +6,4 @@ export type ConcurrentStream = { playback_timestamp?: number; unix_timestamp?: number; playing?: boolean; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/Config.ts b/src/api-types/models/Config.ts index cb05dea..9bf8057 100644 --- a/src/api-types/models/Config.ts +++ b/src/api-types/models/Config.ts @@ -4,4 +4,4 @@ export type Config = { YoutubeDLMaterial: any; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/ConfigResponse.ts b/src/api-types/models/ConfigResponse.ts index 0912cac..4d9eb77 100644 --- a/src/api-types/models/ConfigResponse.ts +++ b/src/api-types/models/ConfigResponse.ts @@ -7,4 +7,4 @@ import type { Config } from './Config'; export type ConfigResponse = { config_file: Config; success: boolean; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/CreateCategoryRequest.ts b/src/api-types/models/CreateCategoryRequest.ts index 7c091b6..552c745 100644 --- a/src/api-types/models/CreateCategoryRequest.ts +++ b/src/api-types/models/CreateCategoryRequest.ts @@ -4,4 +4,4 @@ export type CreateCategoryRequest = { name: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/CreateCategoryResponse.ts b/src/api-types/models/CreateCategoryResponse.ts index 2be83f6..0d38792 100644 --- a/src/api-types/models/CreateCategoryResponse.ts +++ b/src/api-types/models/CreateCategoryResponse.ts @@ -7,4 +7,4 @@ import type { Category } from './Category'; export type CreateCategoryResponse = { new_category?: Category; success?: boolean; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/CreatePlaylistRequest.ts b/src/api-types/models/CreatePlaylistRequest.ts index e61a2a0..e276658 100644 --- a/src/api-types/models/CreatePlaylistRequest.ts +++ b/src/api-types/models/CreatePlaylistRequest.ts @@ -6,4 +6,4 @@ export type CreatePlaylistRequest = { playlistName: string; uids: Array; thumbnailURL: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/CreatePlaylistResponse.ts b/src/api-types/models/CreatePlaylistResponse.ts index 48b5d06..51fba29 100644 --- a/src/api-types/models/CreatePlaylistResponse.ts +++ b/src/api-types/models/CreatePlaylistResponse.ts @@ -7,4 +7,4 @@ import type { Playlist } from './Playlist'; export type CreatePlaylistResponse = { new_playlist: Playlist; success: boolean; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/CropFileSettings.ts b/src/api-types/models/CropFileSettings.ts index e4ab45a..0e203f2 100644 --- a/src/api-types/models/CropFileSettings.ts +++ b/src/api-types/models/CropFileSettings.ts @@ -5,4 +5,4 @@ export type CropFileSettings = { cropFileStart: number; cropFileEnd: number; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/DBBackup.ts b/src/api-types/models/DBBackup.ts index b137cad..5e90358 100644 --- a/src/api-types/models/DBBackup.ts +++ b/src/api-types/models/DBBackup.ts @@ -17,4 +17,4 @@ export namespace DBBackup { } -} \ No newline at end of file +} diff --git a/src/api-types/models/DBInfoResponse.ts b/src/api-types/models/DBInfoResponse.ts index b4e4fe1..e57d595 100644 --- a/src/api-types/models/DBInfoResponse.ts +++ b/src/api-types/models/DBInfoResponse.ts @@ -16,4 +16,4 @@ roles?: TableInfo; download_queue?: TableInfo; archives?: TableInfo; }; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/DatabaseFile.ts b/src/api-types/models/DatabaseFile.ts index 855aa61..8fdec34 100644 --- a/src/api-types/models/DatabaseFile.ts +++ b/src/api-types/models/DatabaseFile.ts @@ -42,4 +42,4 @@ export type DatabaseFile = { */ abr?: number; favorite: boolean; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/DeleteAllFilesResponse.ts b/src/api-types/models/DeleteAllFilesResponse.ts index 94efef7..0720b46 100644 --- a/src/api-types/models/DeleteAllFilesResponse.ts +++ b/src/api-types/models/DeleteAllFilesResponse.ts @@ -11,4 +11,4 @@ export type DeleteAllFilesResponse = { * Number of files removed */ delete_count?: number; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/DeleteArchiveItemsRequest.ts b/src/api-types/models/DeleteArchiveItemsRequest.ts index 7911f59..2b849f6 100644 --- a/src/api-types/models/DeleteArchiveItemsRequest.ts +++ b/src/api-types/models/DeleteArchiveItemsRequest.ts @@ -6,4 +6,4 @@ import type { Archive } from './Archive'; export type DeleteArchiveItemsRequest = { archives: Array; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/DeleteCategoryRequest.ts b/src/api-types/models/DeleteCategoryRequest.ts index 50e736b..c9e381e 100644 --- a/src/api-types/models/DeleteCategoryRequest.ts +++ b/src/api-types/models/DeleteCategoryRequest.ts @@ -4,4 +4,4 @@ export type DeleteCategoryRequest = { category_uid: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/DeleteMp3Mp4Request.ts b/src/api-types/models/DeleteMp3Mp4Request.ts index ec74390..e3c2b0a 100644 --- a/src/api-types/models/DeleteMp3Mp4Request.ts +++ b/src/api-types/models/DeleteMp3Mp4Request.ts @@ -5,4 +5,4 @@ export type DeleteMp3Mp4Request = { uid: string; blacklistMode?: boolean; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/DeleteNotificationRequest.ts b/src/api-types/models/DeleteNotificationRequest.ts index c554c6d..f69e476 100644 --- a/src/api-types/models/DeleteNotificationRequest.ts +++ b/src/api-types/models/DeleteNotificationRequest.ts @@ -4,4 +4,4 @@ export type DeleteNotificationRequest = { uid: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/DeletePlaylistRequest.ts b/src/api-types/models/DeletePlaylistRequest.ts index 82e25b2..e351f7c 100644 --- a/src/api-types/models/DeletePlaylistRequest.ts +++ b/src/api-types/models/DeletePlaylistRequest.ts @@ -4,4 +4,4 @@ export type DeletePlaylistRequest = { playlist_id: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/DeleteSubscriptionFileRequest.ts b/src/api-types/models/DeleteSubscriptionFileRequest.ts index 46afd3f..61051f9 100644 --- a/src/api-types/models/DeleteSubscriptionFileRequest.ts +++ b/src/api-types/models/DeleteSubscriptionFileRequest.ts @@ -8,4 +8,4 @@ export type DeleteSubscriptionFileRequest = { * If true, does not remove id from archive. Only valid if youtube-dl archive is enabled in settings. */ deleteForever?: boolean; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/DeleteUserRequest.ts b/src/api-types/models/DeleteUserRequest.ts index 50b2ce6..8d26983 100644 --- a/src/api-types/models/DeleteUserRequest.ts +++ b/src/api-types/models/DeleteUserRequest.ts @@ -4,4 +4,4 @@ export type DeleteUserRequest = { uid: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/Download.ts b/src/api-types/models/Download.ts index cae580f..84d95e5 100644 --- a/src/api-types/models/Download.ts +++ b/src/api-types/models/Download.ts @@ -27,4 +27,4 @@ export type Download = { sub_id?: string; sub_name?: string; prefetched_info?: any; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/DownloadArchiveRequest.ts b/src/api-types/models/DownloadArchiveRequest.ts index 6123a30..10d9284 100644 --- a/src/api-types/models/DownloadArchiveRequest.ts +++ b/src/api-types/models/DownloadArchiveRequest.ts @@ -7,4 +7,4 @@ import type { FileType } from './FileType'; export type DownloadArchiveRequest = { type?: FileType; sub_id?: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/DownloadFileRequest.ts b/src/api-types/models/DownloadFileRequest.ts index b14f3ea..daf6392 100644 --- a/src/api-types/models/DownloadFileRequest.ts +++ b/src/api-types/models/DownloadFileRequest.ts @@ -11,4 +11,4 @@ export type DownloadFileRequest = { playlist_id?: string; url?: string; type?: FileType; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/DownloadRequest.ts b/src/api-types/models/DownloadRequest.ts index 2d76d96..1f067fe 100644 --- a/src/api-types/models/DownloadRequest.ts +++ b/src/api-types/models/DownloadRequest.ts @@ -49,4 +49,4 @@ export type DownloadRequest = { * If using youtube-dl archive, download will ignore it */ ignoreArchive?: boolean; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/DownloadResponse.ts b/src/api-types/models/DownloadResponse.ts index 9428f00..217be23 100644 --- a/src/api-types/models/DownloadResponse.ts +++ b/src/api-types/models/DownloadResponse.ts @@ -6,4 +6,4 @@ import type { Download } from './Download'; export type DownloadResponse = { download?: Download; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/DownloadTwitchChatByVODIDRequest.ts b/src/api-types/models/DownloadTwitchChatByVODIDRequest.ts index c807f13..648587b 100644 --- a/src/api-types/models/DownloadTwitchChatByVODIDRequest.ts +++ b/src/api-types/models/DownloadTwitchChatByVODIDRequest.ts @@ -20,4 +20,4 @@ export type DownloadTwitchChatByVODIDRequest = { */ uuid?: string; sub?: Subscription; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/DownloadTwitchChatByVODIDResponse.ts b/src/api-types/models/DownloadTwitchChatByVODIDResponse.ts index 673fd08..f399d2c 100644 --- a/src/api-types/models/DownloadTwitchChatByVODIDResponse.ts +++ b/src/api-types/models/DownloadTwitchChatByVODIDResponse.ts @@ -6,4 +6,4 @@ import type { TwitchChatMessage } from './TwitchChatMessage'; export type DownloadTwitchChatByVODIDResponse = { chat: Array; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/DownloadVideosForSubscriptionRequest.ts b/src/api-types/models/DownloadVideosForSubscriptionRequest.ts index e68b4e4..6482252 100644 --- a/src/api-types/models/DownloadVideosForSubscriptionRequest.ts +++ b/src/api-types/models/DownloadVideosForSubscriptionRequest.ts @@ -4,4 +4,4 @@ export type DownloadVideosForSubscriptionRequest = { subID: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/FileType.ts b/src/api-types/models/FileType.ts index c220762..0b79b13 100644 --- a/src/api-types/models/FileType.ts +++ b/src/api-types/models/FileType.ts @@ -5,4 +5,4 @@ export enum FileType { AUDIO = 'audio', VIDEO = 'video', -} \ No newline at end of file +} diff --git a/src/api-types/models/FileTypeFilter.ts b/src/api-types/models/FileTypeFilter.ts index d1fac98..eea3f12 100644 --- a/src/api-types/models/FileTypeFilter.ts +++ b/src/api-types/models/FileTypeFilter.ts @@ -6,4 +6,4 @@ export enum FileTypeFilter { AUDIO_ONLY = 'audio_only', VIDEO_ONLY = 'video_only', BOTH = 'both', -} \ No newline at end of file +} diff --git a/src/api-types/models/GenerateArgsResponse.ts b/src/api-types/models/GenerateArgsResponse.ts index 0201d16..30b0b62 100644 --- a/src/api-types/models/GenerateArgsResponse.ts +++ b/src/api-types/models/GenerateArgsResponse.ts @@ -4,4 +4,4 @@ export type GenerateArgsResponse = { args?: Array; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GenerateNewApiKeyResponse.ts b/src/api-types/models/GenerateNewApiKeyResponse.ts index 3eb90e0..334dab1 100644 --- a/src/api-types/models/GenerateNewApiKeyResponse.ts +++ b/src/api-types/models/GenerateNewApiKeyResponse.ts @@ -4,4 +4,4 @@ export type GenerateNewApiKeyResponse = { new_api_key: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetAllCategoriesResponse.ts b/src/api-types/models/GetAllCategoriesResponse.ts index 6623016..a45c713 100644 --- a/src/api-types/models/GetAllCategoriesResponse.ts +++ b/src/api-types/models/GetAllCategoriesResponse.ts @@ -6,4 +6,4 @@ import type { Category } from './Category'; export type GetAllCategoriesResponse = { categories: Array; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetAllDownloadsRequest.ts b/src/api-types/models/GetAllDownloadsRequest.ts index fa0ea24..fe608d4 100644 --- a/src/api-types/models/GetAllDownloadsRequest.ts +++ b/src/api-types/models/GetAllDownloadsRequest.ts @@ -7,4 +7,4 @@ export type GetAllDownloadsRequest = { * Filters downloads with the array */ uids?: Array | null; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetAllDownloadsResponse.ts b/src/api-types/models/GetAllDownloadsResponse.ts index 16f6f8c..db2257c 100644 --- a/src/api-types/models/GetAllDownloadsResponse.ts +++ b/src/api-types/models/GetAllDownloadsResponse.ts @@ -6,4 +6,4 @@ import type { Download } from './Download'; export type GetAllDownloadsResponse = { downloads?: Array; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetAllFilesRequest.ts b/src/api-types/models/GetAllFilesRequest.ts index cd07f36..d86ecde 100644 --- a/src/api-types/models/GetAllFilesRequest.ts +++ b/src/api-types/models/GetAllFilesRequest.ts @@ -21,4 +21,4 @@ export type GetAllFilesRequest = { * Include if you want to filter by subscription */ sub_id?: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetAllFilesResponse.ts b/src/api-types/models/GetAllFilesResponse.ts index 22aa333..12f5d5c 100644 --- a/src/api-types/models/GetAllFilesResponse.ts +++ b/src/api-types/models/GetAllFilesResponse.ts @@ -11,4 +11,4 @@ export type GetAllFilesResponse = { * All video playlists */ playlists: Array; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetAllSubscriptionsResponse.ts b/src/api-types/models/GetAllSubscriptionsResponse.ts index 4c2d1a8..a7cb064 100644 --- a/src/api-types/models/GetAllSubscriptionsResponse.ts +++ b/src/api-types/models/GetAllSubscriptionsResponse.ts @@ -6,4 +6,4 @@ import type { Subscription } from './Subscription'; export type GetAllSubscriptionsResponse = { subscriptions: Array; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetAllTasksResponse.ts b/src/api-types/models/GetAllTasksResponse.ts index 9bbd394..28b8b04 100644 --- a/src/api-types/models/GetAllTasksResponse.ts +++ b/src/api-types/models/GetAllTasksResponse.ts @@ -6,4 +6,4 @@ import type { Task } from './Task'; export type GetAllTasksResponse = { tasks?: Array; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetArchivesRequest.ts b/src/api-types/models/GetArchivesRequest.ts index 5a0d132..0ce245a 100644 --- a/src/api-types/models/GetArchivesRequest.ts +++ b/src/api-types/models/GetArchivesRequest.ts @@ -7,4 +7,4 @@ import type { FileType } from './FileType'; export type GetArchivesRequest = { type?: FileType; sub_id?: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetArchivesResponse.ts b/src/api-types/models/GetArchivesResponse.ts index 953807c..4c0e1ce 100644 --- a/src/api-types/models/GetArchivesResponse.ts +++ b/src/api-types/models/GetArchivesResponse.ts @@ -6,4 +6,4 @@ import type { Archive } from './Archive'; export type GetArchivesResponse = { archives: Array; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetDBBackupsResponse.ts b/src/api-types/models/GetDBBackupsResponse.ts index 0ec58d8..3e0c0ec 100644 --- a/src/api-types/models/GetDBBackupsResponse.ts +++ b/src/api-types/models/GetDBBackupsResponse.ts @@ -6,4 +6,4 @@ import type { DBBackup } from './DBBackup'; export type GetDBBackupsResponse = { tasks?: Array; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetDownloadRequest.ts b/src/api-types/models/GetDownloadRequest.ts index e166f9f..3e2df4e 100644 --- a/src/api-types/models/GetDownloadRequest.ts +++ b/src/api-types/models/GetDownloadRequest.ts @@ -4,4 +4,4 @@ export type GetDownloadRequest = { download_uid: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetDownloadResponse.ts b/src/api-types/models/GetDownloadResponse.ts index c6eeb51..9495cc2 100644 --- a/src/api-types/models/GetDownloadResponse.ts +++ b/src/api-types/models/GetDownloadResponse.ts @@ -6,4 +6,4 @@ import type { Download } from './Download'; export type GetDownloadResponse = { download?: Download; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetFileFormatsRequest.ts b/src/api-types/models/GetFileFormatsRequest.ts index 3b9fa54..45cbeb7 100644 --- a/src/api-types/models/GetFileFormatsRequest.ts +++ b/src/api-types/models/GetFileFormatsRequest.ts @@ -4,4 +4,4 @@ export type GetFileFormatsRequest = { url?: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetFileFormatsResponse.ts b/src/api-types/models/GetFileFormatsResponse.ts index d195660..0412637 100644 --- a/src/api-types/models/GetFileFormatsResponse.ts +++ b/src/api-types/models/GetFileFormatsResponse.ts @@ -7,4 +7,4 @@ export type GetFileFormatsResponse = { result: { formats?: Array; }; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetFileRequest.ts b/src/api-types/models/GetFileRequest.ts index 6c3e0cb..085dab9 100644 --- a/src/api-types/models/GetFileRequest.ts +++ b/src/api-types/models/GetFileRequest.ts @@ -14,4 +14,4 @@ export type GetFileRequest = { * User UID */ uuid?: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetFileResponse.ts b/src/api-types/models/GetFileResponse.ts index ad64755..b62f1c6 100644 --- a/src/api-types/models/GetFileResponse.ts +++ b/src/api-types/models/GetFileResponse.ts @@ -7,4 +7,4 @@ import type { DatabaseFile } from './DatabaseFile'; export type GetFileResponse = { success: boolean; file?: DatabaseFile; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetFullTwitchChatRequest.ts b/src/api-types/models/GetFullTwitchChatRequest.ts index 0b10d98..4e6efa9 100644 --- a/src/api-types/models/GetFullTwitchChatRequest.ts +++ b/src/api-types/models/GetFullTwitchChatRequest.ts @@ -16,4 +16,4 @@ export type GetFullTwitchChatRequest = { */ uuid?: string; sub?: Subscription; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetFullTwitchChatResponse.ts b/src/api-types/models/GetFullTwitchChatResponse.ts index 1f52375..a894650 100644 --- a/src/api-types/models/GetFullTwitchChatResponse.ts +++ b/src/api-types/models/GetFullTwitchChatResponse.ts @@ -5,4 +5,4 @@ export type GetFullTwitchChatResponse = { success: boolean; error?: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetLogsRequest.ts b/src/api-types/models/GetLogsRequest.ts index e5029ee..ef6800b 100644 --- a/src/api-types/models/GetLogsRequest.ts +++ b/src/api-types/models/GetLogsRequest.ts @@ -4,4 +4,4 @@ export type GetLogsRequest = { lines?: number; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetLogsResponse.ts b/src/api-types/models/GetLogsResponse.ts index 760d5f4..255ec9c 100644 --- a/src/api-types/models/GetLogsResponse.ts +++ b/src/api-types/models/GetLogsResponse.ts @@ -8,4 +8,4 @@ export type GetLogsResponse = { */ logs?: string; success?: boolean; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetMp3sResponse.ts b/src/api-types/models/GetMp3sResponse.ts index ed63f48..cecafb1 100644 --- a/src/api-types/models/GetMp3sResponse.ts +++ b/src/api-types/models/GetMp3sResponse.ts @@ -11,4 +11,4 @@ export type GetMp3sResponse = { * All audio playlists */ playlists: Array; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetMp4sResponse.ts b/src/api-types/models/GetMp4sResponse.ts index bfa0ed0..9a763da 100644 --- a/src/api-types/models/GetMp4sResponse.ts +++ b/src/api-types/models/GetMp4sResponse.ts @@ -11,4 +11,4 @@ export type GetMp4sResponse = { * All video playlists */ playlists: Array; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetNotificationsResponse.ts b/src/api-types/models/GetNotificationsResponse.ts index 1a018cd..35d7469 100644 --- a/src/api-types/models/GetNotificationsResponse.ts +++ b/src/api-types/models/GetNotificationsResponse.ts @@ -6,4 +6,4 @@ import type { Notification } from './Notification'; export type GetNotificationsResponse = { notifications?: Array; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetPlaylistRequest.ts b/src/api-types/models/GetPlaylistRequest.ts index 51c85bd..335d1cd 100644 --- a/src/api-types/models/GetPlaylistRequest.ts +++ b/src/api-types/models/GetPlaylistRequest.ts @@ -9,4 +9,4 @@ export type GetPlaylistRequest = { type?: FileType; uuid?: string; include_file_metadata?: boolean; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetPlaylistResponse.ts b/src/api-types/models/GetPlaylistResponse.ts index 14ff0c0..7c9e2d1 100644 --- a/src/api-types/models/GetPlaylistResponse.ts +++ b/src/api-types/models/GetPlaylistResponse.ts @@ -12,4 +12,4 @@ export type GetPlaylistResponse = { * File objects for every uid in the playlist's uids property, in the same order */ file_objs?: Array; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetPlaylistsRequest.ts b/src/api-types/models/GetPlaylistsRequest.ts index 50edba9..1de88b6 100644 --- a/src/api-types/models/GetPlaylistsRequest.ts +++ b/src/api-types/models/GetPlaylistsRequest.ts @@ -4,4 +4,4 @@ export type GetPlaylistsRequest = { include_categories?: boolean; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetPlaylistsResponse.ts b/src/api-types/models/GetPlaylistsResponse.ts index 7d5a4d4..294360c 100644 --- a/src/api-types/models/GetPlaylistsResponse.ts +++ b/src/api-types/models/GetPlaylistsResponse.ts @@ -6,4 +6,4 @@ import type { Playlist } from './Playlist'; export type GetPlaylistsResponse = { playlists: Array; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetRolesResponse.ts b/src/api-types/models/GetRolesResponse.ts index cddc679..3ab5ab7 100644 --- a/src/api-types/models/GetRolesResponse.ts +++ b/src/api-types/models/GetRolesResponse.ts @@ -13,4 +13,4 @@ user?: { permissions?: Array; }; }; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetSubscriptionRequest.ts b/src/api-types/models/GetSubscriptionRequest.ts index 3a9bf63..19fc36a 100644 --- a/src/api-types/models/GetSubscriptionRequest.ts +++ b/src/api-types/models/GetSubscriptionRequest.ts @@ -11,4 +11,4 @@ export type GetSubscriptionRequest = { * Subscription name */ name?: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetSubscriptionResponse.ts b/src/api-types/models/GetSubscriptionResponse.ts index 7b6663d..c9931c6 100644 --- a/src/api-types/models/GetSubscriptionResponse.ts +++ b/src/api-types/models/GetSubscriptionResponse.ts @@ -7,4 +7,4 @@ import type { Subscription } from './Subscription'; export type GetSubscriptionResponse = { subscription: Subscription; files: Array; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetTaskRequest.ts b/src/api-types/models/GetTaskRequest.ts index 5602d3c..a188892 100644 --- a/src/api-types/models/GetTaskRequest.ts +++ b/src/api-types/models/GetTaskRequest.ts @@ -4,4 +4,4 @@ export type GetTaskRequest = { task_key: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetTaskResponse.ts b/src/api-types/models/GetTaskResponse.ts index a901123..850ee05 100644 --- a/src/api-types/models/GetTaskResponse.ts +++ b/src/api-types/models/GetTaskResponse.ts @@ -6,4 +6,4 @@ import type { Task } from './Task'; export type GetTaskResponse = { task?: Task; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/GetUsersResponse.ts b/src/api-types/models/GetUsersResponse.ts index 5a18ec7..5e13f1a 100644 --- a/src/api-types/models/GetUsersResponse.ts +++ b/src/api-types/models/GetUsersResponse.ts @@ -6,4 +6,4 @@ import type { User } from './User'; export type GetUsersResponse = { users: Array; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/ImportArchiveRequest.ts b/src/api-types/models/ImportArchiveRequest.ts index 7c00028..05c6e1a 100644 --- a/src/api-types/models/ImportArchiveRequest.ts +++ b/src/api-types/models/ImportArchiveRequest.ts @@ -8,4 +8,4 @@ export type ImportArchiveRequest = { archive: string; type: FileType; sub_id?: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/IncrementViewCountRequest.ts b/src/api-types/models/IncrementViewCountRequest.ts index 19011c1..d49d2c2 100644 --- a/src/api-types/models/IncrementViewCountRequest.ts +++ b/src/api-types/models/IncrementViewCountRequest.ts @@ -9,4 +9,4 @@ export type IncrementViewCountRequest = { * User UID */ uuid?: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/LoginRequest.ts b/src/api-types/models/LoginRequest.ts index 544a1a2..44c2ae8 100644 --- a/src/api-types/models/LoginRequest.ts +++ b/src/api-types/models/LoginRequest.ts @@ -5,4 +5,4 @@ export type LoginRequest = { username: string; password: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/LoginResponse.ts b/src/api-types/models/LoginResponse.ts index cd4b380..6521ed7 100644 --- a/src/api-types/models/LoginResponse.ts +++ b/src/api-types/models/LoginResponse.ts @@ -10,4 +10,4 @@ export type LoginResponse = { token?: string; permissions?: Array; available_permissions?: Array; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/Notification.ts b/src/api-types/models/Notification.ts index ce99fe6..f77e917 100644 --- a/src/api-types/models/Notification.ts +++ b/src/api-types/models/Notification.ts @@ -13,4 +13,4 @@ export type Notification = { read: boolean; data?: any; timestamp: number; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/NotificationAction.ts b/src/api-types/models/NotificationAction.ts index 9f97b41..8313aaf 100644 --- a/src/api-types/models/NotificationAction.ts +++ b/src/api-types/models/NotificationAction.ts @@ -7,4 +7,4 @@ export enum NotificationAction { RETRY_DOWNLOAD = 'retry_download', VIEW_DOWNLOAD_ERROR = 'view_download_error', VIEW_TASKS = 'view_tasks', -} \ No newline at end of file +} diff --git a/src/api-types/models/NotificationType.ts b/src/api-types/models/NotificationType.ts index 26cfee9..e773485 100644 --- a/src/api-types/models/NotificationType.ts +++ b/src/api-types/models/NotificationType.ts @@ -6,4 +6,4 @@ export enum NotificationType { DOWNLOAD_COMPLETE = 'download_complete', DOWNLOAD_ERROR = 'download_error', TASK_FINISHED = 'task_finished', -} \ No newline at end of file +} diff --git a/src/api-types/models/PinLoginResponse.ts b/src/api-types/models/PinLoginResponse.ts new file mode 100644 index 0000000..e19a234 --- /dev/null +++ b/src/api-types/models/PinLoginResponse.ts @@ -0,0 +1,7 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type PinLoginResponse = { + pin_token: string; +}; diff --git a/src/api-types/models/Playlist.ts b/src/api-types/models/Playlist.ts index bdbd0f6..cff083a 100644 --- a/src/api-types/models/Playlist.ts +++ b/src/api-types/models/Playlist.ts @@ -15,4 +15,4 @@ export type Playlist = { user_uid?: string; auto?: boolean; sharingEnabled?: boolean; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/RegisterRequest.ts b/src/api-types/models/RegisterRequest.ts index 0cd5a87..5508dc4 100644 --- a/src/api-types/models/RegisterRequest.ts +++ b/src/api-types/models/RegisterRequest.ts @@ -6,4 +6,4 @@ export type RegisterRequest = { userid: string; username: string; password: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/RegisterResponse.ts b/src/api-types/models/RegisterResponse.ts index 62d0387..518c62b 100644 --- a/src/api-types/models/RegisterResponse.ts +++ b/src/api-types/models/RegisterResponse.ts @@ -6,4 +6,4 @@ import type { User } from './User'; export type RegisterResponse = { user?: User; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/RestartDownloadResponse.ts b/src/api-types/models/RestartDownloadResponse.ts index 1cb0233..ec08704 100644 --- a/src/api-types/models/RestartDownloadResponse.ts +++ b/src/api-types/models/RestartDownloadResponse.ts @@ -6,4 +6,4 @@ import type { SuccessObject } from './SuccessObject'; export type RestartDownloadResponse = (SuccessObject & { new_download_uid?: string; -}); \ No newline at end of file +}); diff --git a/src/api-types/models/RestoreDBBackupRequest.ts b/src/api-types/models/RestoreDBBackupRequest.ts index 6804f46..9ae2ad3 100644 --- a/src/api-types/models/RestoreDBBackupRequest.ts +++ b/src/api-types/models/RestoreDBBackupRequest.ts @@ -4,4 +4,4 @@ export type RestoreDBBackupRequest = { file_name: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/Schedule.ts b/src/api-types/models/Schedule.ts index a16fc5f..3138c83 100644 --- a/src/api-types/models/Schedule.ts +++ b/src/api-types/models/Schedule.ts @@ -21,4 +21,4 @@ export namespace Schedule { } -} \ No newline at end of file +} diff --git a/src/api-types/models/SetConfigRequest.ts b/src/api-types/models/SetConfigRequest.ts index e0edf66..f4388a5 100644 --- a/src/api-types/models/SetConfigRequest.ts +++ b/src/api-types/models/SetConfigRequest.ts @@ -6,4 +6,4 @@ import type { Config } from './Config'; export type SetConfigRequest = { new_config_file: Config; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/SetNotificationsToReadRequest.ts b/src/api-types/models/SetNotificationsToReadRequest.ts index 83f5948..8865af9 100644 --- a/src/api-types/models/SetNotificationsToReadRequest.ts +++ b/src/api-types/models/SetNotificationsToReadRequest.ts @@ -4,4 +4,4 @@ export type SetNotificationsToReadRequest = { uids: Array; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/SetPinRequest.ts b/src/api-types/models/SetPinRequest.ts new file mode 100644 index 0000000..bedb2f0 --- /dev/null +++ b/src/api-types/models/SetPinRequest.ts @@ -0,0 +1,7 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type SetPinRequest = { + new_pin: string; +}; diff --git a/src/api-types/models/SharingToggle.ts b/src/api-types/models/SharingToggle.ts index 8c486f5..68249d7 100644 --- a/src/api-types/models/SharingToggle.ts +++ b/src/api-types/models/SharingToggle.ts @@ -5,4 +5,4 @@ export type SharingToggle = { uid: string; is_playlist?: boolean; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/Sort.ts b/src/api-types/models/Sort.ts index 438f884..e8107e8 100644 --- a/src/api-types/models/Sort.ts +++ b/src/api-types/models/Sort.ts @@ -11,4 +11,4 @@ export type Sort = { * 1 for ascending, -1 for descending */ order?: number; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/SubscribeRequest.ts b/src/api-types/models/SubscribeRequest.ts index d7490bf..69b25f3 100644 --- a/src/api-types/models/SubscribeRequest.ts +++ b/src/api-types/models/SubscribeRequest.ts @@ -10,4 +10,4 @@ export type SubscribeRequest = { customArgs?: string; customFileOutput?: string; maxQuality?: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/SubscribeResponse.ts b/src/api-types/models/SubscribeResponse.ts index 0440340..aab560a 100644 --- a/src/api-types/models/SubscribeResponse.ts +++ b/src/api-types/models/SubscribeResponse.ts @@ -7,4 +7,4 @@ import type { Subscription } from './Subscription'; export type SubscribeResponse = { new_sub: Subscription; error?: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/Subscription.ts b/src/api-types/models/Subscription.ts index 2e280d8..9d84e2c 100644 --- a/src/api-types/models/Subscription.ts +++ b/src/api-types/models/Subscription.ts @@ -16,4 +16,4 @@ export type Subscription = { custom_args?: string; custom_output?: string; videos: Array; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/SubscriptionRequestData.ts b/src/api-types/models/SubscriptionRequestData.ts index a7c9650..2bc3591 100644 --- a/src/api-types/models/SubscriptionRequestData.ts +++ b/src/api-types/models/SubscriptionRequestData.ts @@ -10,4 +10,4 @@ export type SubscriptionRequestData = { type?: FileType; isPlaylist?: boolean; archive?: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/SuccessObject.ts b/src/api-types/models/SuccessObject.ts index 9cfdf8b..c736856 100644 --- a/src/api-types/models/SuccessObject.ts +++ b/src/api-types/models/SuccessObject.ts @@ -5,4 +5,4 @@ export type SuccessObject = { success: boolean; error?: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/TableInfo.ts b/src/api-types/models/TableInfo.ts index 58b651a..dada036 100644 --- a/src/api-types/models/TableInfo.ts +++ b/src/api-types/models/TableInfo.ts @@ -4,4 +4,4 @@ export type TableInfo = { records_count?: number; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/Task.ts b/src/api-types/models/Task.ts index 4b85095..a10e413 100644 --- a/src/api-types/models/Task.ts +++ b/src/api-types/models/Task.ts @@ -13,4 +13,4 @@ export type Task = { error: string; schedule: any; options?: any; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/TestConnectionStringRequest.ts b/src/api-types/models/TestConnectionStringRequest.ts index af83b84..5822bbc 100644 --- a/src/api-types/models/TestConnectionStringRequest.ts +++ b/src/api-types/models/TestConnectionStringRequest.ts @@ -7,4 +7,4 @@ export type TestConnectionStringRequest = { * MongoDB connection string */ connection_string: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/TestConnectionStringResponse.ts b/src/api-types/models/TestConnectionStringResponse.ts index 745d63f..fac7d24 100644 --- a/src/api-types/models/TestConnectionStringResponse.ts +++ b/src/api-types/models/TestConnectionStringResponse.ts @@ -5,4 +5,4 @@ export type TestConnectionStringResponse = { success: boolean; error?: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/TransferDBRequest.ts b/src/api-types/models/TransferDBRequest.ts index 5119252..4e11d06 100644 --- a/src/api-types/models/TransferDBRequest.ts +++ b/src/api-types/models/TransferDBRequest.ts @@ -7,4 +7,4 @@ export type TransferDBRequest = { * True if transfering DB from Local to MongoDB, false if transferring DB from MongoDB to Local */ local_to_remote: boolean; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/TransferDBResponse.ts b/src/api-types/models/TransferDBResponse.ts index ab744d4..25b35d8 100644 --- a/src/api-types/models/TransferDBResponse.ts +++ b/src/api-types/models/TransferDBResponse.ts @@ -5,4 +5,4 @@ export type TransferDBResponse = { success: boolean; error?: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/TwitchChatMessage.ts b/src/api-types/models/TwitchChatMessage.ts index cc7efd7..1405287 100644 --- a/src/api-types/models/TwitchChatMessage.ts +++ b/src/api-types/models/TwitchChatMessage.ts @@ -14,4 +14,4 @@ created_at?: string; body?: string; user_color?: string; }; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/UnsubscribeRequest.ts b/src/api-types/models/UnsubscribeRequest.ts index ffc939c..9eed3c5 100644 --- a/src/api-types/models/UnsubscribeRequest.ts +++ b/src/api-types/models/UnsubscribeRequest.ts @@ -10,4 +10,4 @@ export type UnsubscribeRequest = { * Defaults to false */ deleteMode?: boolean; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/UnsubscribeResponse.ts b/src/api-types/models/UnsubscribeResponse.ts index 6eb1c36..18bc079 100644 --- a/src/api-types/models/UnsubscribeResponse.ts +++ b/src/api-types/models/UnsubscribeResponse.ts @@ -5,4 +5,4 @@ export type UnsubscribeResponse = { success: boolean; error?: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/UpdateCategoriesRequest.ts b/src/api-types/models/UpdateCategoriesRequest.ts index 6a611ab..b530ee4 100644 --- a/src/api-types/models/UpdateCategoriesRequest.ts +++ b/src/api-types/models/UpdateCategoriesRequest.ts @@ -6,4 +6,4 @@ import type { Category } from './Category'; export type UpdateCategoriesRequest = { categories: Array; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/UpdateCategoryRequest.ts b/src/api-types/models/UpdateCategoryRequest.ts index 7b3e1cb..9d92406 100644 --- a/src/api-types/models/UpdateCategoryRequest.ts +++ b/src/api-types/models/UpdateCategoryRequest.ts @@ -6,4 +6,4 @@ import type { Category } from './Category'; export type UpdateCategoryRequest = { category: Category; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/UpdateConcurrentStreamRequest.ts b/src/api-types/models/UpdateConcurrentStreamRequest.ts index ce78768..a98d258 100644 --- a/src/api-types/models/UpdateConcurrentStreamRequest.ts +++ b/src/api-types/models/UpdateConcurrentStreamRequest.ts @@ -9,4 +9,4 @@ export type UpdateConcurrentStreamRequest = (ConcurrentStream & { * Concurrent stream UID */ uid: string; -}); \ No newline at end of file +}); diff --git a/src/api-types/models/UpdateConcurrentStreamResponse.ts b/src/api-types/models/UpdateConcurrentStreamResponse.ts index f3dc88d..4a40fb0 100644 --- a/src/api-types/models/UpdateConcurrentStreamResponse.ts +++ b/src/api-types/models/UpdateConcurrentStreamResponse.ts @@ -6,4 +6,4 @@ import type { ConcurrentStream } from './ConcurrentStream'; export type UpdateConcurrentStreamResponse = { stream: ConcurrentStream; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/UpdateFileRequest.ts b/src/api-types/models/UpdateFileRequest.ts index cada2e5..224b018 100644 --- a/src/api-types/models/UpdateFileRequest.ts +++ b/src/api-types/models/UpdateFileRequest.ts @@ -11,4 +11,4 @@ export type UpdateFileRequest = { * Object with fields to update as keys and their new values */ change_obj: any; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/UpdatePlaylistRequest.ts b/src/api-types/models/UpdatePlaylistRequest.ts index ba015b3..b16dec6 100644 --- a/src/api-types/models/UpdatePlaylistRequest.ts +++ b/src/api-types/models/UpdatePlaylistRequest.ts @@ -6,4 +6,4 @@ import type { Playlist } from './Playlist'; export type UpdatePlaylistRequest = { playlist: Playlist; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/UpdateServerRequest.ts b/src/api-types/models/UpdateServerRequest.ts index 8239869..92d95bb 100644 --- a/src/api-types/models/UpdateServerRequest.ts +++ b/src/api-types/models/UpdateServerRequest.ts @@ -4,4 +4,4 @@ export type UpdateServerRequest = { tag: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/UpdateTaskDataRequest.ts b/src/api-types/models/UpdateTaskDataRequest.ts index afe9b54..a9f8e99 100644 --- a/src/api-types/models/UpdateTaskDataRequest.ts +++ b/src/api-types/models/UpdateTaskDataRequest.ts @@ -5,4 +5,4 @@ export type UpdateTaskDataRequest = { task_key: string; new_data: any; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/UpdateTaskOptionsRequest.ts b/src/api-types/models/UpdateTaskOptionsRequest.ts index 47cde2d..2e50f74 100644 --- a/src/api-types/models/UpdateTaskOptionsRequest.ts +++ b/src/api-types/models/UpdateTaskOptionsRequest.ts @@ -5,4 +5,4 @@ export type UpdateTaskOptionsRequest = { task_key: string; new_options: any; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/UpdateTaskScheduleRequest.ts b/src/api-types/models/UpdateTaskScheduleRequest.ts index 62d8775..fb27cd8 100644 --- a/src/api-types/models/UpdateTaskScheduleRequest.ts +++ b/src/api-types/models/UpdateTaskScheduleRequest.ts @@ -7,4 +7,4 @@ import type { Schedule } from './Schedule'; export type UpdateTaskScheduleRequest = { task_key: string; new_schedule: Schedule; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/UpdateUserRequest.ts b/src/api-types/models/UpdateUserRequest.ts index db522c6..31b9b33 100644 --- a/src/api-types/models/UpdateUserRequest.ts +++ b/src/api-types/models/UpdateUserRequest.ts @@ -8,4 +8,4 @@ uid: string; name?: string; role?: string; }; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/UpdaterStatus.ts b/src/api-types/models/UpdaterStatus.ts index 47a2e99..01db98d 100644 --- a/src/api-types/models/UpdaterStatus.ts +++ b/src/api-types/models/UpdaterStatus.ts @@ -6,4 +6,4 @@ export type UpdaterStatus = { updating: boolean; details: string; error?: boolean; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/UploadCookiesRequest.ts b/src/api-types/models/UploadCookiesRequest.ts index f65420d..e240063 100644 --- a/src/api-types/models/UploadCookiesRequest.ts +++ b/src/api-types/models/UploadCookiesRequest.ts @@ -4,4 +4,4 @@ export type UploadCookiesRequest = { cookies: Blob; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/User.ts b/src/api-types/models/User.ts index aa9802e..6436ccc 100644 --- a/src/api-types/models/User.ts +++ b/src/api-types/models/User.ts @@ -14,4 +14,4 @@ export type User = { role?: string; permissions?: Array; permission_overrides?: Array; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/UserPermission.ts b/src/api-types/models/UserPermission.ts index ca8df45..d19c728 100644 --- a/src/api-types/models/UserPermission.ts +++ b/src/api-types/models/UserPermission.ts @@ -9,4 +9,4 @@ export enum UserPermission { SHARING = 'sharing', ADVANCED_DOWNLOAD = 'advanced_download', DOWNLOADS_MANAGER = 'downloads_manager', -} \ No newline at end of file +} diff --git a/src/api-types/models/Version.ts b/src/api-types/models/Version.ts index 37c4289..1b2fda0 100644 --- a/src/api-types/models/Version.ts +++ b/src/api-types/models/Version.ts @@ -7,4 +7,4 @@ export type Version = { tag?: string; commit?: string; date?: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/VersionInfoResponse.ts b/src/api-types/models/VersionInfoResponse.ts index 20d77da..0a291be 100644 --- a/src/api-types/models/VersionInfoResponse.ts +++ b/src/api-types/models/VersionInfoResponse.ts @@ -6,4 +6,4 @@ import type { Version } from './Version'; export type VersionInfoResponse = { version_info: Version; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/YesNo.ts b/src/api-types/models/YesNo.ts index b30f848..09bce39 100644 --- a/src/api-types/models/YesNo.ts +++ b/src/api-types/models/YesNo.ts @@ -5,4 +5,4 @@ export enum YesNo { YES = 'yes', NO = 'no', -} \ No newline at end of file +} diff --git a/src/api-types/models/binary.ts b/src/api-types/models/binary.ts index e8c6812..0f97ae2 100644 --- a/src/api-types/models/binary.ts +++ b/src/api-types/models/binary.ts @@ -4,4 +4,4 @@ export type binary = { id?: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/body_19.ts b/src/api-types/models/body_19.ts index 69df745..09ed602 100644 --- a/src/api-types/models/body_19.ts +++ b/src/api-types/models/body_19.ts @@ -4,4 +4,4 @@ export type body_19 = { input_pin: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/body_20.ts b/src/api-types/models/body_20.ts index be997a7..66f9ec3 100644 --- a/src/api-types/models/body_20.ts +++ b/src/api-types/models/body_20.ts @@ -4,4 +4,4 @@ export type body_20 = { unhashed_pin: string; -}; \ No newline at end of file +}; diff --git a/src/api-types/models/inline_response_200_15.ts b/src/api-types/models/inline_response_200_15.ts index c8d731d..957fa1c 100644 --- a/src/api-types/models/inline_response_200_15.ts +++ b/src/api-types/models/inline_response_200_15.ts @@ -4,4 +4,4 @@ export type inline_response_200_15 = { is_set: boolean; -}; \ No newline at end of file +}; diff --git a/src/app/app.component.html b/src/app/app.component.html index 5980509..e8ab7e4 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -51,7 +51,7 @@ Tasks - Settings + Settings diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 58352e7..7d8c22d 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -22,6 +22,7 @@ import { UserProfileDialogComponent } from './dialogs/user-profile-dialog/user-p import { SetDefaultAdminDialogComponent } from './dialogs/set-default-admin-dialog/set-default-admin-dialog.component'; import { NotificationsComponent } from './components/notifications/notifications.component'; import { ArchiveViewerComponent } from './components/archive-viewer/archive-viewer.component'; +import { PinLoginComponent } from './dialogs/pin-login-dialog/pin-login-dialog.component'; @Component({ selector: 'app-root', @@ -214,6 +215,16 @@ export class AppComponent implements OnInit, AfterViewInit { }); } + pinConfirm(route: string): void { + if (!this.postsService.config.Extra.use_pin) return; + const dialogRef = this.dialog.open(PinLoginComponent); + dialogRef.afterClosed().subscribe(success => { + if (success) { + this.router.navigate([route]); + } + }); + } + notificationCountUpdate(new_count: number): void { this.notification_count = new_count; } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 8768910..42d88d5 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -95,6 +95,8 @@ import { GenerateRssUrlComponent } from './dialogs/generate-rss-url/generate-rss import { SortPropertyComponent } from './components/sort-property/sort-property.component'; import { OnlyNumberDirective } from './directives/only-number.directive'; import { ArchiveViewerComponent } from './components/archive-viewer/archive-viewer.component'; +import { SetPinDialogComponent } from './dialogs/set-pin-dialog/set-pin-dialog.component'; +import { PinLoginComponent } from './dialogs/pin-login-dialog/pin-login-dialog.component'; registerLocaleData(es, 'es'); @@ -147,7 +149,9 @@ registerLocaleData(es, 'es'); GenerateRssUrlComponent, SortPropertyComponent, OnlyNumberDirective, - ArchiveViewerComponent + ArchiveViewerComponent, + SetPinDialogComponent, + PinLoginComponent ], imports: [ CommonModule, diff --git a/src/app/dialogs/pin-login-dialog/pin-login-dialog.component.html b/src/app/dialogs/pin-login-dialog/pin-login-dialog.component.html new file mode 100644 index 0000000..f678fc5 --- /dev/null +++ b/src/app/dialogs/pin-login-dialog/pin-login-dialog.component.html @@ -0,0 +1,16 @@ +

Pin required

+ + + + Enter pin + + + + + + + +
+ +
+
diff --git a/src/app/dialogs/pin-login-dialog/pin-login-dialog.component.scss b/src/app/dialogs/pin-login-dialog/pin-login-dialog.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/dialogs/pin-login-dialog/pin-login-dialog.component.spec.ts b/src/app/dialogs/pin-login-dialog/pin-login-dialog.component.spec.ts new file mode 100644 index 0000000..2e1c14d --- /dev/null +++ b/src/app/dialogs/pin-login-dialog/pin-login-dialog.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PinLoginComponent } from './pin-login-dialog.component'; + +describe('PinLoginComponent', () => { + let component: PinLoginComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ PinLoginComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(PinLoginComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/dialogs/pin-login-dialog/pin-login-dialog.component.ts b/src/app/dialogs/pin-login-dialog/pin-login-dialog.component.ts new file mode 100644 index 0000000..e9e28dd --- /dev/null +++ b/src/app/dialogs/pin-login-dialog/pin-login-dialog.component.ts @@ -0,0 +1,34 @@ +import { Component } from '@angular/core'; +import { MatDialogRef } from '@angular/material/dialog'; +import { PostsService } from 'app/posts.services'; + +@Component({ + selector: 'app-pin-login', + templateUrl: './pin-login-dialog.component.html', + styleUrls: ['./pin-login-dialog.component.scss'] +}) +export class PinLoginComponent { + pin: string; + enterClicked = false; + + constructor(private postsService: PostsService, private dialogRef: MatDialogRef) { + } + + pinLogin() { + this.enterClicked = true; + this.postsService.pinLogin(this.pin).subscribe(res => { + this.enterClicked = false; + if (!res['pin_token']) { + this.postsService.openSnackBar($localize`Pin failed!`); + } else { + this.postsService.httpOptions.params = this.postsService.httpOptions.params.set('pin_token', res['pin_token']); + } + this.dialogRef.close(res['pin_token']); + }, err => { + this.enterClicked = false; + this.postsService.openSnackBar($localize`Pin failed!`); + console.error(err); + this.dialogRef.close(false); + }); + } +} diff --git a/src/app/dialogs/set-pin-dialog/set-pin-dialog.component.html b/src/app/dialogs/set-pin-dialog/set-pin-dialog.component.html new file mode 100644 index 0000000..e65e868 --- /dev/null +++ b/src/app/dialogs/set-pin-dialog/set-pin-dialog.component.html @@ -0,0 +1,13 @@ +

Set pin

+ + + + Pin + + + + + + + + diff --git a/src/app/dialogs/set-pin-dialog/set-pin-dialog.component.scss b/src/app/dialogs/set-pin-dialog/set-pin-dialog.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/dialogs/set-pin-dialog/set-pin-dialog.component.spec.ts b/src/app/dialogs/set-pin-dialog/set-pin-dialog.component.spec.ts new file mode 100644 index 0000000..db382ec --- /dev/null +++ b/src/app/dialogs/set-pin-dialog/set-pin-dialog.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SetPinDialogComponent } from './set-pin-dialog.component'; + +describe('SetPinDialogComponent', () => { + let component: SetPinDialogComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ SetPinDialogComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(SetPinDialogComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/dialogs/set-pin-dialog/set-pin-dialog.component.ts b/src/app/dialogs/set-pin-dialog/set-pin-dialog.component.ts new file mode 100644 index 0000000..a38f7a8 --- /dev/null +++ b/src/app/dialogs/set-pin-dialog/set-pin-dialog.component.ts @@ -0,0 +1,22 @@ +import { Component } from '@angular/core'; +import { PostsService } from 'app/posts.services'; + +@Component({ + selector: 'app-set-pin-dialog', + templateUrl: './set-pin-dialog.component.html', + styleUrls: ['./set-pin-dialog.component.scss'] +}) +export class SetPinDialogComponent { + pin: string; + constructor(private postsService: PostsService) { + + } + + setPin() { + this.postsService.setPin(this.pin).subscribe(res => { + if (res['success']) { + this.postsService.openSnackBar($localize`Successfully set pin!`); + } + }); + } +} diff --git a/src/app/posts.services.ts b/src/app/posts.services.ts index d02463e..4004c55 100644 --- a/src/app/posts.services.ts +++ b/src/app/posts.services.ts @@ -113,7 +113,8 @@ import { ImportArchiveRequest, Archive, Subscription, - RestartDownloadResponse + RestartDownloadResponse, + PinLoginResponse } from '../api-types'; import { isoLangs } from './settings/locales_list'; import { Title } from '@angular/platform-browser'; @@ -734,7 +735,6 @@ export class PostsService implements CanActivate { return this.http.post(this.path + 'auth/login', body, this.httpOptions); } - // user methods jwtAuth() { const call = this.http.post(this.path + 'auth/jwtAuth', {}, this.httpOptions); call.subscribe(res => { @@ -752,6 +752,12 @@ export class PostsService implements CanActivate { return call; } + // pin methods + pinLogin(pin: string) { + const body: LoginRequest = {username: 'username', password: pin}; + return this.http.post(this.path + 'auth/pinLogin', body, this.httpOptions); + } + logout() { this.user = null; this.permissions = null; @@ -903,6 +909,11 @@ export class PostsService implements CanActivate { this.httpOptions); } + setPin(new_pin: string): Observable { + return this.http.post(this.path + 'setPin', {new_pin: new_pin}, + this.httpOptions); + } + public openSnackBar(message: string, action = ''): void { this.snackBar.open(message, action, { duration: 2000, diff --git a/src/app/settings/settings.component.html b/src/app/settings/settings.component.html index f95bbc6..8f5d0bd 100644 --- a/src/app/settings/settings.component.html +++ b/src/app/settings/settings.component.html @@ -257,6 +257,25 @@ +
+
+
+ Use pin to hide settings +
+
+
+ done Pin set! +
+
+ +
+
+
+
+
diff --git a/src/app/settings/settings.component.scss b/src/app/settings/settings.component.scss index cb89de9..6daa42e 100644 --- a/src/app/settings/settings.component.scss +++ b/src/app/settings/settings.component.scss @@ -110,4 +110,10 @@ position: relative; top: 6px; margin-left: 10px; +} + +.pin-set { + display: flex; + align-items: center; + margin-bottom: 10px; } \ No newline at end of file diff --git a/src/app/settings/settings.component.ts b/src/app/settings/settings.component.ts index f4ccb51..99c6320 100644 --- a/src/app/settings/settings.component.ts +++ b/src/app/settings/settings.component.ts @@ -15,6 +15,7 @@ import { EditCategoryDialogComponent } from 'app/dialogs/edit-category-dialog/ed import { ActivatedRoute, Router } from '@angular/router'; import { Category, DBInfoResponse } from 'api-types'; import { GenerateRssUrlComponent } from 'app/dialogs/generate-rss-url/generate-rss-url.component'; +import { SetPinDialogComponent } from 'app/dialogs/set-pin-dialog/set-pin-dialog.component'; @Component({ selector: 'app-settings', @@ -373,4 +374,8 @@ export class SettingsComponent implements OnInit { maxWidth: '880px' }); } + + openSetPinDialog(): void { + this.dialog.open(SetPinDialogComponent); + } }