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

Extract world_id from subdomain #247

Draft
wants to merge 17 commits into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
5c63899
use the same ico with eventyay-talk
lcduong Jul 23, 2024
dea7ac3
Merge branch 'development' of github.com:lcduong/eventyay-video into …
lcduong Jul 23, 2024
233ff24
Merge branch 'development' of github.com:lcduong/eventyay-video into …
lcduong Jul 24, 2024
559f164
Merge branch 'development' of github.com:lcduong/eventyay-video into …
lcduong Jul 26, 2024
d0f8839
Merge branch 'development' of github.com:lcduong/eventyay-video into …
lcduong Jul 27, 2024
112ea46
Merge branch 'development' of github.com:lcduong/eventyay-video into …
odkhang Sep 17, 2024
ec412bf
update base path for webapp using basePath from config file
lcduong Sep 17, 2024
cf15dfd
Merge branch 'development' of github.com:lcduong/eventyay-video into …
lcduong Sep 18, 2024
5c1d37f
Merge branch 'development' of github.com:odkhang/eventyay-video into …
lcduong Sep 23, 2024
5e8d586
Merge branch 'development' of github.com:odkhang/eventyay-video into …
lcduong Sep 25, 2024
4a48997
Merge branch 'development' of github.com:lcduong/eventyay-video into …
lcduong Sep 26, 2024
4e161c7
Merge branch 'development' of github.com:lcduong/eventyay-video into …
lcduong Oct 4, 2024
8aecb37
Merge branch 'development' of github.com:lcduong/eventyay-video into …
lcduong Oct 4, 2024
d8aba6e
update route to run multiple world at ssame time
lcduong Oct 7, 2024
016791f
fix upload avatar, default theme
lcduong Oct 7, 2024
296620b
extract world_id from subdomain instead of subpath
lcduong Oct 8, 2024
03a1bca
fall back to sample worldname if can not detect worldname from subdomain
lcduong Oct 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/venueless/control/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def get(self, request, *args, **kwargs):
action_type="world.adminaccess",
data={},
)
return redirect(f"https://{world.domain}{base_path}/#token={token}")
return redirect(f"https://{world.domain}#token={token}")


class FormsetMixin:
Expand Down
4 changes: 2 additions & 2 deletions server/venueless/storage/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
from . import views

urlpatterns = [
path("upload/", views.UploadView.as_view(), name="upload"),
path("<str:world_id>/upload/", views.UploadView.as_view(), name="upload"),
path(
"schedule_import/",
"<str:world_id>/schedule_import/",
views.ScheduleImportView.as_view(),
name="schedule_import",
),
Expand Down
4 changes: 2 additions & 2 deletions server/venueless/storage/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def dispatch(self, request, *args, **kwargs):

@cached_property
def world(self):
world_domain = re.sub(r":\d+$", "", self.request.get_host())
return get_object_or_404(World, domain=world_domain)
world_id = self.kwargs.get('world_id', None)
return get_object_or_404(World, id=world_id)

@cached_property
def user(self):
Expand Down
14 changes: 10 additions & 4 deletions webapp/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@
const hostname = window.location.hostname
const wsProtocol = window.location.protocol === 'https:' ? 'wss' : 'ws'
const httpProtocol = window.location.protocol

// Extract the world name from the subdomain
// For a URL like 'wikimania.video.eventyay.com', the worldName should be 'wikimania'
const subdomains = hostname.split('.')
const worldName = subdomains.length > 2 ? subdomains[0] : 'sample' // Get the first subdomain if it exists, otherwise default to 'sample'

Check failure on line 12 in webapp/config.js

View workflow job for this annotation

GitHub Actions / build

Multiple spaces found before '// Get the fir...'

Check failure on line 12 in webapp/config.js

View workflow job for this annotation

GitHub Actions / build

Multiple spaces found before '// Get the fir...'

config = {
api: {
base: `${httpProtocol}//${hostname}:8443/api/v1/worlds/sample/`,
socket: `${wsProtocol}://${hostname}:8443/ws/world/sample/`,
upload: `${httpProtocol}//${hostname}:8443/storage/upload/`,
scheduleImport: `${httpProtocol}//${hostname}:8443/storage/schedule_import/`,
base: `${httpProtocol}//${hostname}:8443/api/v1/worlds/${worldName}/`,
socket: `${wsProtocol}://${hostname}:8443/ws/world/${worldName}/`,
upload: `${httpProtocol}//${hostname}:8443/storage/${worldName}/upload/`,
scheduleImport: `${httpProtocol}//${hostname}:8443/storage/${worldName}/schedule_import/`,
feedback: `${httpProtocol}//${hostname}:8443/_feedback/`,
},
defaultLocale: 'en',
Expand Down
35 changes: 27 additions & 8 deletions webapp/src/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,31 @@
}

export async function getThemeConfig() {
const themeUrl = config.api.base + 'theme'
const response = await (await fetch(themeUrl, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
})).json()
return response
const themeUrl = config.api.base + 'theme';

Check failure on line 154 in webapp/src/theme.js

View workflow job for this annotation

GitHub Actions / build

Expected indentation of 1 tab but found 2 spaces

Check failure on line 154 in webapp/src/theme.js

View workflow job for this annotation

GitHub Actions / build

Extra semicolon

Check failure on line 154 in webapp/src/theme.js

View workflow job for this annotation

GitHub Actions / build

Expected indentation of 1 tab but found 2 spaces

Check failure on line 154 in webapp/src/theme.js

View workflow job for this annotation

GitHub Actions / build

Extra semicolon
const response = await fetch(themeUrl, {

Check failure on line 155 in webapp/src/theme.js

View workflow job for this annotation

GitHub Actions / build

Expected indentation of 1 tab but found 2 spaces

Check failure on line 155 in webapp/src/theme.js

View workflow job for this annotation

GitHub Actions / build

Expected indentation of 1 tab but found 2 spaces
method: 'GET',

Check failure on line 156 in webapp/src/theme.js

View workflow job for this annotation

GitHub Actions / build

Expected indentation of 2 tabs but found 4 spaces

Check failure on line 156 in webapp/src/theme.js

View workflow job for this annotation

GitHub Actions / build

Expected indentation of 2 tabs but found 4 spaces
headers: {

Check failure on line 157 in webapp/src/theme.js

View workflow job for this annotation

GitHub Actions / build

Expected indentation of 2 tabs but found 4 spaces

Check failure on line 157 in webapp/src/theme.js

View workflow job for this annotation

GitHub Actions / build

Expected indentation of 2 tabs but found 4 spaces
'Content-Type': 'application/json'
}
});

let themeConfig;
if (response.ok) {
const data = await response.json();
themeConfig = {
colors: data.colors || configColors,
logo: Object.assign({}, DEFAULT_LOGO, data.logo),
streamOfflineImage: data.streamOfflineImage,
identicons: Object.assign({}, DEFAULT_IDENTICONS, data.identicons),
};
} else {
console.error("Failed to fetch theme config, set default:", response.statusText);
themeConfig = {
colors: configColors,
logo: Object.assign({}, DEFAULT_LOGO, config.theme?.logo),
streamOfflineImage: config.theme?.streamOfflineImage,
identicons: Object.assign({}, DEFAULT_IDENTICONS, config.theme?.identicons),
};
}
return themeConfig;
}
Loading