aboutsummaryrefslogtreecommitdiff
path: root/src/boot/after_store.js
diff options
context:
space:
mode:
authorHJ <30-hj@users.noreply.git.pleroma.social>2019-07-24 19:35:52 +0000
committerHJ <30-hj@users.noreply.git.pleroma.social>2019-07-24 19:35:52 +0000
commit4827e4d972f8ee11e606693e24ae4ca21711c6b1 (patch)
tree53e18494681c6c5c6a6f31d27d034e9681b89029 /src/boot/after_store.js
parent28f777cb8a94f7a28edb6f99a62a6b864c2aa8dc (diff)
parentfa6210872f7f22c4c8ce1a1603426ebf03bf2050 (diff)
Merge branch 'feature/add-sticker-picker' into 'develop'
Feature/add sticker picker See merge request pleroma/pleroma-fe!885
Diffstat (limited to 'src/boot/after_store.js')
-rw-r--r--src/boot/after_store.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/boot/after_store.js b/src/boot/after_store.js
index 3fcbc246..3799359f 100644
--- a/src/boot/after_store.js
+++ b/src/boot/after_store.js
@@ -148,6 +148,37 @@ const getInstancePanel = async ({ store }) => {
}
}
+const getStickers = async ({ store }) => {
+ try {
+ const res = await window.fetch('/static/stickers.json')
+ if (res.ok) {
+ const values = await res.json()
+ const stickers = (await Promise.all(
+ Object.entries(values).map(async ([name, path]) => {
+ const resPack = await window.fetch(path + 'pack.json')
+ var meta = {}
+ if (resPack.ok) {
+ meta = await resPack.json()
+ }
+ return {
+ pack: name,
+ path,
+ meta
+ }
+ })
+ )).sort((a, b) => {
+ return a.meta.title.localeCompare(b.meta.title)
+ })
+ store.dispatch('setInstanceOption', { name: 'stickers', value: stickers })
+ } else {
+ throw (res)
+ }
+ } catch (e) {
+ console.warn("Can't load stickers")
+ console.warn(e)
+ }
+}
+
const getStaticEmoji = async ({ store }) => {
try {
const res = await window.fetch('/static/emoji.json')
@@ -286,6 +317,7 @@ const afterStoreSetup = async ({ store, i18n }) => {
setConfig({ store }),
getTOS({ store }),
getInstancePanel({ store }),
+ getStickers({ store }),
getStaticEmoji({ store }),
getCustomEmoji({ store }),
getNodeInfo({ store })