forked from AkkomaGang/akkoma-fe
configurable who to follow panel
This commit is contained in:
parent
77ffa89464
commit
2ade177d5a
3 changed files with 17 additions and 5 deletions
|
@ -69,8 +69,10 @@ function getWhoToFollow (panel) {
|
||||||
panel.name2 = 'Loading...'
|
panel.name2 = 'Loading...'
|
||||||
panel.name3 = 'Loading...'
|
panel.name3 = 'Loading...'
|
||||||
var host = window.location.hostname
|
var host = window.location.hostname
|
||||||
var url = 'https://vinayaka.distsn.org/cgi-bin/vinayaka-user-match-simple-api.cgi?' +
|
var whoToFollowProvider = this.$store.state.config.whoToFollowProvider
|
||||||
encodeURIComponent(host) + '+' + encodeURIComponent(user)
|
var url
|
||||||
|
url = whoToFollowProvider.replace(/{{host}}/g, encodeURIComponent(host))
|
||||||
|
url = url.replace(/{{user}}/g, encodeURIComponent(user))
|
||||||
window.fetch(url, {mode: 'cors'}).then(function (response) {
|
window.fetch(url, {mode: 'cors'}).then(function (response) {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
return response.json()
|
return response.json()
|
||||||
|
@ -104,8 +106,10 @@ const WhoToFollowPanel = {
|
||||||
moreUrl: function () {
|
moreUrl: function () {
|
||||||
var host = window.location.hostname
|
var host = window.location.hostname
|
||||||
var user = this.user
|
var user = this.user
|
||||||
var url = 'https://vinayaka.distsn.org/?' +
|
var whoToFollowLink = this.$store.state.config.whoToFollowLink
|
||||||
encodeURIComponent(host) + '+' + encodeURIComponent(user)
|
var url
|
||||||
|
url = whoToFollowLink.replace(/{{host}}/g, encodeURIComponent(host))
|
||||||
|
url = url.replace(/{{user}}/g, encodeURIComponent(user))
|
||||||
return url
|
return url
|
||||||
},
|
},
|
||||||
showWhoToFollowPanel () {
|
showWhoToFollowPanel () {
|
||||||
|
|
|
@ -88,11 +88,13 @@ window.fetch('/api/statusnet/config.json')
|
||||||
window.fetch('/static/config.json')
|
window.fetch('/static/config.json')
|
||||||
.then((res) => res.json())
|
.then((res) => res.json())
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
const {theme, background, logo, showWhoToFollowPanel, showInstanceSpecificPanel} = data
|
const {theme, background, logo, showWhoToFollowPanel, whoToFollowProvider, whoToFollowLink, showInstanceSpecificPanel} = data
|
||||||
store.dispatch('setOption', { name: 'theme', value: theme })
|
store.dispatch('setOption', { name: 'theme', value: theme })
|
||||||
store.dispatch('setOption', { name: 'background', value: background })
|
store.dispatch('setOption', { name: 'background', value: background })
|
||||||
store.dispatch('setOption', { name: 'logo', value: logo })
|
store.dispatch('setOption', { name: 'logo', value: logo })
|
||||||
store.dispatch('setOption', { name: 'showWhoToFollowPanel', value: showWhoToFollowPanel })
|
store.dispatch('setOption', { name: 'showWhoToFollowPanel', value: showWhoToFollowPanel })
|
||||||
|
store.dispatch('setOption', { name: 'whoToFollowProvider', value: whoToFollowProvider })
|
||||||
|
store.dispatch('setOption', { name: 'whoToFollowLink', value: whoToFollowLink })
|
||||||
store.dispatch('setOption', { name: 'showInstanceSpecificPanel', value: showInstanceSpecificPanel })
|
store.dispatch('setOption', { name: 'showInstanceSpecificPanel', value: showInstanceSpecificPanel })
|
||||||
if (data['chatDisabled']) {
|
if (data['chatDisabled']) {
|
||||||
store.dispatch('disableChat')
|
store.dispatch('disableChat')
|
||||||
|
|
|
@ -6,5 +6,11 @@
|
||||||
"redirectRootLogin": "/main/friends",
|
"redirectRootLogin": "/main/friends",
|
||||||
"chatDisabled": false,
|
"chatDisabled": false,
|
||||||
"showWhoToFollowPanel": false,
|
"showWhoToFollowPanel": false,
|
||||||
|
"whoToFollowProvider": "https://vinayaka.distsn.org/cgi-bin/vinayaka-user-match-simple-api.cgi?{{host}}+{{user}}",
|
||||||
|
"whoToFollowProviderDummy1": "https://vinayaka.distsn.org/cgi-bin/vinayaka-user-match-osa-api.cgi?{{host}}+{{user}}",
|
||||||
|
"whoToFollowProviderDummy2": "https://followlink.osa-p.net/api/get_recommend.json?acct=@{{user}}@{{host}}",
|
||||||
|
"whoToFollowLink": "https://vinayaka.distsn.org/?{{host}}+{{user}}",
|
||||||
|
"whoToFollowLinkDummy1": "https://vinayaka.distsn.org/?{{host}}+{{user}}",
|
||||||
|
"whoToFollowLinkDummy2": "https://followlink.osa-p.net/recommend.html",
|
||||||
"showInstanceSpecificPanel": false
|
"showInstanceSpecificPanel": false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue