Skip to content

Commit 8341823

Browse files
authored
Merge pull request #56 from takker99/fix-tweet
fix(tweet): format tweets correctly even if there's no `GM_fetch`
2 parents 75aa6b6 + f0217cb commit 8341823

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

deps/scrapbox-rest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
export * from "https://raw.githubusercontent.com/takker99/scrapbox-userscript-std/0.24.3/rest/mod.ts";
2-
export * from "https://raw.githubusercontent.com/scrapbox-jp/types/0.5.0/rest.ts";
2+
export * from "https://raw.githubusercontent.com/scrapbox-jp/types/0.6.0/rest.ts";

deps/scrapbox.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export * from "https://raw.githubusercontent.com/takker99/scrapbox-userscript-std/0.24.3/browser/dom/mod.ts";
22
export * from "https://raw.githubusercontent.com/takker99/scrapbox-userscript-std/0.24.3/title.ts";
3-
export type { Scrapbox } from "https://raw.githubusercontent.com/scrapbox-jp/types/0.5.0/userscript.ts";
4-
export * from "https://raw.githubusercontent.com/scrapbox-jp/types/0.5.0/rest.ts";
3+
export type { Scrapbox } from "https://raw.githubusercontent.com/scrapbox-jp/types/0.6.0/userscript.ts";
4+
export * from "https://raw.githubusercontent.com/scrapbox-jp/types/0.6.0/rest.ts";

middlewares/formatTweet.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ const defaultFormat = async (
3939
): Promise<string> => {
4040
if ("images" in tweet) {
4141
return [
42-
`[${escapeForEmbed(tweet.screenName)}(@${
43-
escapeForEmbed(tweet.userName)
44-
}) ${url.origin}${url.pathname}]`,
42+
`[@${escapeForEmbed(tweet.screenName)} ${url.origin}${url.pathname}]`,
4543
...tweet.description.split("\n").map((line) =>
4644
`> ${escapeForEmbed(line)}`
4745
),
@@ -71,9 +69,7 @@ const stringify = async ({ content, author, id }: ProcessedTweet) => {
7169
const url = new URL(`https://twitter.com/${author.screenName}/status/${id}`);
7270

7371
return [
74-
`[${escapeForEmbed(author.name)}(@${
75-
escapeForEmbed(author.screenName)
76-
}) ${url}]`,
72+
`[@${escapeForEmbed(author.screenName)} ${url}]`,
7773
...(await Promise.all(content.map(async (node) => {
7874
switch (node.type) {
7975
case "plain":

0 commit comments

Comments
 (0)