From 8243164a205e7ca35b375c5603dd66528f058385 Mon Sep 17 00:00:00 2001 From: Michael DiCarlo Date: Fri, 2 Apr 2021 07:35:42 -0400 Subject: [PATCH 1/3] Start v2.3.30 --- electron/package.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/electron/package.json b/electron/package.json index a267f32d3..666174ee5 100644 --- a/electron/package.json +++ b/electron/package.json @@ -1,6 +1,6 @@ { "name": "postybirb", - "version": "2.3.29", + "version": "2.3.30", "description": "PostyBirb is an application that helps artists post art and other multimedia to multiple websites more quickly.", "main": "main.js", "scripts": { diff --git a/package.json b/package.json index 7ea7fff24..cca0591dd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "postybirb", - "version": "2.3.29", + "version": "2.3.30", "scripts": { "ng": "ng", "compile": "ng build --vendor-chunk=false", From 23f1147345ae7cafcc776b06bdabaeda7af0c65a Mon Sep 17 00:00:00 2001 From: Michael DiCarlo Date: Fri, 2 Apr 2021 08:12:23 -0400 Subject: [PATCH 2/3] Weasyl now allows empty folder option --- .../weasyl-submission-form/weasyl-submission-form.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/websites/website-services/weasyl/components/weasyl-submission-form/weasyl-submission-form.component.ts b/src/app/websites/website-services/weasyl/components/weasyl-submission-form/weasyl-submission-form.component.ts index 9cf611e71..d0b38e15b 100644 --- a/src/app/websites/website-services/weasyl/components/weasyl-submission-form/weasyl-submission-form.component.ts +++ b/src/app/websites/website-services/weasyl/components/weasyl-submission-form/weasyl-submission-form.component.ts @@ -32,7 +32,7 @@ export class WeasylSubmissionForm extends BaseWebsiteSubmissionForm implements O ngOnInit() { super.ngOnInit(); - this.folders = this.websiteService.getFolders(this.parentForm.getLoginProfileId()) || []; + this.folders = [{ id: '', title: 'None' }, ...this.websiteService.getFolders(this.parentForm.getLoginProfileId()) || []]; if (!this.formGroup.get('options')) this.formGroup.addControl('options', this.formBuilder.group(this.optionDefaults)); } From 10bcae097f74a510b5f68468111dfbfc8ea1d296 Mon Sep 17 00:00:00 2001 From: Michael DiCarlo Date: Fri, 7 May 2021 08:29:42 -0400 Subject: [PATCH 3/3] Fixed subscribestar posting --- .../subscribestar/subscribestar.service.ts | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/app/websites/website-services/subscribestar/subscribestar.service.ts b/src/app/websites/website-services/subscribestar/subscribestar.service.ts index 3326a057a..03a5c2ef4 100644 --- a/src/app/websites/website-services/subscribestar/subscribestar.service.ts +++ b/src/app/websites/website-services/subscribestar/subscribestar.service.ts @@ -266,9 +266,10 @@ export class Subscribestar extends BaseWebsiteService { .filter((f) => f) .map((f) => fileAsFormDataObject(f)); + const uploadPath = (body.match(/data-s3-upload-path=\\"(.*?)\\"/) || [])[1]; - const uploadUrl = (body.match(/data-s3-url="(.*?)"/) || [])[1]; - if (!uploadUrl || !uploadPath) { + const bucket = (body.match(/data-s3-bucket="(.*?)"/) || [])[1]; + if (!uploadPath || !bucket) { return Promise.reject( this.createPostResponse('Issue getting upload data', body) ); @@ -281,14 +282,22 @@ export class Subscribestar extends BaseWebsiteService { const key = `${uploadPath}/${uuidv1()}.${file.options.filename .split('.') .pop()}`; + const presignUrl = `${this.BASE_URL}/presigned_url/upload?_=${Date.now()}&key=${encodeURIComponent(key)}&file_name=${encodeURIComponent(file.options.filename)}&content_type=${encodeURIComponent(file.options.contentType)}&bucket=${bucket}`; + const presign = await got.get(presignUrl, this.BASE_URL, cookies, postData.profileId); + + let presignData = null; + try { + presignData = JSON.parse(presign.body); + } catch { + return Promise.reject( + this.createPostResponse('Failed to upload file', presign.body) + ); + } + const postFile = await got.post( - uploadUrl, + presignData.url, { - key, - acl: 'public-read', - success_action_Status: '201', - 'Content-Type': file.options.contentType, - 'x-amz-meta-original-filename': file.options.filename, + ...presignData.fields, file, authenticity_token: csrf, }, @@ -308,15 +317,14 @@ export class Subscribestar extends BaseWebsiteService { ); } - if (postFile.success && postFile.success.response.statusCode === 201) { + if (postFile.success && postFile.success.response.statusCode >= 200 && postFile.success.response.statusCode <= 300) { const xml = $($.parseXML(postFile.success.body)); const record: any = { - path: xml.find('Key').text(), - url: xml.find('Location').text(), + path: key, + url: `${presignData.url}/${key}`, original_filename: file.options.filename, content_type: file.options.contentType, - bucket: xml.find('Bucket').text(), - etag: xml.find('ETag').text(), + bucket, authenticity_token: csrf, };