Fix downloading remote packs

This commit is contained in:
Angelina Filippova 2020-06-26 00:55:43 +03:00
parent dca1f2cce8
commit 9137362dc7
3 changed files with 6 additions and 8 deletions

View file

@ -52,17 +52,15 @@ export async function deletePack(host, token, packName) {
})
}
export async function downloadFrom(host, instance, packName, as, token) {
if (as.trim() === '') {
as = null
}
export async function downloadFrom(instanceAddress, packName, as, host, token) {
return await request({
baseURL: baseName(host),
url: '/api/pleroma/emoji/packs/download',
method: 'post',
headers: authHeaders(token),
data: { url: baseName(instance), name: packName, as },
data: as.trim() === ''
? { url: baseName(instanceAddress), name: packName }
: { url: baseName(instanceAddress), name: packName, as },
timeout: 0
})
}

View file

@ -116,7 +116,7 @@ const emojiPacks = {
await deletePack(getters.authHost, getters.token, name)
},
async DownloadFrom({ getters }, { instanceAddress, packName, as }) {
const result = await downloadFrom(getters.authHost, instanceAddress, packName, as, getters.token)
const result = await downloadFrom(instanceAddress, packName, as, getters.authHost, getters.token)
if (result.data === 'ok') {
Message({

View file

@ -24,7 +24,7 @@
</el-form-item>
<el-form-item>
<el-link
v-if="pack.pack['can-download']"
v-if="pack.pack['can-download'] && pack.pack['fallback-src']"
:href="pack.pack['fallback-src']"
:underline="false"
type="primary"