Skip to content

Commit

Permalink
fix upload avatar, default theme
Browse files Browse the repository at this point in the history
  • Loading branch information
lcduong committed Oct 7, 2024
1 parent d8aba6e commit 016791f
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 14 deletions.
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
4 changes: 2 additions & 2 deletions webapp/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ if (ENV_DEVELOPMENT || !window.venueless) {
api: {
base: `${httpProtocol}//${hostname}:8443/api/v1/worlds/${worldName}/`,
socket: `${wsProtocol}://${hostname}:8443/ws/world/${worldName}/`,
upload: `${httpProtocol}//${hostname}:8443/storage/upload/`,
scheduleImport: `${httpProtocol}//${hostname}:8443/storage/schedule_import/`,
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 function computeForegroundSidebarColor(colors) {
}

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';
const response = await fetch(themeUrl, {
method: 'GET',
headers: {
'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;
}

0 comments on commit 016791f

Please sign in to comment.