Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add base router for webapp #233

Merged
merged 7 commits into from
Sep 17, 2024
28 changes: 28 additions & 0 deletions server/venueless/core/migrations/0066_alter_world_domain.py
Original file line number Diff line number Diff line change
@@ -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-_./]*)?$"
)
],
),
),
]
2 changes: 1 addition & 1 deletion server/venueless/core/models/world.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 3 additions & 4 deletions server/venueless/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
5 changes: 3 additions & 2 deletions webapp/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ 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: {
primary: '#2185d0',
sidebar: '#2185d0',
bbb_background: '#ffffff',
}
}
},
basePath: '/video',
}
} else {
// load from index.html as `window.venueless = {…}`
Expand Down
12 changes: 9 additions & 3 deletions webapp/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`]
Expand Down
4 changes: 3 additions & 1 deletion webapp/src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
import Exhibitor from 'views/exhibitors/item'
import ContactRequests from 'views/contact-requests'
import Preferences from 'views/preferences'
import config from 'config'


Check failure on line 18 in webapp/src/router/index.js

View workflow job for this annotation

GitHub Actions / build

More than 1 blank line not allowed
Vue.use(VueRouter)

const routes = [{
Expand Down Expand Up @@ -240,7 +242,7 @@

const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
base: config.basePath,
routes
})

Expand Down
2 changes: 1 addition & 1 deletion webapp/src/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const DEFAULT_COLORS = {
}

const DEFAULT_LOGO = {
url: '/eventyay-video-logo.svg',
url: '/video/eventyay-video-logo.svg',
fitToWidth: false
}

Expand Down
6 changes: 3 additions & 3 deletions webapp/vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
Loading