diff --git a/backend/app.js b/backend/app.js
index 9db6c71..88b5313 100644
--- a/backend/app.js
+++ b/backend/app.js
@@ -96,7 +96,6 @@ db.defaults(
configWriteFlag: false,
downloads: {},
subscriptions: [],
- pin_md5: '',
files_to_db_migration_complete: false
}).write();
@@ -2623,49 +2622,6 @@ app.post('/api/updateServer', async (req, res) => {
});
-// Pin API calls
-
-app.post('/api/isPinSet', async (req, res) => {
- let stored_pin = db.get('pin_md5').value();
- let is_set = false;
- if (!stored_pin || stored_pin.length === 0) {
- } else {
- is_set = true;
- }
-
- res.send({
- is_set: is_set
- });
-});
-
-app.post('/api/setPin', async (req, res) => {
- let unhashed_pin = req.body.pin;
- let hashed_pin = md5(unhashed_pin);
-
- db.set('pin_md5', hashed_pin).write();
-
- res.send({
- success: true
- });
-});
-
-app.post('/api/checkPin', async (req, res) => {
- let input_pin = req.body.input_pin;
- let input_pin_md5 = md5(input_pin);
-
- let stored_pin = db.get('pin_md5').value();
-
- let successful = false;
-
- if (input_pin_md5 === stored_pin) {
- successful = true;
- }
-
- res.send({
- success: successful
- });
-});
-
// API Key API calls
app.post('/api/generateNewAPIKey', function (req, res) {
diff --git a/backend/consts.js b/backend/consts.js
index e3a017c..86b5dd8 100644
--- a/backend/consts.js
+++ b/backend/consts.js
@@ -66,10 +66,6 @@ let CONFIG_ITEMS = {
'key': 'ytdl_allow_multi_download_mode',
'path': 'YoutubeDLMaterial.Extra.allow_multi_download_mode'
},
- 'ytdl_settings_pin_required': {
- 'key': 'ytdl_settings_pin_required',
- 'path': 'YoutubeDLMaterial.Extra.settings_pin_required'
- },
'ytdl_enable_downloads_manager': {
'key': 'ytdl_enable_downloads_manager',
'path': 'YoutubeDLMaterial.Extra.enable_downloads_manager'
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index ede2bc9..aab27fb 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -21,7 +21,6 @@ import { Router, NavigationStart, NavigationEnd } from '@angular/router';
import { OverlayContainer } from '@angular/cdk/overlay';
import { THEMES_CONFIG } from '../themes';
import { SettingsComponent } from './settings/settings.component';
-import { CheckOrSetPinDialogComponent } from './dialogs/check-or-set-pin-dialog/check-or-set-pin-dialog.component';
import { AboutDialogComponent } from './dialogs/about-dialog/about-dialog.component';
import { UserProfileDialogComponent } from './dialogs/user-profile-dialog/user-profile-dialog.component';
import { SetDefaultAdminDialogComponent } from './dialogs/set-default-admin-dialog/set-default-admin-dialog.component';
@@ -42,8 +41,6 @@ export class AppComponent implements OnInit {
allowThemeChange = null;
allowSubscriptions = false;
enableDownloadsManager = false;
- // defaults to true to prevent attack
- settingsPinRequired = true;
@ViewChild('sidenav') sidenav: MatSidenav;
@ViewChild('hamburgerMenu', { read: ElementRef }) hamburgerMenuButton: ElementRef;
@@ -79,7 +76,6 @@ export class AppComponent implements OnInit {
loadConfig() {
// loading config
this.topBarTitle = this.postsService.config['Extra']['title_top'];
- this.settingsPinRequired = this.postsService.config['Extra']['settings_pin_required'];
const themingExists = this.postsService.config['Themes'];
this.defaultTheme = themingExists ? this.postsService.config['Themes']['default_theme'] : 'default';
this.allowThemeChange = themingExists ? this.postsService.config['Themes']['allow_theme_change'] : true;
@@ -175,31 +171,11 @@ onSetTheme(theme, old_theme) {
}
openSettingsDialog() {
- if (this.settingsPinRequired) {
- this.openPinDialog();
- } else {
- this.actuallyOpenSettingsDialog();
- }
- }
-
- actuallyOpenSettingsDialog() {
const dialogRef = this.dialog.open(SettingsComponent, {
width: '80vw'
});
}
- openPinDialog() {
- const dialogRef = this.dialog.open(CheckOrSetPinDialogComponent, {
- });
-
- dialogRef.afterClosed().subscribe(res => {
- if (res) {
- this.actuallyOpenSettingsDialog();
- }
- });
-
- }
-
openAboutDialog() {
const dialogRef = this.dialog.open(AboutDialogComponent, {
width: '80vw'
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index dd67a3c..0bacb30 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -51,7 +51,6 @@ import { SubscriptionComponent } from './subscription//subscription/subscription
import { SubscriptionFileCardComponent } from './subscription/subscription-file-card/subscription-file-card.component';
import { SubscriptionInfoDialogComponent } from './dialogs/subscription-info-dialog/subscription-info-dialog.component';
import { SettingsComponent } from './settings/settings.component';
-import { CheckOrSetPinDialogComponent } from './dialogs/check-or-set-pin-dialog/check-or-set-pin-dialog.component';
import { MatChipsModule } from '@angular/material/chips';
import { NgxFileDropModule } from 'ngx-file-drop';
@@ -96,7 +95,6 @@ export function isVisible({ event, element, scrollContainer, offset }: IsVisible
SubscriptionFileCardComponent,
SubscriptionInfoDialogComponent,
SettingsComponent,
- CheckOrSetPinDialogComponent,
AboutDialogComponent,
VideoInfoDialogComponent,
ArgModifierDialogComponent,
@@ -169,8 +167,7 @@ export function isVisible({ event, element, scrollContainer, offset }: IsVisible
CreatePlaylistComponent,
SubscribeDialogComponent,
SubscriptionInfoDialogComponent,
- SettingsComponent,
- CheckOrSetPinDialogComponent
+ SettingsComponent
],
providers: [
PostsService
diff --git a/src/app/dialogs/check-or-set-pin-dialog/check-or-set-pin-dialog.component.html b/src/app/dialogs/check-or-set-pin-dialog/check-or-set-pin-dialog.component.html
deleted file mode 100644
index 082df0e..0000000
--- a/src/app/dialogs/check-or-set-pin-dialog/check-or-set-pin-dialog.component.html
+++ /dev/null
@@ -1,18 +0,0 @@
-
{{dialog_title}}
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/app/dialogs/check-or-set-pin-dialog/check-or-set-pin-dialog.component.scss b/src/app/dialogs/check-or-set-pin-dialog/check-or-set-pin-dialog.component.scss
deleted file mode 100644
index 3bdb589..0000000
--- a/src/app/dialogs/check-or-set-pin-dialog/check-or-set-pin-dialog.component.scss
+++ /dev/null
@@ -1,6 +0,0 @@
-.spinner-div {
- position: absolute;
- margin: 0 auto;
- top: 30%;
- left: 42%;
-}
\ No newline at end of file
diff --git a/src/app/dialogs/check-or-set-pin-dialog/check-or-set-pin-dialog.component.spec.ts b/src/app/dialogs/check-or-set-pin-dialog/check-or-set-pin-dialog.component.spec.ts
deleted file mode 100644
index 0f200b2..0000000
--- a/src/app/dialogs/check-or-set-pin-dialog/check-or-set-pin-dialog.component.spec.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { CheckOrSetPinDialogComponent } from './check-or-set-pin-dialog.component';
-
-describe('CheckOrSetPinDialogComponent', () => {
- let component: CheckOrSetPinDialogComponent;
- let fixture: ComponentFixture;
-
- beforeEach(async(() => {
- TestBed.configureTestingModule({
- declarations: [ CheckOrSetPinDialogComponent ]
- })
- .compileComponents();
- }));
-
- beforeEach(() => {
- fixture = TestBed.createComponent(CheckOrSetPinDialogComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-});
diff --git a/src/app/dialogs/check-or-set-pin-dialog/check-or-set-pin-dialog.component.ts b/src/app/dialogs/check-or-set-pin-dialog/check-or-set-pin-dialog.component.ts
deleted file mode 100644
index e0ed79c..0000000
--- a/src/app/dialogs/check-or-set-pin-dialog/check-or-set-pin-dialog.component.ts
+++ /dev/null
@@ -1,96 +0,0 @@
-import { Component, OnInit, Inject } from '@angular/core';
-import { PostsService } from 'app/posts.services';
-import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
-import { MatSnackBar } from '@angular/material/snack-bar';
-
-@Component({
- selector: 'app-check-or-set-pin-dialog',
- templateUrl: './check-or-set-pin-dialog.component.html',
- styleUrls: ['./check-or-set-pin-dialog.component.scss']
-})
-export class CheckOrSetPinDialogComponent implements OnInit {
-
- pinSetChecked = false;
- pinSet = true;
- resetMode = false;
- dialog_title = '';
- input_placeholder = null;
- input = '';
- button_label = '';
-
- constructor(private postsService: PostsService, @Inject(MAT_DIALOG_DATA) public data: any,
- public dialogRef: MatDialogRef, private snackBar: MatSnackBar) { }
-
- ngOnInit() {
- if (this.data) {
- this.resetMode = this.data.resetMode;
- }
-
- if (this.resetMode) {
- this.pinSetChecked = true;
- this.notSetLogic();
- } else {
- this.isPinSet();
- }
- }
-
- isPinSet() {
- this.postsService.isPinSet().subscribe(res => {
- this.pinSetChecked = true;
- if (res['is_set']) {
- this.isSetLogic();
- } else {
- this.notSetLogic();
- }
- });
- }
-
- isSetLogic() {
- this.pinSet = true;
- this.dialog_title = 'Pin Required';
- this.input_placeholder = 'Pin';
- this.button_label = 'Submit'
- }
-
- notSetLogic() {
- this.pinSet = false;
- this.dialog_title = 'Set your pin';
- this.input_placeholder = 'New pin';
- this.button_label = 'Set Pin'
- }
-
- doAction() {
- // pin set must have been checked, and input must not be empty
- if (!this.pinSetChecked || this.input.length === 0) {
- return;
- }
-
- if (this.pinSet) {
- this.postsService.checkPin(this.input).subscribe(res => {
- if (res['success']) {
- this.dialogRef.close(true);
- } else {
- this.dialogRef.close(false);
- this.openSnackBar('Pin is incorrect!');
- }
- });
- } else {
- this.postsService.setPin(this.input).subscribe(res => {
- if (res['success']) {
- this.dialogRef.close(true);
- this.openSnackBar('Pin successfully set!');
- } else {
- this.dialogRef.close(false);
- this.openSnackBar('Failed to set pin!');
- }
- });
- }
- }
-
- public openSnackBar(message: string, action: string = '') {
- this.snackBar.open(message, action, {
- duration: 2000,
- });
- }
-
-}
diff --git a/src/app/posts.services.ts b/src/app/posts.services.ts
index 4399986..b334c1e 100644
--- a/src/app/posts.services.ts
+++ b/src/app/posts.services.ts
@@ -242,18 +242,6 @@ export class PostsService implements CanActivate {
return this.http.post(this.path + 'clearAllLogs', {}, this.httpOptions);
}
- isPinSet() {
- return this.http.post(this.path + 'isPinSet', {}, this.httpOptions);
- }
-
- setPin(unhashed_pin) {
- return this.http.post(this.path + 'setPin', {pin: unhashed_pin}, this.httpOptions);
- }
-
- checkPin(unhashed_pin) {
- return this.http.post(this.path + 'checkPin', {input_pin: unhashed_pin}, this.httpOptions);
- }
-
generateNewAPIKey() {
return this.http.post(this.path + 'generateNewAPIKey', {}, this.httpOptions);
}
diff --git a/src/app/settings/settings.component.html b/src/app/settings/settings.component.html
index c503445..aa0de60 100644
--- a/src/app/settings/settings.component.html
+++ b/src/app/settings/settings.component.html
@@ -186,10 +186,6 @@
Allow multi-download mode
-
- Require pin for settings
-
-
diff --git a/src/app/settings/settings.component.ts b/src/app/settings/settings.component.ts
index bb76a2e..142be3c 100644
--- a/src/app/settings/settings.component.ts
+++ b/src/app/settings/settings.component.ts
@@ -1,6 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { PostsService } from 'app/posts.services';
-import { CheckOrSetPinDialogComponent } from 'app/dialogs/check-or-set-pin-dialog/check-or-set-pin-dialog.component';
import { isoLangs } from './locales_list';
import { MatSnackBar } from '@angular/material/snack-bar';
import {DomSanitizer} from '@angular/platform-browser';
@@ -77,14 +76,6 @@ export class SettingsComponent implements OnInit {
})
}
- setNewPin() {
- const dialogRef = this.dialog.open(CheckOrSetPinDialogComponent, {
- data: {
- resetMode: true
- }
- });
- }
-
generateAPIKey() {
this.postsService.generateNewAPIKey().subscribe(res => {
if (res['new_api_key']) {