Skip to content

Commit

Permalink
Merge pull request #86 from mvdicarlo/develop
Browse files Browse the repository at this point in the history
v2.3.32
  • Loading branch information
mvdicarlo authored Jun 18, 2021
2 parents 5ac5c73 + f4f528c commit 51966b3
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 12 deletions.
2 changes: 1 addition & 1 deletion electron/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postybirb",
"version": "2.3.31",
"version": "2.3.32",
"description": "PostyBirb is an application that helps artists post art and other multimedia to multiple websites more quickly.",
"main": "main.js",
"scripts": {
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postybirb",
"version": "2.3.31",
"version": "2.3.32",
"scripts": {
"ng": "ng",
"compile": "ng build --vendor-chunk=false",
Expand All @@ -25,7 +25,7 @@
"@fortawesome/fontawesome-free": "^5.6.3",
"@ngx-translate/core": "^11.0.1",
"@ngx-translate/http-loader": "^4.0.0",
"@tinymce/tinymce-angular": "^3.3.1",
"@tinymce/tinymce-angular": "~3.3.1",
"angular2-hotkeys": "~2.1.4",
"bootstrap-css-only": "^4.2.1",
"core-js": "^2.5.4",
Expand Down
5 changes: 3 additions & 2 deletions src/app/app.error.logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ export class ErrorLoggerHandler extends ErrorHandler {
if (this.seenList.includes(error.message)) return;
this.seenList.push(error.message);
if (error.message) {
this.http.post('https://postybirb-error-server.now.sh/log/error', { errorLog: error })
.subscribe(res => console.debug('Error logging success', res), err => console.debug('Error logging failure', err));
// Haven't logged errors to any server in a long time
// this.http.post('https://postybirb-error-server.now.sh/log/error', { errorLog: error })
// .subscribe(res => console.debug('Error logging success', res), err => console.debug('Error logging failure', err));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ function descriptionParse(html: string): string {
.replace(/\n/g, '');
}

interface DeviantArtFolder {
description: string;
folderid: string;
has_subfolders: boolean;
name: string;
parent?: string;
subfolders: DeviantArtFolder[];
}

@Injectable({
providedIn: 'root'
})
Expand Down Expand Up @@ -150,13 +159,31 @@ export class DeviantArt extends BaseWebsiteService implements WebsiteService {
});
}

private flattenFolders(folder: DeviantArtFolder): DeviantArtFolder[] {
const folders = [folder];

if (!folder) {
return [];
}

if (!folder.has_subfolders) {
return folders;
}

folder.subfolders.forEach(sf => folders.push(...this.flattenFolders(sf)))
return folders;
}

private async _getFolders(profileId: string, accessToken: string): Promise<void> {
const folderResponse = await got.get(`${this.BASE_URL}/api/v1/oauth2/gallery/folders?calculate_size=false&limit=50&access_token=${accessToken}`, this.BASE_URL, [], profileId);
const results = (JSON.parse(folderResponse.body).results || []);
const folders: Folder[] = [];

results.forEach(folder => {
const parent = folder.parent ? results.find(f => f.folderid === folder.parent && f.name !== 'Featured') : undefined;
const flattenedFolders: DeviantArtFolder[] = [];
results.forEach((r: DeviantArtFolder) => flattenedFolders.push(...this.flattenFolders(r)));

flattenedFolders.forEach(folder => {
const parent = folder.parent ? flattenedFolders.find(f => f.folderid === folder.parent && f.name !== 'Featured') : undefined;
folders.push({
id: folder.folderid,
title: parent ? `${parent.name} / ${folder.name}` : folder.name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ export class FurryNetwork extends BaseWebsiteService implements WebsiteService {

formatTags(defaultTags: string[] = [], other: string[] = []): any {
return super.formatTags(defaultTags, other, '-').filter(tag => tag.length <= 30 && tag.length >= 3)
.map(tag => { return tag.replace(/(\(|\)|:|#|;|\]|\[|')/g, '').replace(/(\\|\/)/g, '-').replace(/\?/g, 'unknown') })
.map(tag => { return tag.replace(/(\(|\)|:|#|;|\]|\[|'|\.)/g, '').replace(/(\\|\/)/g, '-').replace(/\?/g, 'unknown') })
.filter(tag => tag.length >= 3)
.slice(0, 30);
}
Expand Down

0 comments on commit 51966b3

Please sign in to comment.