Skip to content

Commit

Permalink
Fix issue WDS in error log console (#146)
Browse files Browse the repository at this point in the history
* fix issue error log with wds
* add cors whitelist for server
* based on the protocal, use http/https for communication webapp to server
  • Loading branch information
odkhang authored Jul 5, 2024
1 parent 3aa2c23 commit 214a782
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions server/venueless/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,11 @@

ROOT_URLCONF = "venueless.urls"

CORS_ORIGIN_REGEX_WHITELIST = [
r"^https?://(\w+\.)?eventyay\.com$", # Allow any subdomain of eventyay.com
r"^https?://video\.eventyay\.com(:\d+)?$", # Allow video.eventyay.com with any port
r"^https?://video-dev\.eventyay\.com(:\d+)?$", # Allow video-dev.eventyay.com with any port
]
if DEBUG:
CORS_ORIGIN_REGEX_WHITELIST = [
r"^http://localhost$",
Expand Down
9 changes: 5 additions & 4 deletions webapp/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ let config
if (ENV_DEVELOPMENT || !window.venueless) {
const hostname = window.location.hostname
const wsProtocol = window.location.protocol === 'https:' ? 'wss' : 'ws';

Check failure on line 6 in webapp/config.js

View workflow job for this annotation

GitHub Actions / build

Extra semicolon
const httpProtocol = window.location.protocol;

Check failure on line 7 in webapp/config.js

View workflow job for this annotation

GitHub Actions / build

Extra semicolon
config = {
api: {
base: `http://${hostname}:8443/api/v1/worlds/sample/`,
base: `${httpProtocol}//${hostname}:8443/api/v1/worlds/sample/`,
socket: `${wsProtocol}://${hostname}:8443/ws/world/sample/`,
upload: `http://${hostname}:8443/storage/upload/`,
scheduleImport: `http://${hostname}:8443/storage/schedule_import/`,
feedback: `http://${hostname}:8443/_feedback/`,
upload: `${httpProtocol}//${hostname}:8443/storage/upload/`,
scheduleImport: `${httpProtocol}//${hostname}:8443/storage/schedule_import/`,
feedback: `${httpProtocol}//${hostname}:8443/_feedback/`,
},
defaultLocale: 'en',
locales: ['en', 'de', 'pt_BR'],
Expand Down
3 changes: 2 additions & 1 deletion webapp/vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ const NODE_PATH = process.env.NODE_PATH

module.exports = {
devServer: {
host: 'localhost',
host: '0.0.0.0',
port: 8880,
public: 'video-dev.eventyay.com',
allowedHosts: [
'.localhost',
'.eventyay.com',
Expand Down

0 comments on commit 214a782

Please sign in to comment.