From 95cba854f389ebdee200d0df147e4c26ed4949a0 Mon Sep 17 00:00:00 2001 From: hakabahitoyo Date: Sun, 4 Feb 2018 00:27:33 +0900 Subject: [PATCH 1/4] add instance specific panel --- src/App.js | 7 +++++-- src/App.vue | 1 + .../instance_specific_panel.js | 9 +++++++++ .../instance_specific_panel.vue | 15 +++++++++++++++ src/main.js | 10 +++++++++- static/config.json | 5 +++-- 6 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 src/components/instance_specific_panel/instance_specific_panel.js create mode 100644 src/components/instance_specific_panel/instance_specific_panel.vue diff --git a/src/App.js b/src/App.js index 0636c47d..1c6f4fcc 100644 --- a/src/App.js +++ b/src/App.js @@ -2,6 +2,7 @@ import UserPanel from './components/user_panel/user_panel.vue' import NavPanel from './components/nav_panel/nav_panel.vue' import Notifications from './components/notifications/notifications.vue' import UserFinder from './components/user_finder/user_finder.vue' +import InstanceSpecificPanel from './components/instance_specific_panel/instance_specific_panel.vue' import ChatPanel from './components/chat_panel/chat_panel.vue' export default { @@ -11,7 +12,8 @@ export default { NavPanel, Notifications, UserFinder, - ChatPanel + ChatPanel, + InstanceSpecificPanel }, data: () => ({ mobileActivePanel: 'timeline' @@ -24,7 +26,8 @@ export default { logoStyle () { return { 'background-image': `url(${this.$store.state.config.logo})` } }, style () { return { 'background-image': `url(${this.background})` } }, sitename () { return this.$store.state.config.name }, - chat () { return this.$store.state.chat.channel } + chat () { return this.$store.state.chat.channel }, + showInstanceSpecificPanel () { return this.$store.state.config.showInstanceSpecificPanel} }, methods: { activatePanel (panelName) { diff --git a/src/App.vue b/src/App.vue index ec403519..2a910bc0 100644 --- a/src/App.vue +++ b/src/App.vue @@ -23,6 +23,7 @@ diff --git a/src/components/instance_specific_panel/instance_specific_panel.js b/src/components/instance_specific_panel/instance_specific_panel.js new file mode 100644 index 00000000..abd408c8 --- /dev/null +++ b/src/components/instance_specific_panel/instance_specific_panel.js @@ -0,0 +1,9 @@ +const InstanceSpecificPanel = { + computed: { + instanceSpecificPanelContent () { + return this.$store.state.config.instanceSpecificPanelContent + } + } +} + +export default InstanceSpecificPanel diff --git a/src/components/instance_specific_panel/instance_specific_panel.vue b/src/components/instance_specific_panel/instance_specific_panel.vue new file mode 100644 index 00000000..b3ea019d --- /dev/null +++ b/src/components/instance_specific_panel/instance_specific_panel.vue @@ -0,0 +1,15 @@ + + + + + diff --git a/src/main.js b/src/main.js index de74511b..359dbf52 100644 --- a/src/main.js +++ b/src/main.js @@ -78,12 +78,13 @@ const i18n = new VueI18n({ window.fetch('/static/config.json') .then((res) => res.json()) .then((data) => { - const {name, theme, background, logo, registrationOpen} = data + const {name, theme, background, logo, registrationOpen, showInstanceSpecificPanel} = data store.dispatch('setOption', { name: 'name', value: name }) store.dispatch('setOption', { name: 'theme', value: theme }) store.dispatch('setOption', { name: 'background', value: background }) store.dispatch('setOption', { name: 'logo', value: logo }) store.dispatch('setOption', { name: 'registrationOpen', value: registrationOpen }) + store.dispatch('setOption', { name: 'showInstanceSpecificPanel', value: showInstanceSpecificPanel }) if (data['chatDisabled']) { store.dispatch('disableChat') } @@ -146,3 +147,10 @@ window.fetch('/api/pleroma/emoji.json') ), (error) => console.log(error) ) + +window.fetch('/instance/panel.html') + .then((res) => res.text()) + .then((html) => { + store.dispatch('setOption', { name: 'instanceSpecificPanelContent', value: html }) + }) + diff --git a/static/config.json b/static/config.json index 880efca8..38b1062d 100644 --- a/static/config.json +++ b/static/config.json @@ -3,7 +3,8 @@ "theme": "pleroma-dark", "background": "/static/bg.jpg", "logo": "/static/logo.png", - "registrationOpen": false, + "registrationOpen": true, "defaultPath": "/main/all", - "chatDisabled": false + "chatDisabled": false, + "showInstanceSpecificPanel": false } From 5dd4631860e2a8da730f134d9320470aed0d4516 Mon Sep 17 00:00:00 2001 From: Hakaba Hitoyo Date: Sun, 4 Feb 2018 08:43:31 +0900 Subject: [PATCH 2/4] debug --- src/main.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main.js b/src/main.js index a6f7e69f..9ee089d7 100644 --- a/src/main.js +++ b/src/main.js @@ -163,4 +163,3 @@ window.fetch('/instance/panel.html') store.dispatch('setOption', { name: 'instanceSpecificPanelContent', value: html }) }) - From f23940a153b501f5edaecd292ebf2c7b9345d33f Mon Sep 17 00:00:00 2001 From: Hakaba Hitoyo Date: Sat, 10 Feb 2018 01:09:49 +0000 Subject: [PATCH 3/4] Update App.js --- src/App.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/App.js b/src/App.js index 4eabba8b..e9248967 100644 --- a/src/App.js +++ b/src/App.js @@ -27,7 +27,7 @@ export default { style () { return { 'background-image': `url(${this.background})` } }, sitename () { return this.$store.state.config.name }, chat () { return this.$store.state.chat.channel.state === 'joined' }, - showInstanceSpecificPanel () { return this.$store.state.config.showInstanceSpecificPanel} + showInstanceSpecificPanel () { return this.$store.state.config.showInstanceSpecificPanel } }, methods: { activatePanel (panelName) { From fe1044dfdfd565b0af7eed8e1f1b6ca02ca25e6a Mon Sep 17 00:00:00 2001 From: Hakaba Hitoyo Date: Sat, 10 Feb 2018 01:25:51 +0000 Subject: [PATCH 4/4] Update main.js --- src/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.js b/src/main.js index ca968539..6f8c00f0 100644 --- a/src/main.js +++ b/src/main.js @@ -88,7 +88,7 @@ window.fetch('/api/statusnet/config.json') window.fetch('/static/config.json') .then((res) => res.json()) .then((data) => { - const {theme, background, logo} = data + const {theme, background, logo, showInstanceSpecificPanel} = data store.dispatch('setOption', { name: 'theme', value: theme }) store.dispatch('setOption', { name: 'background', value: background }) store.dispatch('setOption', { name: 'logo', value: logo })