diff --git a/server/venueless/core/migrations/0066_alter_world_domain.py b/server/venueless/core/migrations/0066_alter_world_domain.py new file mode 100644 index 00000000..541011dc --- /dev/null +++ b/server/venueless/core/migrations/0066_alter_world_domain.py @@ -0,0 +1,28 @@ +# Generated by Django 4.2.14 on 2024-09-17 03:37 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("core", "0065_chat_mentions"), + ] + + operations = [ + migrations.AlterField( + model_name="world", + name="domain", + field=models.CharField( + blank=True, + max_length=250, + null=True, + unique=True, + validators=[ + django.core.validators.RegexValidator( + regex="^[a-z0-9-.:]+(/[a-zA-Z0-9-_./]*)?$" + ) + ], + ), + ), + ] diff --git a/server/venueless/core/models/world.py b/server/venueless/core/models/world.py index adcf256f..cb7695b4 100644 --- a/server/venueless/core/models/world.py +++ b/server/venueless/core/models/world.py @@ -138,7 +138,7 @@ class World(VersionedModel): unique=True, null=True, blank=True, - validators=[RegexValidator(regex=r"^[a-z0-9-.:]+$")], + validators=[RegexValidator(regex=r"^[a-z0-9-.:]+(/[a-zA-Z0-9-_./]*)?$")], ) locale = models.CharField( max_length=100, diff --git a/server/venueless/settings.py b/server/venueless/settings.py index 304718ce..46bbfd9b 100644 --- a/server/venueless/settings.py +++ b/server/venueless/settings.py @@ -309,10 +309,9 @@ 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 - r"^https?://wikimania-live\.eventyay\.com(:\d+)?$", # Allow wikimania-live.eventyay.com with any port + r"^https?://([\w\-]+\.)?eventyay\.com$", # Allow any subdomain of eventyay.com + r"^https?://app-test\.eventyay\.com(:\d+)?$", # Allow video-dev.eventyay.com with any port + r"^https?://app\.eventyay\.com(:\d+)?$", # Allow wikimania-live.eventyay.com with any port ] if DEBUG: CORS_ORIGIN_REGEX_WHITELIST = [ diff --git a/webapp/config.js b/webapp/config.js index 616ed23e..74cc3ed2 100644 --- a/webapp/config.js +++ b/webapp/config.js @@ -17,7 +17,7 @@ if (ENV_DEVELOPMENT || !window.venueless) { locales: ['en', 'de', 'pt_BR', 'ar', 'fr', 'es', 'uk', 'ru'], theme: { logo: { - url: '/eventyay-video-logo.svg', + url: '/video/eventyay-video-logo.svg', fitToWidth: false }, colors: { @@ -25,7 +25,8 @@ if (ENV_DEVELOPMENT || !window.venueless) { sidebar: '#2185d0', bbb_background: '#ffffff', } - } + }, + basePath: '/video', } } else { // load from index.html as `window.venueless = {…}` diff --git a/webapp/src/main.js b/webapp/src/main.js index 2b16d074..4a8d86dd 100644 --- a/webapp/src/main.js +++ b/webapp/src/main.js @@ -50,19 +50,25 @@ async function init({token, inviteToken}) { window.vapp = app store.commit('setUserLocale', i18n.resolvedLanguage) store.dispatch('updateUserTimezone', localStorage.userTimezone || moment.tz.guess()) + // Get the path relative to the publicPath + const basePath = config.basePath || '' + let relativePath = location.pathname.replace(basePath, '') + if (!relativePath) { + relativePath = '/' + } - const { route } = router.resolve(location.pathname) + const { route } = router.resolve(relativePath) const anonymousRoomId = route.name === 'standalone:anonymous' ? route.params.roomId : null if (token) { localStorage.token = token - router.replace(location.pathname) + router.replace(relativePath) store.dispatch('login', {token}) } else if (localStorage.token) { store.dispatch('login', {token: localStorage.token}) } else if (inviteToken && anonymousRoomId) { const clientId = uuid() localStorage[`clientId:room:${anonymousRoomId}`] = clientId - router.replace(location.pathname) + router.replace(relativePath) store.dispatch('login', {clientId, inviteToken}) } else if (anonymousRoomId && localStorage[`clientId:room:${anonymousRoomId}`]) { const clientId = localStorage[`clientId:room:${anonymousRoomId}`] diff --git a/webapp/src/router/index.js b/webapp/src/router/index.js index 9d1b7a1f..3ba2992b 100644 --- a/webapp/src/router/index.js +++ b/webapp/src/router/index.js @@ -13,6 +13,8 @@ import Speaker from 'views/schedule/speakers/item' import Exhibitor from 'views/exhibitors/item' import ContactRequests from 'views/contact-requests' import Preferences from 'views/preferences' +import config from 'config' + Vue.use(VueRouter) @@ -240,7 +242,7 @@ const routes = [{ const router = new VueRouter({ mode: 'history', - base: process.env.BASE_URL, + base: config.basePath, routes }) diff --git a/webapp/src/theme.js b/webapp/src/theme.js index d07038d8..53d8cabb 100644 --- a/webapp/src/theme.js +++ b/webapp/src/theme.js @@ -53,7 +53,7 @@ const DEFAULT_COLORS = { } const DEFAULT_LOGO = { - url: '/eventyay-video-logo.svg', + url: '/video/eventyay-video-logo.svg', fitToWidth: false } diff --git a/webapp/vue.config.js b/webapp/vue.config.js index 0c388c8c..4e0338c2 100644 --- a/webapp/vue.config.js +++ b/webapp/vue.config.js @@ -11,12 +11,12 @@ module.exports = { devServer: { host: '0.0.0.0', port: 8880, - public: 'video-dev.eventyay.com', + public: 'app-test.eventyay.com', allowedHosts: [ '.localhost', '.eventyay.com', - 'video-dev.eventyay.com', - 'video.eventyay.com' + 'app-test.eventyay.com', + 'app.eventyay.com' ], }, pwa: {