diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/api/mastodon/index.ts | 6 | ||||
-rw-r--r-- | src/services/jobs.ts | 3 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/api/mastodon/index.ts b/src/api/mastodon/index.ts index 3bfe9c8..13185ab 100644 --- a/src/api/mastodon/index.ts +++ b/src/api/mastodon/index.ts | |||
@@ -34,13 +34,13 @@ export async function upload(buf: Buffer, filename: string) { | |||
34 | 34 | ||
35 | export async function createStatus( | 35 | export async function createStatus( |
36 | postUrl: string, | 36 | postUrl: string, |
37 | sourceUrl: string | undefined, | 37 | sourceUrls: readonly string[], |
38 | spoiler: string[], | 38 | spoiler: string[], |
39 | attachmentId: string | 39 | attachmentId: string |
40 | ) { | 40 | ) { |
41 | let lines = [postUrl]; | 41 | let lines = [postUrl]; |
42 | if (sourceUrl) { | 42 | for (let i = 0; i < sourceUrls.length; ++i) { |
43 | lines.push(`Source: ${sourceUrl}`); | 43 | lines.push(`Source ${i + 1}: ${sourceUrls[i]}`); |
44 | } | 44 | } |
45 | 45 | ||
46 | const spoilerText = spoiler.length ? `CW: ${spoiler.join(", ")}` : undefined; | 46 | const spoilerText = spoiler.length ? `CW: ${spoiler.join(", ")}` : undefined; |
diff --git a/src/services/jobs.ts b/src/services/jobs.ts index 5ecae66..bb0c3e1 100644 --- a/src/services/jobs.ts +++ b/src/services/jobs.ts | |||
@@ -27,7 +27,6 @@ export async function postRandomPicture() { | |||
27 | } | 27 | } |
28 | 28 | ||
29 | async function handlePost(post: e621.Post) { | 29 | async function handlePost(post: e621.Post) { |
30 | const source = post.sources.length ? post.sources[0] : undefined; | ||
31 | const cws = config.cw.filter((w) => post.tags.general.includes(w)); | 30 | const cws = config.cw.filter((w) => post.tags.general.includes(w)); |
32 | 31 | ||
33 | console.log(`Downloading image...`); | 32 | console.log(`Downloading image...`); |
@@ -53,7 +52,7 @@ async function handlePost(post: e621.Post) { | |||
53 | 52 | ||
54 | console.log(`Posting status...`); | 53 | console.log(`Posting status...`); |
55 | 54 | ||
56 | const status = await mastodon.createStatus(`https://e926.net/posts/${post.id}`, source, cws, attachment.id); | 55 | const status = await mastodon.createStatus(`https://e926.net/posts/${post.id}`, post.sources, cws, attachment.id); |
57 | 56 | ||
58 | console.log(`Done! ${status.url}`); | 57 | console.log(`Done! ${status.url}`); |
59 | } | 58 | } |