Merge branch 'admin-emoji-settings' into shigusegubu-vue3

This commit is contained in:
Henry Jameson 2024-01-08 17:48:42 +02:00
commit 0dc170cfb8
33 changed files with 425 additions and 63 deletions

View file

@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## 2.6.1
### Fixed
- fix admin dashboard not having any feedback on frontend installation
- Fix frontend admin tab crashing when no primary frontend is set
- Add aria attributes to react and extra buttons
## 2.6.0
### Added
- add the initial i18n translation file for Taiwanese (Hokkien), and modify some related files.

1
changelog.d/add-apng.add Normal file
View file

@ -0,0 +1 @@
Make Pleroma FE to also view apng (Animated PNG) attachment.

View file

@ -1 +0,0 @@
fix admin dashboard not having any feedback on frontend installation

View file

@ -0,0 +1 @@
Create a link to the URL of the scrobble when it's present

View file

@ -1 +0,0 @@
Fix frontend admin tab crashing when no primary frontend is set

View file

@ -1 +0,0 @@
Add aria attributes to react and extra buttons

View file

@ -0,0 +1 @@
Video posters on Safari

View file

@ -0,0 +1 @@
Added option to always "show" notifications when using web push for better compatibility with some browsers (chrome, edge, safari)

View file

@ -1,6 +1,6 @@
{
"name": "pleroma_fe",
"version": "2.6.0",
"version": "2.6.1",
"description": "Pleroma frontend, the default frontend of Pleroma social network server",
"author": "Pleroma contributors <https://git.pleroma.social/pleroma/pleroma-fe/-/blob/develop/CONTRIBUTORS.md>",
"private": false,
@ -25,7 +25,7 @@
"@kazvmoe-infra/pinch-zoom-element": "1.2.0",
"@kazvmoe-infra/unicode-emoji-json": "0.4.0",
"@ruffle-rs/ruffle": "0.1.0-nightly.2022.7.12",
"@vuelidate/core": "2.0.2",
"@vuelidate/core": "2.0.3",
"@vuelidate/validators": "2.0.0",
"body-scroll-lock": "3.1.5",
"chromatism": "3.0.0",

View file

@ -52,7 +52,6 @@ const QuickViewSettings = {
get () { return this.mergedConfig.mentionLinkShowAvatar },
set () {
const value = !this.showUserAvatars
console.log(value)
this.$store.dispatch('setOption', { name: 'mentionLinkShowAvatar', value })
}
},

View file

@ -16,7 +16,6 @@ const Report = {
},
computed: {
report () {
console.log(this.$store.state.reports.reports[this.reportId] || {})
return this.$store.state.reports.reports[this.reportId] || {}
},
state: {

View file

@ -0,0 +1,62 @@
import TabSwitcher from 'src/components/tab_switcher/tab_switcher.jsx'
import StringSetting from '../helpers/string_setting.vue'
import Checkbox from 'components/checkbox/checkbox.vue'
import StillImage from 'components/still-image/still-image.vue'
const EmojiTab = {
components: {
TabSwitcher,
StringSetting,
Checkbox,
StillImage
},
data () {
return {
knownPacks: { },
editedParts: { }
}
},
methods: {
reloadEmoji () {
this.$store.state.api.backendInteractor.reloadEmoji()
},
importFromFS () {
this.$store.state.api.backendInteractor.importEmojiFromFS()
},
emojiAddr (packName, name) {
return `${this.$store.state.instance.server}/emoji/${encodeURIComponent(packName)}/${name}`
},
editEmoji (packName, shortcode) {
if (this.editedParts[packName] === undefined) { this.editedParts[packName] = {} }
this.editedParts[packName][shortcode] = {
shortcode, file: this.knownPacks[packName].files[shortcode]
}
},
saveEditedEmoji (packName, shortcode) {
const edited = this.editedParts[packName][shortcode]
this.$store.state.api.backendInteractor.updateEmojiFile(
{ packName, shortcode, newShortcode: edited.shortcode, newFilename: edited.file, force: false }
).then(resp =>
resp.ok ? resp.json() : resp.text().then(respText => Promise.reject(respText))
).then(resp => {
this.knownPacks[packName].files = resp
delete this.editedParts[packName][shortcode]
})
}
},
mounted () {
this.$store.state.api.backendInteractor.listEmojiPacks()
.then(data => data.json())
.then(packData => {
this.knownPacks = packData.packs
console.log(this.knownPacks)
})
}
}
export default EmojiTab

View file

@ -0,0 +1,24 @@
.emoji-tab {
.btn-group .btn {
margin-left: 0.5em;
}
.pack-info-wrapper {
margin-top: 1em;
}
.emoji-info-input {
width: 100%;
}
.emoji-data-input {
width: 40%;
margin-left: 0.5em;
margin-right: 0.5em;
}
.emoji {
width: 32px;
height: 32px;
}
}

View file

@ -0,0 +1,93 @@
<template>
<div
class="emoji-tab"
:label="$t('admin_dash.tabs.emoji')"
>
<div class="setting-item">
<h2>{{ $t('admin_dash.tabs.emoji') }}</h2>
<span class="btn-group">
<button
class="button button-default btn"
type="button"
@click="reloadEmoji">
{{ $t('admin_dash.emoji.reload') }}
</button>
<button
class="button button-default btn"
type="button"
@click="importFromFS">
{{ $t('admin_dash.emoji.importFS') }}
</button>
</span>
<tab-switcher :scrollable-tabs="true" v-if="Object.keys(knownPacks).length > 0">
<div v-for="(pack, packName) in knownPacks" :label="packName" :key="packName">
<div class="pack-info-wrapper">
<ul class="setting-list">
<li>
<div>Description</div>
<textarea
v-model="pack.pack.description"
class="bio resize-height" />
</li>
<li>
<div>Homepage</div>
<input class="emoji-info-input" v-model="pack.pack.homepage">
</li>
<li>
<div>Fallback source</div>
<input class="emoji-info-input" v-model="pack.pack['fallback-src']">
</li>
<li>
<Checkbox v-model="pack.pack['can-download']">Downloadable</Checkbox>
</li>
</ul>
</div>
<h2>Files</h2>
<ul class="setting-list">
<li v-for="(file, shortcode) in pack.files" :key="shortcode">
<StillImage
class="emoji img"
:src="emojiAddr(packName, file)"
:title="`:${shortcode}:`"
:alt="`:${shortcode}:`"
/>
<template v-if="editedParts[packName] !== undefined && editedParts[packName][shortcode] !== undefined">
<input class="emoji-data-input"
v-model="editedParts[packName][shortcode].shortcode">
<input class="emoji-data-input"
v-model="editedParts[packName][shortcode].file">
<button
class="button button-default btn"
type="button"
@click="saveEditedEmoji(packName, shortcode)">
Save
</button>
</template>
<template v-else>
<input disabled class="emoji-data-input" :value="shortcode">
<input disabled class="emoji-data-input" :value="file">
<button
class="button button-default btn"
type="button"
@click="editEmoji(packName, shortcode)">
Edit
</button>
</template>
</li>
</ul>
</div>
</tab-switcher>
</div>
</div>
</template>
<script src="./emoji_tab.js"></script>
<style lang="scss" src="./emoji_tab.scss"></style>

View file

@ -55,9 +55,13 @@ const FrontendsTab = {
return fe.refs.includes(frontend.ref)
},
getSuggestedRef (frontend) {
const defaultFe = this.adminDraft[':pleroma'][':frontends'][':primary']
if (defaultFe?.name === frontend.name && this.canInstall(defaultFe)) {
return defaultFe.ref
if (this.adminDraft) {
const defaultFe = this.adminDraft[':pleroma'][':frontends'][':primary']
if (defaultFe?.name === frontend.name && this.canInstall(defaultFe)) {
return defaultFe.ref
} else {
return frontend.refs[0]
}
} else {
return frontend.refs[0]
}

View file

@ -6,7 +6,7 @@
<div class="setting-item">
<h2>{{ $t('admin_dash.tabs.frontends') }}</h2>
<p>{{ $t('admin_dash.frontend.wip_notice') }}</p>
<ul class="setting-list">
<ul class="setting-list" v-if="adminDraft">
<li>
<h3>{{ $t('admin_dash.frontend.default_frontend') }}</h3>
<p>{{ $t('admin_dash.frontend.default_frontend_tip') }}</p>
@ -23,6 +23,10 @@
</ul>
</li>
</ul>
<div v-else class="setting-list">
{{ $t('admin_dash.frontend.default_frontend_unavail') }}
</div>
<div class="setting-list relative">
<PanelLoading class="overlay" v-if="working"/>
<h3>{{ $t('admin_dash.frontend.available_frontends') }}</h3>
@ -33,9 +37,9 @@
>
<strong>{{ frontend.name }}</strong>
{{ ' ' }}
<span v-if="adminDraft[':pleroma'][':frontends'][':primary']?.name === frontend.name">
<span v-if="adminDraft && adminDraft[':pleroma'][':frontends'][':primary']?.name === frontend.name">
<i18n-t
v-if="adminDraft[':pleroma'][':frontends'][':primary']?.ref === frontend.refs[0]"
v-if="adminDraft && adminDraft[':pleroma'][':frontends'][':primary']?.ref === frontend.refs[0]"
keypath="admin_dash.frontend.is_default"
/>
<i18n-t
@ -43,7 +47,7 @@
keypath="admin_dash.frontend.is_default_custom"
>
<template #version>
<code>{{ adminDraft[':pleroma'][':frontends'][':primary'].ref }}</code>
<code>{{ adminDraft && adminDraft[':pleroma'][':frontends'][':primary'].ref }}</code>
</template>
</i18n-t>
</span>
@ -134,7 +138,7 @@
class="button button-default btn"
type="button"
:disabled="
adminDraft[':pleroma'][':frontends'][':primary']?.name === frontend.name &&
!adminDraft || adminDraft[':pleroma'][':frontends'][':primary']?.name === frontend.name &&
adminDraft[':pleroma'][':frontends'][':primary']?.ref === frontend.refs[0]
"
@click="setDefault(frontend)"

View file

@ -195,7 +195,8 @@ export default {
}
},
canHardReset () {
return this.realSource === 'admin' && this.$store.state.adminSettings.modifiedPaths.has(this.canonPath.join(' -> '))
return this.realSource === 'admin' && this.$store.state.adminSettings.modifiedPaths &&
this.$store.state.adminSettings.modifiedPaths.has(this.canonPath.join(' -> '))
},
matchesExpertLevel () {
return (this.expert || 0) <= this.$store.state.config.expertLevel > 0

View file

@ -3,6 +3,7 @@ import TabSwitcher from 'src/components/tab_switcher/tab_switcher.jsx'
import InstanceTab from './admin_tabs/instance_tab.vue'
import LimitsTab from './admin_tabs/limits_tab.vue'
import FrontendsTab from './admin_tabs/frontends_tab.vue'
import EmojiTab from './admin_tabs/emoji_tab.vue'
import { library } from '@fortawesome/fontawesome-svg-core'
import {
@ -33,7 +34,8 @@ const SettingsModalAdminContent = {
InstanceTab,
LimitsTab,
FrontendsTab
FrontendsTab,
EmojiTab
},
computed: {
user () {

View file

@ -60,6 +60,14 @@
>
<FrontendsTab />
</div>
<div
:label="$t('admin_dash.tabs.emoji')"
icon="laptop-code"
data-tab-name="emoji"
>
<EmojiTab />
</div>
</tab-switcher>
</template>

View file

@ -755,7 +755,6 @@ export default {
selected () {
this.selectedTheme = Object.entries(this.availableStyles).find(([k, s]) => {
if (Array.isArray(s)) {
console.log(s[0] === this.selected, this.selected)
return s[0] === this.selected
} else {
return s.name === this.selected

View file

@ -249,22 +249,45 @@
</button>
</span>
</div>
<div class="status-rich-presence" v-if="scrobblePresent">
<FAIcon
class="fa-scale-110 fa-old-padding"
icon="music"
/>
{{ scrobble.artist }} {{ scrobble.title }}
<FAIcon
class="fa-scale-110 fa-old-padding"
icon="play"
/>
<span class="status-rich-presence-time">
<Timeago
template-key="time.in_past"
:time="scrobble.created_at"
:auto-update="60"
<div
v-if="scrobblePresent"
class="status-rich-presence"
>
<a
v-if="scrobble.externalLink"
:href="scrobble.externalLink"
target="_blank"
>
{{ scrobble.artist }} {{ scrobble.title }}
<FAIcon
class="fa-scale-110 fa-old-padding"
icon="play"
/>
<span class="status-rich-presence-time">
<Timeago
template-key="time.in_past"
:time="scrobble.created_at"
:auto-update="60"
/>
</span>
</a>
<span v-if="!scrobble.externalLink">
<FAIcon
class="fa-scale-110 fa-old-padding"
icon="music"
/>
{{ scrobble.artist }} {{ scrobble.title }}
<FAIcon
class="fa-scale-110 fa-old-padding"
icon="play"
/>
<span class="status-rich-presence-time">
<Timeago
template-key="time.in_past"
:time="scrobble.created_at"
:auto-update="60"
/>
</span>
</span>
</div>
<div

View file

@ -2,7 +2,7 @@
<video
class="video"
preload="metadata"
:src="attachment.url"
:src="attachment.url + '#t=0.5'"
:loop="loopVideo"
:controls="controls"
:alt="attachment.description"

View file

@ -877,7 +877,8 @@
"nodb": "No DB Config",
"instance": "Instance",
"limits": "Limits",
"frontends": "Front-ends"
"frontends": "Front-ends",
"emoji": "Emoji"
},
"nodb": {
"heading": "Database config is disabled",
@ -927,10 +928,15 @@
"wip_notice": "Please note that this section is a WIP and lacks certain features as backend implementation of front-end management is incomplete.",
"default_frontend": "Default front-end",
"default_frontend_tip": "Default front-end will be shown to all users. Currently there's no way to for a user to select personal front-end. If you switch away from PleromaFE you'll most likely have to use old and buggy AdminFE to do instance configuration until we replace it.",
"default_frontend_unavail": "Default frontend settings are not available, as this requires configuration in the database",
"available_frontends": "Available for install",
"failure_installing_frontend": "Failed to install frontend {version}: {reason}",
"success_installing_frontend": "Frontend {version} successfully installed"
},
"emoji": {
"reload": "Reload emoji",
"importFS": "Import emoji from filesystem"
},
"temp_overrides": {
":pleroma": {
":instance": {

View file

@ -205,7 +205,13 @@
"migrated_to": "移民到",
"reacted_with": "顯出{0} ê 反應",
"submitted_report": "送出檢舉",
"poll_ended": "投票結束"
"poll_ended": "投票結束",
"unread_announcements": "{num} 篇公告iáu bē 讀",
"unread_chats": "{num} ê開講iáu bē讀",
"unread_follow_requests": "{num}ê新ê跟tuè請求",
"configuration_tip": "用{theSettings}lí通自訂siánn物佇tsia顯示。{dismiss}",
"configuration_tip_settings": "設定",
"configuration_tip_dismiss": "Mài koh顯示"
},
"polls": {
"add_poll": "開投票",
@ -713,8 +719,8 @@
"hide_all_muted_posts": "Khàm掉消音êPO文",
"max_thumbnails": "PO文ê縮小圖ê khòo-tah無寫=無限制)",
"hide_isp": "Khàm 站臺特有ê面 pang",
"right_sidebar": "Kā 邊á liâu徙kah正手pîng",
"navbar_column_stretch": "伸導覽liâukah 欄平闊",
"right_sidebar": "Kā 邊á ê欄位徙kah正手pîng",
"navbar_column_stretch": "伸導覽liâukah 欄平闊",
"always_show_post_button": "一直顯示「新ê PO文」ê鈕仔",
"hide_wallpaper": "Khàm站臺ê壁紙",
"use_one_click_nsfw": "Tshi̍h chi̍t 下就ē當拍開敏感內容",
@ -850,11 +856,11 @@
"conversation_display": "顯示對話ê風格",
"conversation_display_tree": "樹á ê形",
"disable_sticky_headers": "Mài 予欄位ê頭牢佇螢幕頂懸",
"show_scrollbars": "展示邊á liâu ê giú-á",
"show_scrollbars": "展示邊á ê欄位 ê giú-á",
"third_column_mode": "空間夠額ê時,展示第三ê欄位",
"third_column_mode_none": "不管時mài顯示第三ê欄位",
"third_column_mode_notifications": "通知ê欄位",
"third_column_mode_postform": "主要êPO文表kah導覽",
"third_column_mode_postform": "主要ê PO文表kah導覽",
"show_admin_badge": "佇我ê個人資料顯示「行政員」證章",
"pause_on_unfocused": "若是 Pleroma ê分頁無點開tiō 暫停更新",
"conversation_display_tree_quick": "樹á形ê展示",
@ -922,7 +928,13 @@
"hard_reset_value": "硬ê重頭設",
"hard_reset_value_tooltip": "Suá掉儲存內底ê設定強制用預設ê值",
"reset_value": "重頭設",
"reset_value_tooltip": "重頭設草稿"
"reset_value_tooltip": "重頭設草稿",
"hide_scrobbles": "Tshàng scrobble記錄",
"notification_show_extra": "顯示koh khah tsē ê通知佇通知ê欄位",
"notification_extra_chats": "顯示bô讀ê開講",
"notification_extra_announcements": "顯示bô讀ê公告",
"notification_extra_follow_requests": "顯示新ê跟tuè請求",
"notification_extra_tip": "顯示自訂其他通知ê撇步"
},
"status": {
"favorites": "收藏",
@ -949,7 +961,7 @@
"mentions": "提起",
"move_down": "Kā附件suá kàu正pîng",
"thread_show_full": "展示tsit 條討論線ê所有lóng總有{numStatus}ê狀態,深度上限:{depth}",
"thread_follow": "看討論線tshūn ê部份lóng總有{numStatus}ê狀態)",
"thread_follow": "看討論線tshun ê部份lóng總有{numStatus}ê狀態)",
"replies_list_with_others": "回應(+其他{numReplies}ê):",
"mute_conversation": "Kā會話消音",
"unmute_conversation": "Kā會話取消消音",
@ -990,7 +1002,8 @@
"reaction_count_label": "{num}ê lâng用表情反應",
"hide_quote": "Khàm條引用ê狀態",
"display_quote": "顯示引用ê狀態",
"invisible_quote": "引用ê狀態bē當用{link}"
"invisible_quote": "引用ê狀態bē當用{link}",
"more_actions": "佇tsit ê狀態ê其他動作"
},
"user_card": {
"favorites": "收藏",

View file

@ -146,7 +146,13 @@
"follow_request": "想要关注你",
"error": "取得通知时发生错误:{0}",
"poll_ended": "投票结束了",
"submitted_report": "提交举报"
"submitted_report": "提交举报",
"unread_announcements": "{num} 条未读公告",
"unread_chats": "{num} 条未读聊天讯息",
"unread_follow_requests": "{num} 个新关注请求",
"configuration_tip": "可以在 {theSettings} 里定制什么会显示在这里。{dismiss}",
"configuration_tip_settings": "设置",
"configuration_tip_dismiss": "不再显示"
},
"polls": {
"add_poll": "增加投票",
@ -212,7 +218,9 @@
"edit_unsupported_warning": "Pleroma 不支持对提及或投票进行编辑。",
"edit_status": "编辑状态",
"content_type_selection": "发帖格式",
"scope_notice_dismiss": "关闭此提示"
"scope_notice_dismiss": "关闭此提示",
"reply_option": "回复这条状态",
"quote_option": "引用这条状态"
},
"registration": {
"bio": "简介",
@ -747,7 +755,12 @@
"reset_value_tooltip": "重置草稿",
"hard_reset_value": "硬重置",
"hard_reset_value_tooltip": "从存储中移除设置,强制使用默认值",
"emoji_reactions_scale": "表情回应比例系数"
"emoji_reactions_scale": "表情回应比例系数",
"notification_show_extra": "在通知栏里显示额外通知",
"notification_extra_chats": "显示未读聊天",
"notification_extra_announcements": "显示未读公告",
"notification_extra_follow_requests": "显示新的关注请求",
"notification_extra_tip": "显示额外通知的定制提示"
},
"time": {
"day": "{0} 天",
@ -880,7 +893,10 @@
"show_attachment_in_modal": "在媒体模式中显示",
"status_history": "状态历史",
"delete_error": "删除状态时出错:{0}",
"reaction_count_label": "{num} 人作出了表情回应"
"reaction_count_label": "{num} 人作出了表情回应",
"invisible_quote": "引用的状态不可用:{link}",
"hide_quote": "隐藏引用的状态",
"display_quote": "显示引用的状态"
},
"user_card": {
"approve": "核准",
@ -1184,7 +1200,7 @@
"big_update_title": "请忍耐一下",
"big_update_content": "我们已经有一段时间没有发布发行版,所以事情的外观和感觉可能与你习惯的不一样。",
"update_bugs": "请在 {pleromaGitlab} 上报告任何问题和bug因为我们已经改变了很多虽然我们进行了彻底的测试并且自己使用了开发版本但我们可能错过了一些东西。我们欢迎你对你可能遇到的问题或如何改进Pleroma和Pleroma-FE提出反馈和建议。",
"art_by": "Art by {linkToArtist}"
"art_by": "{linkToArtist} 的作品"
},
"lists": {
"search": "搜索用户",

View file

@ -38,7 +38,7 @@ export default function createPersistedState ({
},
setState = (key, state, storage) => {
if (!loaded) {
console.log('waiting for old state to be loaded...')
console.info('waiting for old state to be loaded...')
return Promise.resolve()
} else {
return storage.setItem(key, state)
@ -65,7 +65,7 @@ export default function createPersistedState ({
}
loaded = true
} catch (e) {
console.log("Couldn't load state")
console.error("Couldn't load state")
console.error(e)
loaded = true
}
@ -86,8 +86,8 @@ export default function createPersistedState ({
})
}
} catch (e) {
console.log("Couldn't persist state:")
console.log(e)
console.error("Couldn't persist state:")
console.error(e)
}
})
}

View file

@ -105,7 +105,6 @@ const adminSettingsStorage = {
}
set(config, path, convert(c.value))
})
console.log(config[':pleroma'])
commit('updateAdminSettings', { config, modifiedPaths })
commit('resetAdminDraft')
},
@ -123,7 +122,6 @@ const adminSettingsStorage = {
const descriptions = {}
backendDescriptions.forEach(d => convert(d, '', descriptions))
console.log(descriptions[':pleroma']['Pleroma.Captcha'])
commit('updateAdminDescriptions', { descriptions })
},

View file

@ -419,7 +419,6 @@ const serverSideStorage = {
actions: {
pushServerSideStorage ({ state, rootState, commit }, { force = false } = {}) {
const needPush = state.dirty || force
console.log(needPush)
if (!needPush) return
commit('updateCache', { username: rootState.users.currentUser.fqn })
const params = { pleroma_settings_store: { 'pleroma-fe': state.cache } }

View file

@ -667,7 +667,7 @@ const users = {
resolve()
})
.catch((error) => {
console.log(error)
console.error(error)
commit('endLogin')
reject(new Error('Failed to connect to server, try again'))
})

View file

@ -114,6 +114,15 @@ const PLEROMA_ADMIN_DESCRIPTIONS_URL = '/api/pleroma/admin/config/descriptions'
const PLEROMA_ADMIN_FRONTENDS_URL = '/api/pleroma/admin/frontends'
const PLEROMA_ADMIN_FRONTENDS_INSTALL_URL = '/api/pleroma/admin/frontends/install'
const PLEROMA_EMOJI_RELOAD_URL = '/api/pleroma/admin/reload_emoji'
const PLEROMA_EMOJI_IMPORT_FS_URL = '/api/pleroma/emoji/packs/import'
const PLEROMA_EMOJI_PACKS_URL = (page, pageSize) => `/api/pleroma/emoji/packs?page=${page}&page_size=${pageSize}`
const PLEROMA_EMOJI_PACK_URL = (name) => `/api/pleroma/emoji/pack?name=${name}`
const PLEROMA_EMOJI_PACKS_DL_REMOTE_URL = '/api/pleroma/emoji/packs/download'
const PLEROMA_EMOJI_PACKS_LS_REMOTE_URL =
(url, page, pageSize) => `/api/pleroma/emoji/packs/remote?url=${url}&page=${page}&page_size=${pageSize}`
const PLEROMA_EMOJI_UPDATE_FILE_URL = (name) => `/api/pleroma/emoji/packs/files?name=${name}`
const oldfetch = window.fetch
const fetch = (url, options) => {
@ -1787,6 +1796,92 @@ const fetchScrobbles = ({ accountId, limit = 1 }) => {
})
}
const deleteEmojiPack = ({ name }) => {
return fetch(PLEROMA_EMOJI_PACK_URL(name), { method: 'DELETE' })
}
const reloadEmoji = () => {
return fetch(PLEROMA_EMOJI_RELOAD_URL, { method: 'POST' })
}
const importEmojiFromFS = () => {
return fetch(PLEROMA_EMOJI_IMPORT_FS_URL)
}
const createEmojiPack = ({ name }) => {
return fetch(PLEROMA_EMOJI_PACK_URL(name), { method: 'PUT' })
}
const listEmojiPacks = () => {
return fetch(PLEROMA_EMOJI_PACKS_URL(1, 25))
}
const listRemoteEmojiPacks = ({ instance }) => {
return fetch(
PLEROMA_EMOJI_PACKS_LS_REMOTE_URL,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ instance_address: instance })
}
)
}
const downloadRemoteEmojiPack = ({ instance, packName, as }) => {
if (as.trim() === '') {
as = null
}
return fetch(
PLEROMA_EMOJI_PACKS_DL_REMOTE_URL,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
instance_address: instance, pack_name: packName, as
})
}
)
}
const saveEmojiPackMetadata = ({ name, newData }) => {
return fetch(
PLEROMA_EMOJI_PACK_URL(name),
{
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ name, new_data: newData })
}
)
}
const addNewEmojiFile = ({ packName, file, shortcode, filename }) => {
const data = new FormData()
if (filename.trim() !== '') { data.set('filename', filename) }
if (shortcode.trim() !== '') { data.set('shortcode', shortcode) }
data.set('file', file)
return fetch(
PLEROMA_EMOJI_UPDATE_FILE_URL(packName),
{ method: 'POST', data }
)
}
const updateEmojiFile = ({ packName, shortcode, newShortcode, newFilename, force }) => {
return fetch(
PLEROMA_EMOJI_UPDATE_FILE_URL(packName),
{
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ shortcode, new_shortcode: newShortcode, new_filename: newFilename, force })
}
)
}
const deleteEmojiFile = ({ packName, shortcode }) => {
return fetch(`${PLEROMA_EMOJI_UPDATE_FILE_URL(packName)}&shortcode=${shortcode}`, { method: 'DELETE' })
}
const apiService = {
verifyCredentials,
fetchTimeline,
@ -1906,7 +2001,18 @@ const apiService = {
fetchInstanceConfigDescriptions,
fetchAvailableFrontends,
pushInstanceDBConfig,
installFrontend
installFrontend,
importEmojiFromFS,
reloadEmoji,
listEmojiPacks,
createEmojiPack,
deleteEmojiPack,
saveEmojiPackMetadata,
addNewEmojiFile,
updateEmojiFile,
deleteEmojiFile,
listRemoteEmojiPacks,
downloadRemoteEmojiPack
}
export default apiService

View file

@ -26,7 +26,7 @@ export const fileType = mimetype => {
}
export const fileTypeExt = url => {
if (url.match(/\.(png|jpe?g|gif|webp|avif)$/)) {
if (url.match(/\.(a?png|jpe?g|gif|webp|avif)$/)) {
return 'image'
}
if (url.match(/\.(ogv|mp4|webm|mov)$/)) {

View file

@ -87,7 +87,6 @@ export async function initServiceWorker (store) {
await getOrCreateServiceWorker()
navigator.serviceWorker.addEventListener('message', (event) => {
const { dispatch } = store
console.log('SW MESSAGE', event)
const { type, ...rest } = event.data
switch (type) {

View file

@ -2345,10 +2345,10 @@
dependencies:
js-beautify "1.14.6"
"@vuelidate/core@2.0.2":
version "2.0.2"
resolved "https://registry.yarnpkg.com/@vuelidate/core/-/core-2.0.2.tgz#e874afc830ccc5295e83a0c0a0f0621e084348c9"
integrity sha512-aG1OZWv6xVws3ljyKy/pyxq1rdZZ2ryj+FEREcC9d4GP4qOvNHHZUl/NQxa0Bck3Ooc0RfXU8vwCA9piRoWy6w==
"@vuelidate/core@2.0.3":
version "2.0.3"
resolved "https://registry.yarnpkg.com/@vuelidate/core/-/core-2.0.3.tgz#40468c5ed15b72bde880a026b0699c2f0f1ecede"
integrity sha512-AN6l7KF7+mEfyWG0doT96z+47ljwPpZfi9/JrNMkOGLFv27XVZvKzRLXlmDPQjPl/wOB1GNnHuc54jlCLRNqGA==
dependencies:
vue-demi "^0.13.11"