Respect baseUrl while pushing to Ghost

This commit is contained in:
Hippo 2021-07-26 23:19:05 +05:30
parent c49836bec7
commit adcf2b4e46

View file

@ -97,11 +97,12 @@ function mediumFetch(e) {
function ghostPush(e) {
if(e) { e.preventDefault() }
const baseUrl = document.querySelector('[data-seance-url]').dataset.seanceUrl
let postSlug = document.querySelector('[data-post-slug]').dataset.postSlug
var password = document.querySelector('input[name=password]').value
console.log('Pushing ' + postSlug)
const socketProtocol = (window.location.protocol === 'https:' ? 'wss:' : 'ws:')
const socketUrl = socketProtocol + '//' + window.location.host + '/ws/push-ghost/'
const socketUrl = socketProtocol + '//' + baseUrl + '/ws/push-ghost/'
const socket = new WebSocket(socketUrl)
// set up the div