add custom emoji

This commit is contained in:
Nolan Lawson 2018-03-06 09:03:59 -08:00
parent 4a49e9118e
commit 36fdd79032
6 changed files with 40 additions and 30 deletions

View File

@ -89,7 +89,8 @@ export const actions = times(30, i => ({
user: 'foobar', user: 'foobar',
post: { post: {
text: "here's a secret video", text: "here's a secret video",
media: ['kitten2.mp4'] media: ['kitten2.mp4'],
sensitive: true
} }
}, },
{ {
@ -104,7 +105,7 @@ export const actions = times(30, i => ({
{ {
user: 'foobar', user: 'foobar',
post: { post: {
internalId: 11, internalId: 'foobar-direct',
text: 'direct', text: 'direct',
privacy: 'direct' privacy: 'direct'
} }
@ -112,7 +113,7 @@ export const actions = times(30, i => ({
{ {
user: 'foobar', user: 'foobar',
post: { post: {
internalId: 10, internalId: 'foobar-this-is-followers-only',
text: 'this is followers-only', text: 'this is followers-only',
privacy: 'private' privacy: 'private'
} }
@ -120,7 +121,7 @@ export const actions = times(30, i => ({
{ {
user: 'foobar', user: 'foobar',
post: { post: {
internalId: 2, internalId: 'foobar-this-is-unlisted',
text: 'this is unlisted', text: 'this is unlisted',
privacy: 'unlisted' privacy: 'unlisted'
} }
@ -132,60 +133,60 @@ export const actions = times(30, i => ({
{ {
user: 'admin', user: 'admin',
post: { post: {
internalId: 3, internalId: 'notification-of-direct-message',
text: '@foobar notification of direct message', text: '@foobar notification of direct message',
privacy: 'direct' privacy: 'direct'
} }
}, },
{ {
user: 'admin', user: 'admin',
favorite: 3 favorite: 'notification-of-direct-message'
}, },
{ {
user: 'admin', user: 'admin',
post: { post: {
internalId: 4, internalId: 'notification-of-followers-only',
text: '@foobar notification of followers-only message', text: '@foobar notification of followers-only message',
privacy: 'private' privacy: 'private'
} }
}, },
{ {
user: 'admin', user: 'admin',
favorite: 4 favorite: 'notification-of-followers-only'
}, },
{ {
user: 'admin', user: 'admin',
post: { post: {
internalId: 1, internalId: 'notification-of-unlisted-message',
text: '@foobar notification of unlisted message', text: '@foobar notification of unlisted message',
privacy: 'unlisted' privacy: 'unlisted'
} }
}, },
{ {
user: 'admin', user: 'admin',
boost: 1 boost: 'notification-of-unlisted-message'
}, },
{ {
user: 'admin', user: 'admin',
boost: 2 boost: 'foobar-this-is-unlisted'
}, },
{ {
user: 'admin', user: 'admin',
favorite: 2 favorite: 'foobar-this-is-unlisted'
} }
]).concat(times(25, i => ({ ]).concat(times(25, i => ({
user: 'quux', user: 'quux',
post: { post: {
internalId: 100 + i, internalId: `quux-thread-${i}`,
text: 'unlisted thread ' + (i + 1), text: 'unlisted thread ' + (i + 1),
privacy: 'unlisted', privacy: 'unlisted',
inReplyTo: i > 0 && (100 + i) inReplyTo: i > 0 && `quux-thread-${i - 1}`
} }
}))).concat([ }))).concat([
{ {
user: 'quux', user: 'quux',
post: { post: {
internalId: 5, internalId: 'pinned-toot-1',
text: 'pinned toot 1', text: 'pinned toot 1',
privacy: 'unlisted' privacy: 'unlisted'
} }
@ -193,50 +194,50 @@ export const actions = times(30, i => ({
{ {
user: 'quux', user: 'quux',
post: { post: {
internalId: 6, internalId: 'pinned-toot-2',
text: 'pinned toot 2', text: 'pinned toot 2',
privacy: 'unlisted' privacy: 'unlisted'
} }
}, },
{ {
user: 'quux', user: 'quux',
pin: 5 pin: 'pinned-toot-2'
}, },
{ {
user: 'quux', user: 'quux',
pin: 6 pin: 'pinned-toot-1'
}, },
{ {
user: 'admin', user: 'admin',
boost: 5 boost: 'pinned-toot-1'
}, },
{ {
user: 'admin', user: 'admin',
favorite: 5 favorite: 'pinned-toot-1'
}, },
{ {
user: 'admin', user: 'admin',
favorite: 6 favorite: 'pinned-toot-2'
}, },
{ {
user: 'foobar', user: 'foobar',
favorite: 5 favorite: 'pinned-toot-1'
}, },
{ {
user: 'foobar', user: 'foobar',
favorite: 2 favorite: 'notification-of-unlisted-message'
}, },
{ {
user: 'foobar', user: 'foobar',
favorite: 10 favorite: 'notification-of-followers-only'
}, },
{ {
user: 'foobar', user: 'foobar',
favorite: 3 favorite: 'notification-of-direct-message'
}, },
{ {
user: 'foobar', user: 'foobar',
pin: 2 pin: 'foobar-this-is-unlisted'
}, },
{ {
user: 'ExternalLinks', user: 'ExternalLinks',

View File

@ -46,6 +46,11 @@ export async function restoreMastodonData () {
for (let action of actions) { for (let action of actions) {
console.log(JSON.stringify(action)) console.log(JSON.stringify(action))
let accessToken = users[action.user].accessToken let accessToken = users[action.user].accessToken
if (action.post || action.boost) {
await new Promise(resolve => setTimeout(resolve, 1100))
}
if (action.post) { if (action.post) {
let { text, media, sensitive, spoiler, privacy, inReplyTo, internalId } = action.post let { text, media, sensitive, spoiler, privacy, inReplyTo, internalId } = action.post
if (typeof inReplyTo !== 'undefined') { if (typeof inReplyTo !== 'undefined') {
@ -69,7 +74,6 @@ export async function restoreMastodonData () {
} else if (action.pin) { } else if (action.pin) {
await pinStatus('localhost:3000', accessToken, internalIdsToIds[action.pin]) await pinStatus('localhost:3000', accessToken, internalIdsToIds[action.pin])
} }
await new Promise(resolve => setTimeout(resolve, 1500))
} }
console.log('Restored mastodon data') console.log('Restored mastodon data')
} }

View File

@ -75,19 +75,24 @@ async function main () {
await setupMastodonDatabase() await setupMastodonDatabase()
await runMastodon() await runMastodon()
await waitForMastodonApiToStart() await waitForMastodonApiToStart()
await restoreMastodonData() //await restoreMastodonData()
await waitForMastodonUiToStart() await waitForMastodonUiToStart()
} }
process.on('SIGINT', function () { function shutdownMastodon() {
if (childProc) { if (childProc) {
console.log('killing child process') console.log('killing child process')
childProc.kill() childProc.kill()
} }
}
process.on('SIGINT', function () {
shutdownMastodon()
process.exit(0) process.exit(0)
}) })
main().catch(err => { main().catch(err => {
console.error(err) console.error(err)
shutdownMastodon()
process.exit(1) process.exit(1)
}) })

Binary file not shown.

Binary file not shown.

View File

@ -1,4 +1,4 @@
const TIMEOUT = 15000 const TIMEOUT = process.browser ? 15000 : 60000
function fetchWithTimeout (url, options) { function fetchWithTimeout (url, options) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {