From be62c12b9e03cf35408447bb2164039cb2a7d60a Mon Sep 17 00:00:00 2001 From: Tuxedo Takodachi Date: Sun, 9 Apr 2023 11:13:22 +0200 Subject: [PATCH] Fix post parsing and package.json meta links --- package.json | 14 +++++++------- src/classes/Post.ts | 9 ++++++--- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index ef704f567..233b83fa7 100644 --- a/package.json +++ b/package.json @@ -8,13 +8,13 @@ "page": "https://github.com/TuxedoTako/4chan-xt", "downloads": "https://github.com/TuxedoTako/4chan-xt/releases", "oldVersions": "https://raw.githubusercontent.com/ccd0/4chan-x/", - "faq": "https://github.com/TuxedoTako/wiki/Frequently-Asked-Questions", - "captchaFAQ": "https://github.com/TuxedoTako/wiki/Captcha-FAQ", - "cssGuide": "https://github.com/TuxedoTako/wiki/Styling-Guide", - "license": "https://github.com/TuxedoTako/blob/master/LICENSE", - "changelog": "https://github.com/TuxedoTako/blob/master/CHANGELOG.md", - "issues": "https://github.com/TuxedoTako/issues", - "newIssue": "https://github.com/TuxedoTako/issues", + "faq": "https://github.com/TuxedoTako/4chan-xt/wiki/Frequently-Asked-Questions", + "captchaFAQ": "https://github.com/TuxedoTako/4chan-xt/wiki/Captcha-FAQ", + "cssGuide": "https://github.com/TuxedoTako/4chan-xt/wiki/Styling-Guide", + "license": "https://github.com/TuxedoTako/4chan-xt/blob/master/LICENSE", + "changelog": "https://github.com/TuxedoTako/4chan-xt/blob/master/CHANGELOG.md", + "issues": "https://github.com/TuxedoTako/4chan-xt/issues", + "newIssue": "https://github.com/TuxedoTako/4chan-xt/issues", "newIssueMaxLength": 8181, "alternatives": "https://www.4chan-x.net/4chan_alternatives.html", "appid": "lacclbnghgdicfifcamcmcnilckjamag", diff --git a/src/classes/Post.ts b/src/classes/Post.ts index 011d3e7f3..b73469c0a 100644 --- a/src/classes/Post.ts +++ b/src/classes/Post.ts @@ -95,11 +95,14 @@ export default class Post { } } + const name = this.nodes.name?.textContent; + const tripcode = this.nodes.tripcode?.textContent; + this.info = { subject: this.nodes.subject?.textContent || undefined, - name: this.nodes.name?.textContent, + name, email: this.nodes.email ? decodeURIComponent(this.nodes.email.href.replace(/^mailto:/, '')) : undefined, - tripcode: this.nodes.tripcode?.textContent, + tripcode, uniqueID: this.nodes.uniqueID?.textContent, capcode: this.nodes.capcode?.textContent.replace('## ', ''), pass: this.nodes.pass?.title.match(/\d*$/)[0], @@ -107,7 +110,7 @@ export default class Post { flagCodeTroll: this.nodes.flag?.className.match(/bfl-(\w+)/)?.[1].toUpperCase(), flag: this.nodes.flag?.title, date: this.nodes.date ? g.SITE.parseDate(this.nodes.date) : undefined, - nameBlock: Conf['Anonymize'] ? 'Anonymous' : `${this.info.name || ''} ${this.info.tripcode || ''}`.trim(), + nameBlock: Conf['Anonymize'] ? 'Anonymous' : `${name || ''} ${tripcode || ''}`.trim(), }; if (this.info.capcode) { this.info.nameBlock += ` ## ${this.info.capcode}`; }