1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2024-12-25 02:04:15 +02:00

fixing sharing bugs

This commit is contained in:
Patrik J. Braun 2018-02-03 19:50:42 -05:00
parent 7896b5ae28
commit 6be0d308b7
16 changed files with 153 additions and 113 deletions

View File

@ -18,10 +18,12 @@ export class GalleryMWs {
public static async listDirectory(req: Request, res: Response, next: NextFunction) {
console.log("listDirectory");
let directoryName = req.params.directory || "/";
let absoluteDirectoryName = path.join(ProjectPath.ImageFolder, directoryName);
if (!fs.statSync(absoluteDirectoryName).isDirectory()) {
console.log("not dir");
return next();
}
@ -29,12 +31,15 @@ export class GalleryMWs {
const directory = await ObjectManagerRepository.getInstance().GalleryManager.listDirectory(directoryName, req.query.knownLastModified, req.query.knownLastScanned);
if (directory == null) {
console.log("null dir");
req.resultPipe = new ContentWrapper(null, null, true);
return next();
}
console.log(req.session.user);
console.log(directory);
if (req.session.user.permissions &&
req.session.user.permissions.length > 0 &&
req.session.user.permissions[0] != "/") {
req.session.user.permissions[0] != "/*") {
(<DirectoryDTO>directory).directories = (<DirectoryDTO>directory).directories.filter(d =>
UserDTO.isDirectoryAvailable(d, req.session.user.permissions));
}

View File

@ -62,8 +62,7 @@ export class RenderingMWs {
if (err instanceof ErrorDTO) {
if (err.details) {
if (!(req.session.user && req.session.user.role >= UserRoles.Developer)) {
console.log(err);
Logger.warn("Handled error:", err.details.toString() || err.details);
Logger.warn("Handled error:", err);
delete (err.details);
} else {
try {

View File

@ -90,15 +90,15 @@ export class AuthenticationMWs {
public static authoriseDirectory(req: Request, res: Response, next: NextFunction) {
if (req.session.user.permissions == null ||
req.session.user.permissions.length == 0 ||
req.session.user.permissions[0] == "/") {
req.session.user.permissions[0] == "/*") {
return next();
}
const directoryName = req.params.directory || "/";
if (UserDTO.isPathAvailable(directoryName, req.session.user.permissions) == true) {
return next();
}
return next(new ErrorDTO(ErrorCodes.PERMISSION_DENIED));
}
@ -130,18 +130,6 @@ export class AuthenticationMWs {
return next();
} catch (err) {
//if its a shared link, login as guest
/* try {
const user = Utils.clone(await AuthenticationMWs.getSharingUser(req));
if (user) {
delete (user.password);
req.session.user = user;
return next();
}
} catch (err) {
return next(new ErrorDTO(ErrorCodes.CREDENTIAL_NOT_FOUND, null, err));
}*/
return next(new ErrorDTO(ErrorCodes.CREDENTIAL_NOT_FOUND));
}
@ -167,7 +155,7 @@ export class AuthenticationMWs {
});
if (!sharing || sharing.expires < Date.now() ||
(Config.Client.Sharing.passwordProtected === true
&& sharing.password && !PasswordHelper.comparePassword(password, sharing.password))) {
&& sharing.password && !PasswordHelper.comparePassword(password, sharing.password))) {
return next(new ErrorDTO(ErrorCodes.CREDENTIAL_NOT_FOUND));
}

View File

@ -44,8 +44,7 @@ export class SharingManager implements ISharingManager {
if (sharing.timeStamp < Date.now() - Config.Server.sharing.updateTimeout) {
throw "Sharing is locked, can't update anymore"
}
sharing.password = inSharing.password;
sharing.password = PasswordHelper.cryptPassword(inSharing.password);
sharing.includeSubfolders = inSharing.includeSubfolders;
sharing.expires = inSharing.expires;

View File

@ -1,14 +0,0 @@
export var MessageTypes = {
Client: {
Login: {
Authenticate: "Authenticate"
}
},
Server: {
Login: {
Authenticated: "Authenticated"
}
}
};

View File

@ -1,6 +1,7 @@
import {DirectoryDTO} from "./DirectoryDTO";
import {Utils} from "../Utils";
export enum UserRoles{
export enum UserRoles {
LimitedGuest = 0,
Guest = 1,
User = 2,
@ -20,7 +21,7 @@ export interface UserDTO {
export module UserDTO {
export const isPathAvailable = (path: string, permissions: string[]): boolean => {
if (permissions == null || permissions.length == 0 || permissions[0] == "/") {
if (permissions == null || permissions.length == 0 || permissions[0] == "/*") {
return true;
}
for (let i = 0; i < permissions.length; i++) {
@ -28,19 +29,20 @@ export module UserDTO {
if (permission[permission.length - 1] == "*") {
permission = permission.slice(0, -1);
if (path.startsWith(permission)) {
return true
}
} else {
if (path == permission) {
return true
return true;
}
} else if (path == permission) {
return true;
} else if (path == "." && permission == "/") {
return true;
}
}
return false;
};
export const isDirectoryAvailable = (direcotry: DirectoryDTO, permissions: string[]): boolean => {
return isPathAvailable(Utils.concatUrls(direcotry.path, direcotry.name), permissions);
export const isDirectoryAvailable = (directory: DirectoryDTO, permissions: string[]): boolean => {
return isPathAvailable(Utils.concatUrls(directory.path, directory.name), permissions);
};
}

View File

@ -37,10 +37,10 @@
</div>
<hr/>
<div class="row">
<div class="col-sm-2">
<div class="col-sm-3">
<label class="control-label" i18n>Sharing:</label>
</div>
<div class="col-sm-10">
<div class="col-sm-9">
<input disabled type="text"
class="full-width form-control"
[ngModel]="currentDir">
@ -48,7 +48,7 @@
</div>
<div class="row">
<div class="col-sm-2">
<div class="col-sm-3">
<label class="control-label" i18n>Include subfolders:</label>
</div>
<div class="col-sm-4">
@ -62,23 +62,25 @@
</div>
<div class="row">
<div class="col-sm-2">
<div class="col-sm-3">
<label class="control-label">
<ng-container i18n>Password</ng-container>
:</label>
:
</label>
</div>
<div class="col-sm-4">
<div class="col-sm-6">
<input id="password"
class="form-control"
type="password"
(change)="update()"
[(ngModel)]="input.password"
i18n-placeholder
placeholder="Password">
</div>
</div>
<div class="row">
<div class="col-sm-2">
<div class="col-sm-3">
<label class="control-label" i18n>Valid:</label>
</div>
<div class="col-sm-3" style="padding-right: 1px">
@ -89,13 +91,13 @@
<div class="col-sm-3" style="padding-left: 1px">
<select class="form-control col-md-3" [(ngModel)]="input.valid.type" (change)="update()" name="validType"
required>
<option *ngFor="let repository of validityTypes" [value]="repository.key">{{repository.value}}
</option>
<option value="{{ValidityTypes.Minutes}}" i18n>Minutes</option>
<option value="{{ValidityTypes.Hours}}" i18n>Hours</option>
<option value="{{ValidityTypes.Days}}" i18n>Days</option>
<option value="{{ValidityTypes.Months}}" i18n>Months</option>
</select>
</div>
</div>
</div>
</div>
</div>

View File

@ -29,18 +29,16 @@ export class GalleryShareComponent implements OnInit, OnDestroy {
},
password: ""
};
validityTypes = [];
currentDir: string = "";
sharing: SharingDTO = null;
contentSubscription = null;
passwordProtection = false;
ValidityTypes: any;
constructor(private _sharingService: ShareService,
public _galleryService: GalleryService,
private _notification: NotificationService) {
this.validityTypes = Utils.enumToArray(ValidityTypes);
this.ValidityTypes = ValidityTypes;
}
@ -87,13 +85,14 @@ export class GalleryShareComponent implements OnInit, OnDestroy {
async get() {
this.url = "loading..";
this.sharing = await this._sharingService.createSharing(this.currentDir, this.input.includeSubfolders, this.calcValidity());
console.log(this.sharing);
this.url = Config.Client.publicUrl + "/share/" + this.sharing.sharingKey
}
async showModal() {
await this.get();
this.input.password = "";
this.childModal.show();
document.body.style.paddingRight = "0px";
}
onCopy() {

View File

@ -39,9 +39,7 @@
<div class="checkbox">
<label><input type="checkbox" name="rememberMe" [(ngModel)]="loginCredential.rememberMe" value="">
<ng-container i18n>Remember
me
</ng-container>
<ng-container i18n>Remember me</ng-container>
</label>
</div>

View File

@ -3,7 +3,7 @@ import {ToastsManager} from "ng2-toastr/ng2-toastr";
import {NetworkService} from "./network/network.service";
import {AuthenticationService} from "./network/authentication.service";
import {NotificationDTO, NotificationType} from "../../../common/entities/NotificationDTO";
import {UserDTO} from "../../../common/entities/UserDTO";
import {UserDTO, UserRoles} from "../../../common/entities/UserDTO";
@Injectable()
export class NotificationService {
@ -22,7 +22,8 @@ export class NotificationService {
this._authService.user.subscribe(() => {
if (this._authService.isAuthenticated() &&
(!this.lastUser ||
this.lastUser.id != this._authService.user.value.id)) {
this.lastUser.id != this._authService.user.value.id) &&
this._authService.user.value.role >= UserRoles.Guest) {
this.getServerNotifications();
}
this.lastUser = this._authService.user.value;

View File

@ -15,7 +15,7 @@
</head>
<body style="overflow-y: scroll">
<body style="overflow-y: scroll; padding-right: 0 !important;">
<pi-gallery2-app>Loading...</pi-gallery2-app>
</body>

View File

@ -48,7 +48,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">app/gallery/share/share.gallery.component.ts</context>
<context context-type="linenumber">66</context>
<context context-type="linenumber">67</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/usermanager/usermanager.settings.component.ts</context>
@ -60,12 +60,11 @@
</context-group>
<target>Jelszó</target>
</trans-unit>
<trans-unit id="c67b8aed16c2f80bd4a8d5df636bb333feaa8c78" datatype="html">
<source>Remember
me</source>
<trans-unit id="3eb49d60bd859eb2d9d3a6d380cdf4e0b8252333" datatype="html">
<source>Remember me</source>
<context-group purpose="location">
<context context-type="sourcefile">app/login/login.component.ts</context>
<context context-type="linenumber">41</context>
<context context-type="linenumber">42</context>
</context-group>
<target>Jegyezzen meg</target>
</trans-unit>
@ -74,7 +73,7 @@
</source>
<context-group purpose="location">
<context context-type="sourcefile">app/login/login.component.ts</context>
<context context-type="linenumber">51</context>
<context context-type="linenumber">52</context>
</context-group>
<target>Belépés</target>
</trans-unit>
@ -109,7 +108,7 @@
<source>Link availability</source>
<context-group purpose="location">
<context context-type="sourcefile">app/gallery/gallery.component.ts</context>
<context context-type="linenumber">7</context>
<context context-type="linenumber">8</context>
</context-group>
<target>Link érvényes</target>
</trans-unit>
@ -117,7 +116,7 @@
<source>days</source>
<context-group purpose="location">
<context context-type="sourcefile">app/gallery/gallery.component.ts</context>
<context context-type="linenumber">7</context>
<context context-type="linenumber">10</context>
</context-group>
<target>nap</target>
</trans-unit>
@ -127,7 +126,7 @@
</source>
<context-group purpose="location">
<context context-type="sourcefile">app/gallery/gallery.component.ts</context>
<context context-type="linenumber">35</context>
<context context-type="linenumber">39</context>
</context-group>
<target>Túl sok találat. Pontosítsd a keresést.</target>
</trans-unit>
@ -135,7 +134,7 @@
<source>Searching for:</source>
<context-group purpose="location">
<context context-type="sourcefile">app/gallery/gallery.component.ts</context>
<context context-type="linenumber">40</context>
<context context-type="linenumber">44</context>
</context-group>
<target>Keresés:</target>
</trans-unit>
@ -143,7 +142,7 @@
<source>Logout</source>
<context-group purpose="location">
<context context-type="sourcefile">app/frame/frame.component.ts</context>
<context context-type="linenumber">44</context>
<context context-type="linenumber">45</context>
</context-group>
<target>Kijelentkezés</target>
</trans-unit>
@ -188,10 +187,42 @@
<source>Valid:</source>
<context-group purpose="location">
<context context-type="sourcefile">app/gallery/share/share.gallery.component.ts</context>
<context context-type="linenumber">80</context>
<context context-type="linenumber">82</context>
</context-group>
<target>Érvényes:</target>
</trans-unit>
<trans-unit id="41e62daa962947c0d23ded0981975d1bddf0bf38" datatype="html">
<source>Minutes</source>
<context-group purpose="location">
<context context-type="sourcefile">app/gallery/share/share.gallery.component.ts</context>
<context context-type="linenumber">92</context>
</context-group>
<target>Perc</target>
</trans-unit>
<trans-unit id="3bbce5fef7e1151da052a4e529453edb340e3912" datatype="html">
<source>Hours</source>
<context-group purpose="location">
<context context-type="sourcefile">app/gallery/share/share.gallery.component.ts</context>
<context context-type="linenumber">93</context>
</context-group>
<target>Óra</target>
</trans-unit>
<trans-unit id="a5c3d9d2296f7886e8289b9f623323803deacfc6" datatype="html">
<source>Days</source>
<context-group purpose="location">
<context context-type="sourcefile">app/gallery/share/share.gallery.component.ts</context>
<context context-type="linenumber">94</context>
</context-group>
<target>Nap</target>
</trans-unit>
<trans-unit id="12cc9773650706e6b16eec367da84f99a1e6399c" datatype="html">
<source>Months</source>
<context-group purpose="location">
<context context-type="sourcefile">app/gallery/share/share.gallery.component.ts</context>
<context context-type="linenumber">95</context>
</context-group>
<target>Hónap</target>
</trans-unit>
<trans-unit id="f0acecaa22df19767da6d9990458470b17da3d7a" datatype="html">
<source>Server notifications</source>
<context-group purpose="location">
@ -404,7 +435,7 @@
<source>is need</source>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/map/map.settings.component.ts</context>
<context context-type="linenumber">32</context>
<context context-type="linenumber">33</context>
</context-group>
<target>van szükség</target>
</trans-unit>
@ -413,11 +444,11 @@
</source>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/map/map.settings.component.ts</context>
<context context-type="linenumber">40</context>
<context context-type="linenumber">41</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/thumbnail/thumbanil.settings.component.ts</context>
<context context-type="linenumber">96</context>
<context context-type="linenumber">98</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/search/search.settings.component.ts</context>
@ -442,11 +473,11 @@
</source>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/map/map.settings.component.ts</context>
<context context-type="linenumber">43</context>
<context context-type="linenumber">44</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/thumbnail/thumbanil.settings.component.ts</context>
<context context-type="linenumber">99</context>
<context context-type="linenumber">101</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/search/search.settings.component.ts</context>
@ -474,20 +505,22 @@
</context-group>
<target>Thumbnail beállítások</target>
</trans-unit>
<trans-unit id="6daacb1e448ebb5f72f1d6b1d6f9882dd3ad21f2" datatype="html">
<source>It is highly recommended to use hardware accelerated (sharp or gm) lib for thumbnail generation
<trans-unit id="1b239b0422945f36c35b5559b4b0c135922fe299" datatype="html">
<source>It is highly recommended to use hardware accelerated (sharp or gm) lib for thumbnail
generation
</source>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/thumbnail/thumbanil.settings.component.ts</context>
<context context-type="linenumber">10</context>
</context-group>
<target>Nagyon ajánlott hardveresen gyorsított (sharp vagy gm) könyvtár használata a thumbnail generálásához</target>
<target>Nagyon ajánlott hardveres gyorsított (éles vagy gm) lib használata a miniatűrökhöz
        generáció</target>
</trans-unit>
<trans-unit id="6f49ee2673fb82fe8dd1a7da0bada14a4156bf30" datatype="html">
<source>Thumbnail generation library</source>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/thumbnail/thumbanil.settings.component.ts</context>
<context context-type="linenumber">15</context>
<context context-type="linenumber">16</context>
</context-group>
<target>Thumbnail generáló könyvtár</target>
</trans-unit>
@ -495,7 +528,7 @@
<source>Make sure that sharp node module is installed (npm install sharp).</source>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/thumbnail/thumbanil.settings.component.ts</context>
<context context-type="linenumber">23</context>
<context context-type="linenumber">24</context>
</context-group>
<target>Győződj meg arról, hogy a sharp node modul telepítve van (npm telepítés sharp).</target>
</trans-unit>
@ -503,7 +536,7 @@
<source>Make sure that gm node module and</source>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/thumbnail/thumbanil.settings.component.ts</context>
<context context-type="linenumber">25</context>
<context context-type="linenumber">26</context>
</context-group>
<target>Győződjd meg arról, hogy a gm node modul és</target>
</trans-unit>
@ -511,7 +544,7 @@
<source>GraphicsMagick</source>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/thumbnail/thumbanil.settings.component.ts</context>
<context context-type="linenumber">26</context>
<context context-type="linenumber">27</context>
</context-group>
<target>GraphicsMagick</target>
</trans-unit>
@ -519,7 +552,7 @@
<source>are installed (npm install sharp).</source>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/thumbnail/thumbanil.settings.component.ts</context>
<context context-type="linenumber">26</context>
<context context-type="linenumber">27</context>
</context-group>
<target>telepítve van (npm install éles).</target>
</trans-unit>
@ -527,7 +560,7 @@
<source>Thumbnail folder</source>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/thumbnail/thumbanil.settings.component.ts</context>
<context context-type="linenumber">32</context>
<context context-type="linenumber">33</context>
</context-group>
<target>Thumbnail mappa</target>
</trans-unit>
@ -535,7 +568,7 @@
<source>Thumbnails will be saved in this folder. Write access is required</source>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/thumbnail/thumbanil.settings.component.ts</context>
<context context-type="linenumber">38</context>
<context context-type="linenumber">39</context>
</context-group>
<target>A thumbnail-ek ebben a mappában lesznek elmentve. Írási jog szükséges</target>
</trans-unit>
@ -543,7 +576,7 @@
<source>Thumbnail Quality</source>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/thumbnail/thumbanil.settings.component.ts</context>
<context context-type="linenumber">43</context>
<context context-type="linenumber">44</context>
</context-group>
<target>Thumbnail minőség</target>
</trans-unit>
@ -551,7 +584,7 @@
<source>High quality may be slow. Especially with Jimp.</source>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/thumbnail/thumbanil.settings.component.ts</context>
<context context-type="linenumber">57</context>
<context context-type="linenumber">58</context>
</context-group>
<target>A jó minőségű lassú lehet. Különösen a Jimp esetén.</target>
</trans-unit>
@ -559,7 +592,7 @@
<source>Icon size (used on maps)</source>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/thumbnail/thumbanil.settings.component.ts</context>
<context context-type="linenumber">72</context>
<context context-type="linenumber">73</context>
</context-group>
<target>Ikonméret (térképeken használva)</target>
</trans-unit>
@ -567,7 +600,7 @@
<source>Thumbnail sizes</source>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/thumbnail/thumbanil.settings.component.ts</context>
<context context-type="linenumber">78</context>
<context context-type="linenumber">79</context>
</context-group>
<target>Thumbnail méretek</target>
</trans-unit>
@ -575,7 +608,7 @@
<source>Size of the thumbnails.</source>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/thumbnail/thumbanil.settings.component.ts</context>
<context context-type="linenumber">85</context>
<context context-type="linenumber">86</context>
</context-group>
<target>A thumbnail mérete.</target>
</trans-unit>
@ -583,7 +616,7 @@
<source>The best matching size will be generated. (More size gives better quality, but use storage to store and CPU to render.)</source>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/thumbnail/thumbanil.settings.component.ts</context>
<context context-type="linenumber">86</context>
<context context-type="linenumber">87</context>
</context-group>
<target>A legjobban egyezett méret lesz generálva. (Több méret lehetőség jobb minőségéet eredményez, de processzort és tárhelyet fogyaszt)</target>
</trans-unit>
@ -591,7 +624,7 @@
<source>';' separated integers. If size is 200, tha thumbnail will have 200^2 pixels.</source>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/thumbnail/thumbanil.settings.component.ts</context>
<context context-type="linenumber">87</context>
<context context-type="linenumber">89</context>
</context-group>
<target>';'-val elválasztott egész számok. Ha a méret 200, akkor a thumnail-ok 200^2 pixelből fognak állni.</target>
</trans-unit>
@ -861,7 +894,7 @@
<source>Set the reindexing sensitivity. High value check the folders for change more often</source>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/indexing/indexing.settings.component.ts</context>
<context context-type="linenumber">44</context>
<context context-type="linenumber">45</context>
</context-group>
<target>Állítsa be az újraindexelés érzékenységét. A magasabb érzékenység gyarkabban ellenőrzi a mappákat válztozás</target>
</trans-unit>
@ -870,7 +903,7 @@
</source>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/indexing/indexing.settings.component.ts</context>
<context context-type="linenumber">51</context>
<context context-type="linenumber">52</context>
</context-group>
<target>Mentés</target>
</trans-unit>
@ -879,7 +912,7 @@
</source>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/indexing/indexing.settings.component.ts</context>
<context context-type="linenumber">54</context>
<context context-type="linenumber">55</context>
</context-group>
<target>Visszaállítás</target>
</trans-unit>
@ -887,7 +920,7 @@
<source>If you add a new folder to your gallery, the site indexes it automatically.</source>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/indexing/indexing.settings.component.ts</context>
<context context-type="linenumber">60</context>
<context context-type="linenumber">61</context>
</context-group>
<target>Ha új mappát ad hozzá a galériához, a webhely automatikusan indexeli.</target>
</trans-unit>
@ -895,7 +928,7 @@
<source>If you would like to trigger indexing manually, click index button.</source>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/indexing/indexing.settings.component.ts</context>
<context context-type="linenumber">61</context>
<context context-type="linenumber">62</context>
</context-group>
<target>Ha kézzel szeretné indítani az indexelést, kattintson az index gombra.</target>
</trans-unit>
@ -903,7 +936,7 @@
<source>Note: search ony searched among the indexed directories</source>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/indexing/indexing.settings.component.ts</context>
<context context-type="linenumber">62</context>
<context context-type="linenumber">65</context>
</context-group>
<target>Megjegyzés: a keresés csak az indexelet mappákban működik</target>
</trans-unit>
@ -912,7 +945,7 @@
</source>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/indexing/indexing.settings.component.ts</context>
<context context-type="linenumber">84</context>
<context context-type="linenumber">88</context>
</context-group>
<target>Index</target>
</trans-unit>
@ -921,7 +954,7 @@
</source>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/indexing/indexing.settings.component.ts</context>
<context context-type="linenumber">89</context>
<context context-type="linenumber">93</context>
</context-group>
<target>Mégse</target>
</trans-unit>
@ -930,10 +963,10 @@
</source>
<context-group purpose="location">
<context context-type="sourcefile">app/settings/indexing/indexing.settings.component.ts</context>
<context context-type="linenumber">93</context>
<context context-type="linenumber">97</context>
</context-group>
<target>Indexek törlése</target>
</trans-unit>
</body>
</file>
</xliff>
</xliff>

View File

@ -17,6 +17,7 @@ gulp.task('build-backend', function () {
});
var createFornendTask = function (tpye, script) {
//console.log(tpye, script);
gulp.task(tpye, function (cb) {
exec(script, function (err, stdout, stderr) {
console.log(stdout);
@ -38,7 +39,7 @@ gulp.task('build-frontend', function (done) {
createFornendTask('build-frontend-release default', "ng build --aot -prod --output-path=./release/dist --no-progress");
tasks.push('build-frontend-release default');
for (var i = 0; i < files.length; i++) {
createFornendTask('build-frontend-release ' + languages[i], "ng build --aot -prod --output-path=./release/dist/" + languages[i] + " --no-progress --locale " + languages[i] + " --i18n-format xlf --i18n-file frontend/locale/" + files[i] + " --missing-translation warning");
createFornendTask('build-frontend-release ' + languages[i], "ng build --aot -prod --output-path=./release/dist/" + languages[i] + " --no-progress --locale=" + languages[i] + " --i18n-format xlf --i18n-file frontend/locale/" + files[i] + " --missing-translation warning");
tasks.push('build-frontend-release ' + languages[i]);
}
tasks.push(function () {
@ -100,7 +101,7 @@ var simpleBuild = function (isProd) {
createFornendTask('build-frontend default', cmd + "--output-path=./dist --no-progress");
tasks.push('build-frontend default');
for (var i = 0; i < files.length; i++) {
createFornendTask('build-frontend ' + languages[i], cmd + "--output-path=./dist/" + languages[i] + " --no-progress --locale " + languages[i] + " --i18n-format xlf --i18n-file frontend/locale/" + files[i] + " --missing-translation warning");
createFornendTask('build-frontend ' + languages[i], cmd + "--output-path=./dist/" + languages[i] + " --no-progress --locale " + languages[i] + " --i18n-format=xlf --i18n-file=frontend/locale/" + files[i] + " --missing-translation warning");
tasks.push('build-frontend ' + languages[i]);
}
tasks.push(function () {

View File

@ -11,7 +11,7 @@
"install": "tsc && gulp build-prod",
"build-release": "gulp build-release",
"pretest": "tsc",
"test": "ng test --single-run && mocha --recursive test/backend/unit && mocha --recursive test/backend/integration",
"test": "ng test --single-run && mocha --recursive test/backend/unit && mocha --recursive test/backend/integration && mocha --recursive test/common/unit ",
"start": "node ./backend/index",
"ng": "ng",
"lint": "ng lint",

1
test/common/mocha.opts Normal file
View File

@ -0,0 +1 @@
--recursive

View File

@ -0,0 +1,26 @@
import {expect} from "chai";
import {UserDTO} from "../../../common/entities/UserDTO";
describe('UserDTO', () => {
it('should check available path', () => {
expect(UserDTO.isPathAvailable("/", ["/"])).to.be.equals(true);
expect(UserDTO.isPathAvailable("/", ["/subfolder", "/"])).to.be.equals(true);
expect(UserDTO.isPathAvailable("/abc", ["/subfolder", "/"])).to.be.equals(false);
expect(UserDTO.isPathAvailable("/abc", ["/subfolder", "/*"])).to.be.equals(true);
expect(UserDTO.isPathAvailable("/abc", ["/subfolder"])).to.be.equals(false);
expect(UserDTO.isPathAvailable("/abc/two", ["/subfolder"])).to.be.equals(false);
expect(UserDTO.isPathAvailable("/abc/two", ["/"])).to.be.equals(false);
expect(UserDTO.isPathAvailable("/abc/two", ["/*"])).to.be.equals(true);
});
it('should check directory', () => {
expect(UserDTO.isDirectoryAvailable(<any>{path: "/", name: "abc"}, ["/*"])).to.be.equals(true);
expect(UserDTO.isDirectoryAvailable(<any>{path: "/", name: "abc"}, ["/"])).to.be.equals(false);
expect(UserDTO.isDirectoryAvailable(<any>{path: ".\\", name: "."}, ["/"])).to.be.equals(true);
expect(UserDTO.isDirectoryAvailable(<any>{path: "/", name: "abc"}, ["/*", "/asdad"])).to.be.equals(true);
});
});