Skip to content

Commit

Permalink
Merge pull request #119 from mvdicarlo/develop
Browse files Browse the repository at this point in the history
v2.3.43
  • Loading branch information
mvdicarlo authored May 1, 2022
2 parents 0a2f00d + 9bcd145 commit 44c8aba
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 86 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.41",
"version": "2.3.42",
"description": "PostyBirb is an application that helps artists post art and other multimedia to multiple websites more quickly.",
"main": "main.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postybirb",
"version": "2.3.41",
"version": "2.3.42",
"scripts": {
"ng": "ng",
"compile": "ng build --vendor-chunk=false",
Expand Down
55 changes: 26 additions & 29 deletions src/app/websites/website-services/derpibooru/derpibooru.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import { getTags, supportsFileType } from '../../helpers/website-validator.helpe
import { getTypeOfSubmission, TypeOfSubmission } from 'src/app/utils/enums/type-of-submission.enum';
import { MBtoBytes, fileAsFormDataObject } from 'src/app/utils/helpers/file.helper';
import { Website } from '../../decorators/website-decorator';
import { PlaintextParser } from 'src/app/utils/helpers/description-parsers/plaintext.parser';
import { DerpibooruSubmissionForm } from './components/derpibooru-submission-form/derpibooru-submission-form.component';
import { BaseWebsiteService } from '../base-website-service';
import { WebsiteStatus, LoginStatus, SubmissionPostData, PostResult } from '../../interfaces/website-service.interface';
import { SubmissionRating } from 'src/app/database/tables/submission.table';
import { BrowserWindowHelper } from 'src/app/utils/helpers/browser-window.helper';
import { Promisify } from 'src/app/utils/helpers/promisify.helper';
import { MarkdownParser } from 'src/app/utils/helpers/description-parsers/markdown.parser';

const ACCEPTED_FILES = ['jpeg', 'jpg', 'png', 'svg', 'gif', 'webm']

Expand All @@ -36,30 +36,30 @@ function validate(submission: Submission, formData: SubmissionFormData): any[] {
return problems;
}

function descriptionPreparser(html: string): string {
if (!html) return '';

html = html.replace(/<b>/gi, '*');
html = html.replace(/<i>/gi, '_');
html = html.replace(/<u>/gi, '+');
html = html.replace(/<s>/gi, '-');
html = html.replace(/<\/b>/gi, '*');
html = html.replace(/<\/i>/gi, '_');
html = html.replace(/<\/u>/gi, '+');
html = html.replace(/<\/s>/gi, '-');
html = html.replace(/<em>/gi, '_');
html = html.replace(/<\/em>/gi, '_');
html = html.replace(/<strong>/gi, '*');
html = html.replace(/<\/strong>/gi, '*');
html = html.replace(/<a(.*?)href="(.*?)"(.*?)>(.*?)<\/a>/gi, '"$4":$2');

return html;
}

function descriptionParser(html: string): string {
html = html.replace(/<a(.*?)href="(.*?)"(.*?)>(.*?)<\/a>/gi, '"$4":$2');
return html;
}
// function descriptionPreparser(html: string): string {
// if (!html) return '';

// html = html.replace(/<b>/gi, '*');
// html = html.replace(/<i>/gi, '_');
// html = html.replace(/<u>/gi, '+');
// html = html.replace(/<s>/gi, '-');
// html = html.replace(/<\/b>/gi, '*');
// html = html.replace(/<\/i>/gi, '_');
// html = html.replace(/<\/u>/gi, '+');
// html = html.replace(/<\/s>/gi, '-');
// html = html.replace(/<em>/gi, '_');
// html = html.replace(/<\/em>/gi, '_');
// html = html.replace(/<strong>/gi, '*');
// html = html.replace(/<\/strong>/gi, '*');
// html = html.replace(/<a(.*?)href="(.*?)"(.*?)>(.*?)<\/a>/gi, '"$4":$2');

// return html;
// }

// function descriptionParser(html: string): string {
// html = html.replace(/<a(.*?)href="(.*?)"(.*?)>(.*?)<\/a>/gi, '"$4":$2');
// return html;
// }

@Injectable({
providedIn: 'root'
Expand All @@ -77,11 +77,8 @@ function descriptionParser(html: string): string {
validators: {
submission: validate
},
preparsers: {
description: [descriptionPreparser]
},
parsers: {
description: [descriptionParser, PlaintextParser.parse],
description: [MarkdownParser.parse],
disableAdvertise: true,
usernameShortcut: {
code: 'db',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
<form [formGroup]="formGroup">
<div class="section">
<mat-form-field color="accent">
<input
#titleInput
matInput
[placeholder]="'Title' | translate"
formControlName="title"
maxlength="50"
/>
<input #titleInput matInput [placeholder]="'Title' | translate" formControlName="title" maxlength="50" />
<mat-hint align="end">{{ (titleInput.value || '').length }} / {{ 50 }}</mat-hint>
</mat-form-field>
</div>
Expand All @@ -26,32 +20,25 @@

<div class="section">
<h6>{{ 'Description' | translate }}</h6>
<description-input
formControlName="description"
[defaultDescriptionProvider]="parentForm.defaultDescription.changes"
class="w-100"
></description-input>
<description-input formControlName="description"
[defaultDescriptionProvider]="parentForm.defaultDescription.changes" class="w-100"></description-input>
</div>

<div class="section">
<h6>{{ 'Tags' | translate }}</h6>
<tag-input
formControlName="tags"
class="w-100"
[config]="tagConfig"
[defaultTagProvider]="parentForm.defaultTags.changes"
></tag-input>
<tag-input formControlName="tags" class="w-100" [config]="tagConfig"
[defaultTagProvider]="parentForm.defaultTags.changes"></tag-input>
</div>

<div formGroupName="options" class="row no-gutters section">
<div class="row no-gutters">
<div class="col-md-5 col-lg-4 col-xl-3">
<mat-checkbox formControlName="disableComments">{{
'Disable Comments' | translate
}}</mat-checkbox>
}}</mat-checkbox>
<mat-checkbox formControlName="reupload">{{
'Reupload better quality image' | translate
}}</mat-checkbox>
}}</mat-checkbox>
<mat-checkbox formControlName="scraps">{{ 'Scraps' | translate }}</mat-checkbox>
</div>

Expand Down Expand Up @@ -201,17 +188,22 @@ <h6>{{ 'Tags' | translate }}</h6>
<mat-optgroup label="Fandom Creations">
<mat-option value="11001">Aeromorph</mat-option>
<mat-option value="11002">Angel Dragon</mat-option>
<mat-option value="11012">Avali</mat-option>
<mat-option value="5003">Chakat</mat-option>
<mat-option value="5005">Citra</mat-option>
<mat-option value="5006">Crux</mat-option>
<mat-option value="5009">Dracat</mat-option>
<mat-option value="11003">Dutch Angel Dragon</mat-option>
<mat-option value="11011">Felkin</mat-option>
<mat-option value="11004">Ferrin</mat-option>
<mat-option value="11005">Jogauni</mat-option>
<mat-option value="5014">Langurhali</mat-option>
<mat-option value="11006">Nevrean</mat-option>
<mat-option value="11007">Protogen</mat-option>
<mat-option value="5021">Sergal</mat-option>
<mat-option value="11010">Synx</mat-option>
<mat-option value="11013">Wickerbeast</mat-option>
<mat-option value="11009">Yinglet</mat-option>
<mat-option value="11008">Zorgoia</mat-option>
</mat-optgroup>
<mat-optgroup label="Mythological / Fantasy">
Expand Down Expand Up @@ -582,14 +574,10 @@ <h6>{{ 'Tags' | translate }}</h6>
</mat-form-field>
</div>
<div class="col-md col-lg col-xl">
<folder-select
formControlName="folders"
[folders]="folders"
[multiple]="true"
></folder-select>
<folder-select formControlName="folders" [folders]="folders" [multiple]="true"></folder-select>
</div>
</div>
</div>
</div>
</div>
</form>
</form>
55 changes: 26 additions & 29 deletions src/app/websites/website-services/furbooru/furbooru.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import { getTags, supportsFileType } from '../../helpers/website-validator.helpe
import { getTypeOfSubmission, TypeOfSubmission } from 'src/app/utils/enums/type-of-submission.enum';
import { MBtoBytes, fileAsFormDataObject } from 'src/app/utils/helpers/file.helper';
import { Website } from '../../decorators/website-decorator';
import { PlaintextParser } from 'src/app/utils/helpers/description-parsers/plaintext.parser';
import { BaseWebsiteService } from '../base-website-service';
import { WebsiteStatus, LoginStatus, SubmissionPostData, PostResult } from '../../interfaces/website-service.interface';
import { SubmissionRating } from 'src/app/database/tables/submission.table';
import { BrowserWindowHelper } from 'src/app/utils/helpers/browser-window.helper';
import { Promisify } from 'src/app/utils/helpers/promisify.helper';
import { FurbooruSubmissionForm } from './components/furbooru-submission-form/furbooru-submission-form.component';
import { MarkdownParser } from 'src/app/utils/helpers/description-parsers/markdown.parser';

const ACCEPTED_FILES = ['jpeg', 'jpg', 'png', 'svg', 'gif', 'webm']

Expand All @@ -36,30 +36,30 @@ function validate(submission: Submission, formData: SubmissionFormData): any[] {
return problems;
}

function descriptionPreparser(html: string): string {
if (!html) return '';

html = html.replace(/<b>/gi, '*');
html = html.replace(/<i>/gi, '_');
html = html.replace(/<u>/gi, '+');
html = html.replace(/<s>/gi, '-');
html = html.replace(/<\/b>/gi, '*');
html = html.replace(/<\/i>/gi, '_');
html = html.replace(/<\/u>/gi, '+');
html = html.replace(/<\/s>/gi, '-');
html = html.replace(/<em>/gi, '_');
html = html.replace(/<\/em>/gi, '_');
html = html.replace(/<strong>/gi, '*');
html = html.replace(/<\/strong>/gi, '*');
html = html.replace(/<a(.*?)href="(.*?)"(.*?)>(.*?)<\/a>/gi, '"$4":$2');

return html;
}

function descriptionParser(html: string): string {
html = html.replace(/<a(.*?)href="(.*?)"(.*?)>(.*?)<\/a>/gi, '"$4":$2');
return html;
}
// function descriptionPreparser(html: string): string {
// if (!html) return '';

// html = html.replace(/<b>/gi, '*');
// html = html.replace(/<i>/gi, '_');
// html = html.replace(/<u>/gi, '+');
// html = html.replace(/<s>/gi, '-');
// html = html.replace(/<\/b>/gi, '*');
// html = html.replace(/<\/i>/gi, '_');
// html = html.replace(/<\/u>/gi, '+');
// html = html.replace(/<\/s>/gi, '-');
// html = html.replace(/<em>/gi, '_');
// html = html.replace(/<\/em>/gi, '_');
// html = html.replace(/<strong>/gi, '*');
// html = html.replace(/<\/strong>/gi, '*');
// html = html.replace(/<a(.*?)href="(.*?)"(.*?)>(.*?)<\/a>/gi, '"$4":$2');

// return html;
// }

// function descriptionParser(html: string): string {
// html = html.replace(/<a(.*?)href="(.*?)"(.*?)>(.*?)<\/a>/gi, '"$4":$2');
// return html;
// }

@Injectable({
providedIn: 'root'
Expand All @@ -77,11 +77,8 @@ function descriptionParser(html: string): string {
validators: {
submission: validate
},
preparsers: {
description: [descriptionPreparser]
},
parsers: {
description: [descriptionParser, PlaintextParser.parse],
description: [MarkdownParser.parse],
disableAdvertise: true,
usernameShortcut: {
code: 'furb',
Expand Down

0 comments on commit 44c8aba

Please sign in to comment.