fix: fix custom emoji in secure mode (#1940)

Fixes #1915
This commit is contained in:
Nolan Lawson 2021-02-15 12:54:03 -08:00 committed by GitHub
parent 456dac73b5
commit 2585b55479
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View file

@ -9,7 +9,11 @@ import isEqual from 'lodash-es/isEqual'
async function syncEmojiForInstance (instanceName, syncMethod) {
await syncMethod(
() => getCustomEmoji(instanceName),
() => {
const { loggedInInstances } = store.get()
const accessToken = loggedInInstances[instanceName].access_token
return getCustomEmoji(instanceName, accessToken)
},
() => database.getCustomEmoji(instanceName),
emoji => database.setCustomEmoji(instanceName, emoji),
emoji => {

View file

@ -1,7 +1,7 @@
import { basename } from './utils'
import { auth, basename } from './utils'
import { DEFAULT_TIMEOUT, get } from '../_utils/ajax'
export async function getCustomEmoji (instanceName) {
export function getCustomEmoji (instanceName, accessToken) {
const url = `${basename(instanceName)}/api/v1/custom_emojis`
return get(url, null, { timeout: DEFAULT_TIMEOUT })
return get(url, auth(accessToken), { timeout: DEFAULT_TIMEOUT })
}