diff --git a/make.sh b/make.sh
index 99b5a78..31338b6 100755
--- a/make.sh
+++ b/make.sh
@@ -1,18 +1,2 @@
#!/bin/bash
-scriptPath=$(dirname -- "${0}")
-domainPath="${scriptPath}/../../data/domain"
-
-domain="${DOMAIN}"
-
-if [ -z "${domain}" ] && [ -f "${domainPath}" ]; then
- domain=$(cat "${domainPath}")
-fi
-
-if [ -z "${domain}" ]; then
- echo -e "\033[0;41mDOMAIN is not set, and ${domainPath} does not exist!\033[0m"
- exit 1
-fi
-
-NEXT_PUBLIC_DOMAIN="${domain}" npm run export
-
-echo "Exported with domain: '${domain}'"
+npm run export
diff --git a/src/components/header.jsx b/src/components/header.jsx
index 88ec388..04b83fd 100644
--- a/src/components/header.jsx
+++ b/src/components/header.jsx
@@ -2,8 +2,6 @@ import React from 'react'
import Head from 'next/head'
import { useQueryClient } from 'react-query'
-import constants from '../constants'
-
export default function Header(props) {
const { title } = props
const queryClient = useQueryClient()
@@ -17,7 +15,9 @@ export default function Header(props) {
return (
- {`${unreadString}${titleString}Qmining | ${constants.domain}`}
+ {`${unreadString}${titleString}Qmining${
+ typeof window !== 'undefined' ? `| ${window.location.domain}` : ''
+ }`}
)
}
diff --git a/src/constants.js b/src/constants.js
index c0f9d4d..18b54ac 100644
--- a/src/constants.js
+++ b/src/constants.js
@@ -1,22 +1,10 @@
// eslint-disable-next-line no-undef
const useLocalhost = process && process.env.NODE_ENV === 'development'
-// eslint-disable-next-line no-undef
-const domain = process && process.env.NEXT_PUBLIC_DOMAIN
-
-if (!domain && !useLocalhost) {
- throw new Error(
- 'Domain is not defined! Please set NEXT_PUBLIC_DOMAIN env variable!'
- )
-}
const constants = {
- domain: domain || 'localhost',
// FIXME: remove siteUrl, replace with Link
- siteUrl: useLocalhost ? 'http://localhost:8080/' : `https://${domain}/`,
- apiUrl: useLocalhost
- ? 'http://localhost:8080/api/'
- : `https://${domain}/api/`,
- chatUrl: useLocalhost ? 'http://localhost:8080/' : `https://${domain}/`,
+ siteUrl: useLocalhost ? 'http://localhost:8080/' : '/',
+ apiUrl: useLocalhost ? 'http://localhost:8080/api/' : '/api/',
mobileWindowWidth: 700,
maxQuestionsToRender: 250,
imageExts: ['gif', 'png', 'jpeg', 'jpg'],
diff --git a/src/pages/chat.jsx b/src/pages/chat.jsx
index 4e6e5b5..428f9ca 100644
--- a/src/pages/chat.jsx
+++ b/src/pages/chat.jsx
@@ -202,7 +202,7 @@ export default class Chat extends React.Component {
return
}
// https://socket.io/docs/v4/handling-cors/#Configuration
- const socket = io(`${constants.chatUrl}`, {
+ const socket = io(`${constants.siteUrl}`, {
withCredentials: true,
extraHeaders: {
'qmining-chat': 'qmining-chat',