1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2025-01-14 14:43:17 +08:00

fixing building errors

This commit is contained in:
Patrik J. Braun 2022-04-25 18:36:18 +02:00
parent b1c9827729
commit 782cf78b03
8 changed files with 40 additions and 83 deletions

View File

@ -157,7 +157,7 @@ export class GalleryMWs {
return next();
}
const cw: ContentWrapper = req.resultPipe;
const cw = req.resultPipe as ContentWrapper;
if (cw.notModified === true) {
return next();
}
@ -253,7 +253,7 @@ export class GalleryMWs {
if (!req.resultPipe) {
return next();
}
const fullMediaPath: string = req.resultPipe;
const fullMediaPath = req.resultPipe as string;
const convertedVideo =
VideoProcessing.generateConvertedFilePath(fullMediaPath);

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import {LoginCredential} from '../../../common/entities/LoginCredential';
import {UserDTO} from '../../../common/entities/UserDTO';
@ -12,7 +13,7 @@ declare global {
}
interface Response {
tpl?: any;
tpl?: Record<string, any>;
}
interface Session {

View File

@ -5,34 +5,6 @@ import { Utils } from '../../../common/Utils';
import {Config} from '../../../common/config/private/Config';
export class UserMWs {
public static async changePassword(
req: Request,
res: Response,
next: NextFunction
): Promise<void> {
if (Config.Client.authenticationRequired === false) {
return next(new ErrorDTO(ErrorCodes.USER_MANAGEMENT_DISABLED));
}
if (
typeof req.body === 'undefined' ||
typeof req.body.userModReq === 'undefined' ||
typeof req.body.userModReq.id === 'undefined' ||
typeof req.body.userModReq.oldPassword === 'undefined' ||
typeof req.body.userModReq.newPassword === 'undefined'
) {
return next();
}
try {
await ObjectManagers.getInstance().UserManager.changePassword(
req.body.userModReq
);
return next();
} catch (err) {
return next(new ErrorDTO(ErrorCodes.GENERAL_ERROR, null, err));
}
}
public static async createUser(
req: Request,
res: Response,

View File

@ -86,10 +86,6 @@ export class UserManager implements IUserManager {
}
}
public async changePassword(request: any): Promise<void> {
throw new Error('not implemented'); // TODO: implement
}
private loadDB(): void {
const data = fs.readFileSync(this.dbPath, 'utf8');
this.db = JSON.parse(data);

View File

@ -11,7 +11,6 @@ export class UserRouter {
this.addLogin(app);
this.addLogout(app);
this.addGetSessionUser(app);
this.addChangePassword(app);
this.addCreateUser(app);
this.addDeleteUser(app);
@ -47,17 +46,6 @@ export class UserRouter {
);
}
private static addChangePassword(app: Express): void {
app.post(
'/api/user/:id/password',
AuthenticationMWs.authenticate,
UserRequestConstrainsMWs.forceSelfRequest,
UserMWs.changePassword,
ServerTimingMWs.addServerTiming,
RenderingMWs.renderOK
);
}
private static addCreateUser(app: Express): void {
app.put(
'/api/user',

View File

@ -174,7 +174,8 @@ export class Utils {
public static enumToArray(EnumType: any): { key: number; value: string }[] {
const arr: Array<{ key: number; value: string }> = [];
for (const enumMember in EnumType) {
if (!EnumType.hasOwn(enumMember)) {
// eslint-disable-next-line no-prototype-builtins
if (!EnumType.hasOwnProperty(enumMember)) {
continue;
}
const key = parseInt(enumMember, 10);

View File

@ -18,7 +18,8 @@ export class ThumbnailLoaderService {
que: Array<ThumbnailTask> = [];
runningRequests = 0;
constructor(private galleryCacheService: GalleryCacheService) {}
constructor(private galleryCacheService: GalleryCacheService) {
}
run = (): void => {
if (
@ -191,7 +192,7 @@ export class ThumbnailLoaderService {
const i = this.que.indexOf(task);
if (i === -1) {
if (task.taskEntities.length !== 0) {
console.error("ThumbnailLoader: can't find poolTask to remove");
console.error('ThumbnailLoader: can\'t find poolTask to remove');
}
return;
}
@ -202,7 +203,7 @@ export class ThumbnailLoaderService {
export interface ThumbnailLoadingListener {
onStartedLoading: () => void;
onLoad: () => void;
onError: (error: Error) => void;
onError: (error: Event | string) => void;
}
export interface ThumbnailTaskEntity {

View File

@ -1,9 +1,6 @@
import {EventEmitter, Injectable} from '@angular/core';
import {BehaviorSubject} from 'rxjs';
import {
JobProgressDTO,
JobProgressStates,
} from '../../../../common/entities/job/JobProgressDTO';
import {JobProgressDTO, JobProgressStates,} from '../../../../common/entities/job/JobProgressDTO';
import {NetworkService} from '../../model/network/network.service';
import {JobScheduleDTO} from '../../../../common/entities/job/JobScheduleDTO';
import {JobDTOUtils} from '../../../../common/entities/job/JobDTO';
@ -12,7 +9,7 @@ import { NotificationService } from '../../model/notification.service';
@Injectable()
export class ScheduledJobsService {
public progress: BehaviorSubject<{ [key: string]: JobProgressDTO }>;
public progress: BehaviorSubject<Record<string, JobProgressDTO>>;
public onJobFinish: EventEmitter<string> = new EventEmitter<string>();
timer: number = null;
public jobStartingStopping: { [key: string]: boolean } = {};
@ -86,7 +83,8 @@ export class ScheduledJobsService {
);
for (const prg of Object.keys(prevPrg)) {
if (
!this.progress.value.hasOwn(prg) ||
// eslint-disable-next-line no-prototype-builtins
!(this.progress.value).hasOwnProperty(prg) ||
// state changed from running to finished
((prevPrg[prg].state === JobProgressStates.running ||
prevPrg[prg].state === JobProgressStates.cancelling) &&