Skip to content

Commit

Permalink
Merge pull request #278 from mvdicarlo/develop
Browse files Browse the repository at this point in the history
v3.1.34
  • Loading branch information
mvdicarlo authored Nov 8, 2023
2 parents 6555640 + df8ce86 commit 21bdab7
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 20 deletions.
2 changes: 1 addition & 1 deletion electron-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postybirb-plus",
"version": "3.1.33",
"version": "3.1.34",
"description": "(ClientServer) PostyBirb is an application that helps artists post art and other multimedia to multiple websites more quickly.",
"main": "dist/main.js",
"author": "Michael DiCarlo",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ export class DescriptionParser {
private settings: SettingsService,
) {
this.websiteDescriptionShortcuts = websitesService.getUsernameShortcuts();
this.websiteDescriptionShortcuts = {
...this.websiteDescriptionShortcuts,
twitter: [ // injects legacy twitter shortcut back in
{
key: 'tw',
url: 'https://twitter.com/$1',
},
],
};
}

public async parse(
Expand Down
30 changes: 13 additions & 17 deletions electron-app/src/server/websites/newgrounds/newgrounds.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,20 @@ export class Newgrounds extends Website {
return Promise.reject(this.createPostResponse({ additionalInfo: post.body }));
}

private async getThumbnail(thumbnail: PostFile, primary: PostFile): Promise<PostFile> {
let thumbfile = thumbnail;
private async getThumbnail(
thumbnail: PostFile | undefined,
primary: PostFile,
): Promise<PostFile> {
let thumbfile: PostFile = {
value: thumbnail?.value ?? primary.value,
options: {
filename: 'thumbnail.png',
contentType: 'image/png',
},
};
if (!thumbnail && primary.options.contentType === 'image/gif') {
const frame0 = await GifManipulator.getFrame(primary.value);
thumbfile = {
value: frame0,
options: {
filename: 'thumbnail.png',
contentType: 'image/png',
},
};
thumbfile.value = frame0;
}

const scalePx = 600;
Expand Down Expand Up @@ -158,8 +161,6 @@ export class Newgrounds extends Website {
}

thumbfile.value = thumb.toPNG();
thumbfile.options.filename = 'thumbnail.png';
thumbfile.options.contentType = 'image/png';
return thumbfile;
}

Expand Down Expand Up @@ -215,12 +216,7 @@ export class Newgrounds extends Website {
}

const { edit_url, project_id } = initRes.body;

let thumbfile = await this.getThumbnail(
data.thumbnail ? data.thumbnail : data.primary.file,
data.primary.file,
);

const thumbfile = await this.getThumbnail(data.thumbnail, data.primary.file);
const primaryBuf = nativeImage.createFromBuffer(data.primary.file.value);
const size = primaryBuf.getSize();
const fileUploadRes = await Http.post<
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-plus",
"version": "3.1.33",
"version": "3.1.34",
"description": "PostyBirb is an application that helps artists post art and other multimedia to multiple websites more quickly..",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postybirb-plus-ui",
"version": "3.1.33",
"version": "3.1.34",
"license": "BSD-3-Clause",
"private": true,
"Author": "Michael DiCarlo",
Expand Down

0 comments on commit 21bdab7

Please sign in to comment.