mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-01 18:57:24 +00:00
Formats code comments as sentences in the build and asset files.
Capitalizes the first word and adds the terminal period in the Dockerfiles, the compose files, the CI workflow, the MSBuild comments, the Razor views and the client assets. The existing delimiter spacing is preserved, structural banners and commented-out commands are untouched, and the Dockerfile tool names use their proper case.
This commit is contained in:
1 parent
057f557791
commit
ee55ac482c
25 files changed
+121
-121
No files matched your search
@@ -4,7 +4,7 @@ on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
workflow_dispatch: # enable manual triggers
|
||||
workflow_dispatch: # Enable manual triggers.
|
||||
|
||||
jobs:
|
||||
run-platform-tests:
|
||||
@@ -32,8 +32,8 @@ jobs:
|
||||
- name: Build
|
||||
run: dotnet build src/Lumina.slnx --no-restore -p:SixLaborsLicenseEnforceBuild=true
|
||||
- name: Run tests
|
||||
# blame-hang terminates a test that blocks for 10 minutes and dumps the hang stack,
|
||||
# turning the recurring 'stuck job' into a failing job that names the culprit test
|
||||
# Blame-hang terminates a test that blocks for 10 minutes and dumps the hang stack,
|
||||
# turning the recurring 'stuck job' into a failing job that names the culprit test.
|
||||
run: dotnet test src/Lumina.slnx --no-build --verbosity normal --blame-hang --blame-hang-timeout 10m
|
||||
- name: Upload hang diagnostics
|
||||
if: failure()
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Lumina.Plugins.Contracts\Lumina.Plugins.Contracts.csproj">
|
||||
<Private>false</Private><!--Do not copy this assembly in the output directory, it's loaded from somewhere else-->
|
||||
<Private>false</Private><!--Do not copy this assembly in the output directory, it's loaded from somewhere else.-->
|
||||
<ExcludeAssets>runtime</ExcludeAssets>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Lumina.Plugins.Contracts\Lumina.Plugins.Contracts.csproj">
|
||||
<Private>false</Private><!--Do not copy this assembly in the output directory, it's loaded from somewhere else-->
|
||||
<Private>false</Private><!--Do not copy this assembly in the output directory, it's loaded from somewhere else.-->
|
||||
<ExcludeAssets>runtime</ExcludeAssets>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Lumina.Plugins.Contracts\Lumina.Plugins.Contracts.csproj">
|
||||
<Private>false</Private><!--Do not copy this assembly in the output directory, it's loaded from somewhere else-->
|
||||
<Private>false</Private><!--Do not copy this assembly in the output directory, it's loaded from somewhere else.-->
|
||||
<ExcludeAssets>runtime</ExcludeAssets>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Lumina.Plugins.Contracts\Lumina.Plugins.Contracts.csproj">
|
||||
<Private>false</Private><!--Do not copy this assembly in the output directory, it's loaded from somewhere else-->
|
||||
<Private>false</Private><!--Do not copy this assembly in the output directory, it's loaded from somewhere else.-->
|
||||
<ExcludeAssets>runtime</ExcludeAssets>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Lumina.Plugins.Contracts\Lumina.Plugins.Contracts.csproj">
|
||||
<Private>false</Private><!--Do not copy this assembly in the output directory, it's loaded from somewhere else-->
|
||||
<Private>false</Private><!--Do not copy this assembly in the output directory, it's loaded from somewhere else.-->
|
||||
<ExcludeAssets>runtime</ExcludeAssets>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Lumina.Plugins.Contracts\Lumina.Plugins.Contracts.csproj">
|
||||
<Private>false</Private><!--Do not copy this assembly in the output directory, it's loaded from somewhere else-->
|
||||
<Private>false</Private><!--Do not copy this assembly in the output directory, it's loaded from somewhere else.-->
|
||||
<ExcludeAssets>runtime</ExcludeAssets>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Lumina.Plugins.Contracts\Lumina.Plugins.Contracts.csproj">
|
||||
<Private>false</Private><!--Do not copy this assembly in the output directory, it's loaded from somewhere else-->
|
||||
<Private>false</Private><!--Do not copy this assembly in the output directory, it's loaded from somewhere else.-->
|
||||
<ExcludeAssets>runtime</ExcludeAssets>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Lumina.Plugins.Contracts\Lumina.Plugins.Contracts.csproj">
|
||||
<Private>false</Private><!--Do not copy this assembly in the output directory, it's loaded from somewhere else-->
|
||||
<Private>false</Private><!--Do not copy this assembly in the output directory, it's loaded from somewhere else.-->
|
||||
<ExcludeAssets>runtime</ExcludeAssets>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# This stage is used when running from VS in fast mode (Default for Debug configuration)
|
||||
# This stage is used when running from VS in fast mode (Default for Debug configuration).
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
|
||||
# curl is used by the container healthcheck to probe the /health endpoints
|
||||
# ffmpeg is used by the API server to remux or transcode audio the browser cannot play directly.
|
||||
# Curl is used by the container healthcheck to probe the /health endpoints.
|
||||
# FFmpeg is used by the API server to remux or transcode audio the browser cannot play directly.
|
||||
# The package comes from the base image distribution and is not version-pinned, so the encoder set can change with a base image rebuild.
|
||||
# The API startup probe verifies the encoders the normalization catalog uses and reports a missing one at startup. Pin the base image digest
|
||||
# or the package version when a fully reproducible toolchain is required.
|
||||
@@ -20,7 +20,7 @@ ARG BUILD_CONFIGURATION=Release
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
# restore NuGet packages (keeping this section separate from the rest of the project files allows Docker to cache the restored packages)
|
||||
# Restore NuGet packages (keeping this section separate from the rest of the project files allows Docker to cache the restored packages).
|
||||
COPY ["AssemblyInfo_Shared.cs", "."]
|
||||
COPY ["Lumina.Presentation.Api/Lumina.Presentation.Api.csproj", "Lumina.Presentation.Api/"]
|
||||
COPY ["Lumina.Application/Lumina.Application.csproj", "Lumina.Application/"]
|
||||
@@ -33,7 +33,7 @@ COPY ["Lumina.Plugins.Contracts/Lumina.Plugins.Contracts.csproj", "Lumina.Plugin
|
||||
|
||||
RUN dotnet restore "./Lumina.Presentation.Api/Lumina.Presentation.Api.csproj" /p:BaseOutputPath=/app/publish/
|
||||
|
||||
# build the project
|
||||
# Build the project.
|
||||
COPY ["Lumina.Presentation.Api/", "Lumina.Presentation.Api/"]
|
||||
COPY ["Lumina.Application/", "Lumina.Application/"]
|
||||
COPY ["Lumina.Contracts/", "Lumina.Contracts/"]
|
||||
@@ -60,10 +60,10 @@ WORKDIR /app
|
||||
|
||||
COPY --from=publish /app/publish .
|
||||
# The HTTP port is controlled per run mode: launchSettings.json for local development, ASPNETCORE_HTTP_PORTS here for
|
||||
# Docker, and for a published DLL run directly on a host, ASPNETCORE_URLS (or ASPNETCORE_HTTP_PORTS) must be set
|
||||
# Docker, and for a published DLL run directly on a host, ASPNETCORE_URLS (or ASPNETCORE_HTTP_PORTS) must be set.
|
||||
ENV ASPNETCORE_HTTP_PORTS=5214
|
||||
EXPOSE 5214
|
||||
ENTRYPOINT ["dotnet", "Lumina.Presentation.Api.dll"]
|
||||
|
||||
# to build this Docker image, run the following command from the root of the project (location of the .slnx solution file):
|
||||
# To build this Docker image, run the following command from the root of the project (location of the .slnx solution file):
|
||||
# docker build --no-cache -t lumina-api -f Lumina.Presentation.Api/Dockerfile .
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
@inject IViewLocalizer _localizer
|
||||
|
||||
<div style="display: grid; grid-template-rows: auto 1fr;"><!--container with two rows, one fixed, one filling remaining space-->
|
||||
<div style="min-height: 1rem;"></div><!--the first row is a dummy row for "margin", because setting a margin on the next row would offset the parent's position-->
|
||||
<div style="display: grid; grid-template-rows: auto 1fr;"><!--Container with two rows, one fixed, one filling remaining space.-->
|
||||
<div style="min-height: 1rem;"></div><!--The first row is a dummy row for "margin", because setting a margin on the next row would offset the parent's position.-->
|
||||
<div class="enlightenment-panel shadow-effect p-2 mx-auto panel w-55 mb-10" style="min-width: 320px;">
|
||||
<div class="shine-effect"></div>
|
||||
<div class="text-center w-100">
|
||||
|
||||
+8
-8
@@ -12,7 +12,7 @@
|
||||
<div id="file-system-browser-content">
|
||||
<div id="file-system-browser-header">
|
||||
<div id="file-system-browser-header-navigation-container">
|
||||
<!--File System Navigator-->
|
||||
<!--File System Navigator.-->
|
||||
<div id="navigator-view-mode-container">
|
||||
<button id="navigator-list-view" type="button">@_localizer["ListView"]</button>
|
||||
<button id="navigator-details-view" type="button">@_localizer["DetailsView"]</button>
|
||||
@@ -21,7 +21,7 @@
|
||||
<button id="navigator-large-icons-view" type="button">@_localizer["LargeIconsView"]</button>
|
||||
<button id="navigator-extra-large-icons-view" type="button">@_localizer["ExtraLargeIconsView"]</button>
|
||||
</div>
|
||||
<!--Navigation-->
|
||||
<!--Navigation.-->
|
||||
<div id="navigator-navigation-controls-container">
|
||||
<div id="navigator-history">
|
||||
<button id="navigator-navigate-back" type="button">@_localizer["Back"]</button>
|
||||
@@ -33,7 +33,7 @@
|
||||
<button id="navigator-toggle-hidden-button" type="button">@_localizer["ToggleHiddenItems"]</button>
|
||||
<button id="navigator-toggle-selection-button" type="button">@_localizer["ToggleSelectionMode"]</button>
|
||||
</div>
|
||||
<!--Navigator-->
|
||||
<!--Navigator.-->
|
||||
<div id="navigator-address-bar-container">
|
||||
<div id="navigator-address-bar-group">
|
||||
<input type="text" class="navigator-address-bar-input" Name="navigator-address-bar-input" autocomplete="on" id="navigator-address-bar-input" />
|
||||
@@ -47,18 +47,18 @@
|
||||
<button class="file-system-browser-content-new-directory" type="button">@_localizer["NewDirectory"]</button>
|
||||
<button class="file-system-browser-content-favorite-directory" type="button">@_localizer["FavoriteDirectory"]</button>
|
||||
</div>
|
||||
<!--End File System Navigator-->
|
||||
<!--End File System Navigator.-->
|
||||
</div>
|
||||
</div>
|
||||
<div id="file-system-browser-file-system-container">
|
||||
<!--File System Tree View-->
|
||||
<!--File System Tree View.-->
|
||||
<div id="file-system-browser-file-system-treeview-container">
|
||||
<div id="file-system-browser-file-system-treeview">
|
||||
<div id="file-system-browser-treeview" class="treeview">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--End File System Tree View-->
|
||||
<!--End File System Tree View.-->
|
||||
<div id="file-system-browser-file-system-directories-container">
|
||||
<div id="file-system-browser-file-system-directories">
|
||||
<div id="file-system-browser-file-system-explorer-container" class="scroll-horizontal">
|
||||
@@ -88,9 +88,9 @@
|
||||
<script defer src="~/js/theme-client-template-engine.js" data-component-script="file-system-browser"></script>
|
||||
<script defer src="~/js/file-system-browser-dialog.js" data-component-script="file-system-browser"></script>
|
||||
<script defer data-component-init="file-system-browser">
|
||||
// this outer function executes immediately and creates a scope for the variables
|
||||
// This outer function executes immediately and creates a scope for the variables.
|
||||
(function() {
|
||||
// this inner function contains the actual initialization code that needs to run
|
||||
// This inner function contains the actual initialization code that needs to run.
|
||||
async function checkAndInit() {
|
||||
if (typeof initFileSystemBrowser === 'undefined' || typeof callApiGetAsync === 'undefined') {
|
||||
setTimeout(checkAndInit, 10);
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
@inject IViewLocalizer _localizer
|
||||
|
||||
<div style="display: grid; grid-template-rows: auto 1fr;">
|
||||
<!--container with two rows, one fixed, one filling remaining space-->
|
||||
<div style="min-height: 1rem;"></div><!--the first row is a dummy row for "margin", because setting a margin on the next row would offset the parent's position-->
|
||||
<!--Container with two rows, one fixed, one filling remaining space.-->
|
||||
<div style="min-height: 1rem;"></div><!--The first row is a dummy row for "margin", because setting a margin on the next row would offset the parent's position.-->
|
||||
<div class="enlightenment-panel shadow-effect p-2 mx-auto panel w-55 mb-10" style="min-width: 320px;">
|
||||
<div class="shine-effect"></div>
|
||||
<div class="text-center w-100">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# This stage is used when running from VS in fast mode (Default for Debug configuration)
|
||||
# This stage is used when running from VS in fast mode (Default for Debug configuration).
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
|
||||
# curl is used by the container healthcheck to probe the /health endpoints
|
||||
# Curl is used by the container healthcheck to probe the /health endpoints.
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends curl \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
@@ -17,13 +17,13 @@ ARG BUILD_CONFIGURATION=Release
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
# restore NuGet packages (keeping this section separate from the rest of the project files allows Docker to cache the restored packages)
|
||||
# Restore NuGet packages (keeping this section separate from the rest of the project files allows Docker to cache the restored packages).
|
||||
COPY ["AssemblyInfo_Shared.cs", "."]
|
||||
COPY ["Lumina.Presentation.Web/Lumina.Presentation.Web.csproj", "Lumina.Presentation.Web/"]
|
||||
|
||||
RUN dotnet restore "./Lumina.Presentation.Web/Lumina.Presentation.Web.csproj" /p:BaseOutputPath=/app/publish/
|
||||
|
||||
# build the project
|
||||
# Build the project.
|
||||
COPY ["Lumina.Presentation.Web/", "Lumina.Presentation.Web/"]
|
||||
COPY . .
|
||||
WORKDIR /src/Lumina.Presentation.Web
|
||||
@@ -45,10 +45,10 @@ WORKDIR /app
|
||||
|
||||
COPY --from=publish /app/publish .
|
||||
# The HTTP port is controlled per run mode: launchSettings.json for local development, ASPNETCORE_HTTP_PORTS here for
|
||||
# Docker, and for a published DLL run directly on a host, ASPNETCORE_URLS (or ASPNETCORE_HTTP_PORTS) must be set
|
||||
# Docker, and for a published DLL run directly on a host, ASPNETCORE_URLS (or ASPNETCORE_HTTP_PORTS) must be set.
|
||||
ENV ASPNETCORE_HTTP_PORTS=5012
|
||||
EXPOSE 5012
|
||||
ENTRYPOINT ["dotnet", "Lumina.Presentation.Web.dll"]
|
||||
|
||||
# to build this Docker image, run the following command from the root of the project (location of the .slnx solution file):
|
||||
# To build this Docker image, run the following command from the root of the project (location of the .slnx solution file):
|
||||
# docker build --no-cache -t lumina-web -f Lumina.Presentation.Web/Dockerfile .
|
||||
@@ -1504,7 +1504,7 @@ html.audio-player-initializing .audio-player-container {
|
||||
}
|
||||
|
||||
.audio-player-container.expanded {
|
||||
height: calc(100% - 22px); /* expanded height, less the height of the menu bar */
|
||||
height: calc(100% - 22px); /* Expanded height, less the height of the menu bar. */
|
||||
}
|
||||
|
||||
.audio-player-bar {
|
||||
|
||||
@@ -411,7 +411,7 @@
|
||||
return;
|
||||
try {
|
||||
const closing = decoder.close();
|
||||
// close never rejects, but a decoder implementation that returns a rejected promise must not leave an
|
||||
// Close never rejects, but a decoder implementation that returns a rejected promise must not leave an
|
||||
// unhandled rejection behind, so the outcome is deliberately discarded.
|
||||
if (closing && typeof closing.catch === 'function')
|
||||
closing.catch(() => {});
|
||||
|
||||
@@ -350,7 +350,7 @@
|
||||
if (segmentIndex === -1)
|
||||
return null;
|
||||
const segment = this.segments[segmentIndex];
|
||||
// local is the offset of the requested window inside the segment. position is the segment offset of the chunk
|
||||
// Local is the offset of the requested window inside the segment. position is the segment offset of the chunk
|
||||
// the loop is looking at, and filled is how many requested bytes were already copied.
|
||||
const local = start - segment.start;
|
||||
const result = new Uint8Array(size);
|
||||
|
||||
@@ -949,7 +949,7 @@
|
||||
return;
|
||||
const elapsed = this.advanceClock(timestamp);
|
||||
const now = this.clockMilliseconds;
|
||||
// levels is null on most frames: either the meter is stopped, or no new block of samples is due yet (see
|
||||
// Levels is null on most frames: either the meter is stopped, or no new block of samples is due yet (see
|
||||
// readLevels). A null means "no new measurement", not "silence", so the code below only lets the bars fall.
|
||||
const levels = this.isInputActive && this.spectrum ? this.spectrum.readLevels(now / 1000) : null;
|
||||
this.ensureLevelArrays();
|
||||
|
||||
@@ -120,7 +120,7 @@ class DialogService {
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
// add a resize observer to handle content height
|
||||
// Add a resize observer to handle content height.
|
||||
const resizeObserver = new ResizeObserver(() => {
|
||||
const modalHeight = modalBackground.clientHeight;
|
||||
const dialogContent = dialogElement.querySelector('.dialog-content');
|
||||
@@ -130,13 +130,13 @@ class DialogService {
|
||||
|
||||
resizeObserver.observe(modalBackground);
|
||||
|
||||
// cleanup observer when dialog is closed
|
||||
// Cleanup observer when dialog is closed.
|
||||
const cleanup = () => {
|
||||
resizeObserver.disconnect();
|
||||
document.removeEventListener('keydown', keyHandler);
|
||||
};
|
||||
|
||||
// add click handlers for buttons
|
||||
// Add click handlers for buttons.
|
||||
const buttons = dialogElement.querySelectorAll('.dialog-button');
|
||||
buttons.forEach(button => {
|
||||
button.addEventListener('click', () => {
|
||||
@@ -145,7 +145,7 @@ class DialogService {
|
||||
});
|
||||
});
|
||||
|
||||
// add keyboard support
|
||||
// Add keyboard support.
|
||||
const keyHandler = (e) => {
|
||||
if (e.key === 'Escape' && dialog.buttons.includes(DialogButton.CANCEL)) {
|
||||
cleanup();
|
||||
@@ -194,5 +194,5 @@ class DialogService {
|
||||
}
|
||||
}
|
||||
|
||||
// create a global instance of the DialogService
|
||||
// Create a global instance of the DialogService.
|
||||
const dialogService = new DialogService();
|
||||
@@ -39,7 +39,7 @@ class ImageViewerService {
|
||||
document.removeEventListener('keydown', this.keydownHandler);
|
||||
this.keydownHandler = null;
|
||||
}
|
||||
// stop the browser from finishing the load of the previous image in the background
|
||||
// Stop the browser from finishing the load of the previous image in the background.
|
||||
this.imageElement.removeAttribute('src');
|
||||
this.items = [];
|
||||
}
|
||||
@@ -87,13 +87,13 @@ class ImageViewerService {
|
||||
this.prevButton = this.overlay.querySelector('.image-viewer-prev');
|
||||
this.nextButton = this.overlay.querySelector('.image-viewer-next');
|
||||
|
||||
// clicking the dimmed background closes the viewer, but not the image or the controls
|
||||
// Clicking the dimmed background closes the viewer, but not the image or the controls.
|
||||
this.overlay.addEventListener('click', (e) => {
|
||||
if (e.target === this.overlay)
|
||||
this.close();
|
||||
});
|
||||
|
||||
// reveal the image only after it finished loading, so the spinner is visible meanwhile
|
||||
// Reveal the image only after it finished loading, so the spinner is visible meanwhile.
|
||||
const handleImageLoaded = () => {
|
||||
this.spinnerElement.style.display = 'none';
|
||||
this.imageElement.classList.add('loaded');
|
||||
@@ -164,5 +164,5 @@ class ImageViewerService {
|
||||
}
|
||||
}
|
||||
|
||||
// create a global instance of the ImageViewerService
|
||||
// Create a global instance of the ImageViewerService.
|
||||
const imageViewer = new ImageViewerService();
|
||||
@@ -51,7 +51,7 @@ class NotificationService {
|
||||
this.notifications.push(notification);
|
||||
this.displayNotification(notification);
|
||||
|
||||
// log the notification to the console
|
||||
// Log the notification to the console.
|
||||
const message = `${notification.type.charAt(0).toUpperCase() + notification.type.slice(1)}: ${notification.message}`;
|
||||
if (notification.type === 'info')
|
||||
console.info(message);
|
||||
@@ -62,7 +62,7 @@ class NotificationService {
|
||||
else
|
||||
console.log(message);
|
||||
|
||||
// set a timeout to remove the notification after 10 seconds (fading out effect is handled in notification.css)
|
||||
// Set a timeout to remove the notification after 10 seconds (fading out effect is handled in notification.css).
|
||||
setTimeout(() => this.removeNotification(notification.id), 10000);
|
||||
}
|
||||
|
||||
@@ -102,5 +102,5 @@ class NotificationService {
|
||||
}
|
||||
}
|
||||
|
||||
// create a global instance of the NotificationService
|
||||
// Create a global instance of the NotificationService.
|
||||
const notificationService = new NotificationService();
|
||||
@@ -6,7 +6,7 @@ const progressIndicatorValueShadow = document.getElementById('progress-indicator
|
||||
const progressIndicatorValueText = document.getElementById('progress-indicator-value-text');
|
||||
const audioPlayerExpandToggle = document.getElementById('audio-player-expand-toggle');
|
||||
|
||||
let enableConsoleDebugMessages = false; // whether to display debug messages at the developer console, or not
|
||||
let enableConsoleDebugMessages = false; // Whether to display debug messages at the developer console, or not.
|
||||
|
||||
var ajaxCallCounter = 0;
|
||||
|
||||
@@ -74,14 +74,14 @@ async function showHttpErrorAsync(response) {
|
||||
*/
|
||||
async function callApiGetAsync(url) {
|
||||
try {
|
||||
// call the API
|
||||
// Call the API.
|
||||
const response = await fetch(url, {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
});
|
||||
if (response.redirected) // if a redirect is requested, perform it
|
||||
if (response.redirected) // If a redirect is requested, perform it.
|
||||
window.location.href = response.url;
|
||||
else {
|
||||
if (!response.ok) {
|
||||
@@ -128,27 +128,27 @@ async function callApiPostAsync(url, data, options = {}) {
|
||||
};
|
||||
const finalOptions = { ...defaultOptions, ...options };
|
||||
try {
|
||||
// prepare headers
|
||||
// Prepare headers.
|
||||
const headers = {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
...finalOptions.headers
|
||||
};
|
||||
// add anti-forgery token if enabled
|
||||
// Add anti-forgery token if enabled.
|
||||
if (finalOptions.useAntiForgery) {
|
||||
const token = document.querySelector('input[name="__RequestVerificationToken"]')?.value;
|
||||
if (token)
|
||||
headers['RequestVerificationToken'] = token;
|
||||
}
|
||||
// make the request; when no data is provided, send an empty JSON object, because FastEndpoints parses the JSON body when
|
||||
// the content type is application/json, so an empty body would fail to deserialize
|
||||
// Make the request; when no data is provided, send an empty JSON object, because FastEndpoints parses the JSON body when
|
||||
// the content type is application/json, so an empty body would fail to deserialize.
|
||||
const response = await fetch(url, {
|
||||
method: 'POST',
|
||||
headers: headers,
|
||||
body: JSON.stringify(data ?? {})
|
||||
});
|
||||
if (response.redirected) // if a redirect is requested, perform it
|
||||
if (response.redirected) // If a redirect is requested, perform it.
|
||||
window.location.href = response.url;
|
||||
else {
|
||||
if (!response.ok) {
|
||||
@@ -196,27 +196,27 @@ async function callApiPutAsync(url, data, options = {}) {
|
||||
};
|
||||
const finalOptions = { ...defaultOptions, ...options };
|
||||
try {
|
||||
// prepare headers
|
||||
// Prepare headers.
|
||||
const headers = {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
...finalOptions.headers
|
||||
};
|
||||
// add anti-forgery token if enabled
|
||||
// Add anti-forgery token if enabled.
|
||||
if (finalOptions.useAntiForgery) {
|
||||
const token = document.querySelector('input[name="__RequestVerificationToken"]')?.value;
|
||||
if (token)
|
||||
headers['RequestVerificationToken'] = token;
|
||||
}
|
||||
// make the request; when no data is provided, send an empty JSON object, because FastEndpoints parses the JSON body when
|
||||
// the content type is application/json, so an empty body would fail to deserialize
|
||||
// Make the request; when no data is provided, send an empty JSON object, because FastEndpoints parses the JSON body when
|
||||
// the content type is application/json, so an empty body would fail to deserialize.
|
||||
const response = await fetch(url, {
|
||||
method: 'PUT',
|
||||
headers: headers,
|
||||
body: JSON.stringify(data ?? {})
|
||||
});
|
||||
if (response.redirected) // if a redirect is requested, perform it
|
||||
if (response.redirected) // If a redirect is requested, perform it.
|
||||
window.location.href = response.url;
|
||||
else {
|
||||
if (!response.ok) {
|
||||
@@ -264,26 +264,26 @@ async function callApiDeleteAsync(url, options = {}) {
|
||||
};
|
||||
const finalOptions = { ...defaultOptions, ...options };
|
||||
try {
|
||||
// prepare headers
|
||||
// Prepare headers.
|
||||
const headers = {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
...finalOptions.headers
|
||||
};
|
||||
// add anti-forgery token if enabled
|
||||
// Add anti-forgery token if enabled.
|
||||
if (finalOptions.useAntiForgery) {
|
||||
const token = document.querySelector('input[name="__RequestVerificationToken"]')?.value;
|
||||
if (token)
|
||||
headers['RequestVerificationToken'] = token;
|
||||
}
|
||||
// make the request
|
||||
// Make the request.
|
||||
const response = await fetch(url, {
|
||||
method: 'DELETE',
|
||||
headers: headers,
|
||||
body: '{}' // FastEndpoints parses the JSON body when the content type is application/json, so an empty body would fail to deserialize
|
||||
body: '{}' // FastEndpoints parses the JSON body when the content type is application/json, so an empty body would fail to deserialize.
|
||||
});
|
||||
if (response.redirected) // if a redirect is requested, perform it
|
||||
if (response.redirected) // If a redirect is requested, perform it.
|
||||
window.location.href = response.url;
|
||||
else {
|
||||
if (!response.ok) {
|
||||
@@ -324,21 +324,21 @@ async function callApiDeleteAsync(url, options = {}) {
|
||||
* and managing back/forward browser actions.
|
||||
*/
|
||||
function initializeNavigation() {
|
||||
// store initial state
|
||||
// Store initial state.
|
||||
const initialState = {
|
||||
url: window.location.href,
|
||||
content: document.querySelector('main').innerHTML,
|
||||
title: document.title
|
||||
};
|
||||
history.replaceState(initialState, document.title, window.location.href);
|
||||
// initial nav-link binding
|
||||
// Initial nav-link binding.
|
||||
bindNavigationLinks();
|
||||
|
||||
// handle browser back/forward
|
||||
// Handle browser back/forward.
|
||||
window.addEventListener('popstate', handlePopStateAsync);
|
||||
|
||||
// execute the view scripts of the initially loaded page, now that the application scripts are loaded; the view scripts are
|
||||
// stored with a non-executable type, so the browser does not run them before the application scripts are available
|
||||
// Execute the view scripts of the initially loaded page, now that the application scripts are loaded; the view scripts are
|
||||
// stored with a non-executable type, so the browser does not run them before the application scripts are available.
|
||||
showServerUnreachableNotificationIfNeeded();
|
||||
processViewScriptsAsync(document.querySelector('[data-section="scripts"]'));
|
||||
}
|
||||
@@ -366,7 +366,7 @@ function showServerUnreachableNotificationIfNeeded() {
|
||||
*/
|
||||
function bindNavigationLinks() {
|
||||
document.querySelectorAll('.nav-link').forEach(link => {
|
||||
// only bind if not already bound
|
||||
// Only bind if not already bound.
|
||||
if (!link.dataset.boundNavigation) {
|
||||
link.addEventListener('click', handleNavigationAsync);
|
||||
link.dataset.boundNavigation = 'true';
|
||||
@@ -393,12 +393,12 @@ async function handleNavigationAsync(e) {
|
||||
*/
|
||||
async function handlePopStateAsync(e) {
|
||||
if (e.state) {
|
||||
// if we have cached content in state, use it immediately
|
||||
// If we have cached content in state, use it immediately.
|
||||
if (e.state.content) {
|
||||
document.querySelector('main').innerHTML = e.state.content;
|
||||
document.title = e.state.title;
|
||||
}
|
||||
// still fetch fresh content to ensure it's up to date
|
||||
// Still fetch fresh content to ensure it's up to date.
|
||||
await updateContentAsync(e.state.url, false);
|
||||
}
|
||||
}
|
||||
@@ -415,41 +415,41 @@ async function processViewScriptsAsync(sourceContainer) {
|
||||
if (viewScripts.length === 0)
|
||||
return;
|
||||
|
||||
// get or create scripts container
|
||||
// Get or create scripts container.
|
||||
let scriptsContainer = document.querySelector('[data-section="scripts"]');
|
||||
if (!scriptsContainer) {
|
||||
scriptsContainer = document.createElement('div');
|
||||
scriptsContainer.setAttribute('data-section', 'scripts');
|
||||
document.body.appendChild(scriptsContainer);
|
||||
}
|
||||
// clear existing scripts in container
|
||||
// Clear existing scripts in container.
|
||||
scriptsContainer.innerHTML = '';
|
||||
|
||||
// process view scripts
|
||||
// Process view scripts.
|
||||
for (const script of viewScripts) {
|
||||
const scriptId = script.getAttribute('data-form');
|
||||
// remove existing script with same Id if it exists
|
||||
// Remove existing script with same Id if it exists.
|
||||
const existingScript = document.querySelector(`script[data-form="${scriptId}"]`);
|
||||
if (existingScript)
|
||||
existingScript.remove();
|
||||
|
||||
const newScript = document.createElement('script');
|
||||
// copy script attributes, except the type, which is overridden so that the stored non-executable scripts are executed
|
||||
// Copy script attributes, except the type, which is overridden so that the stored non-executable scripts are executed.
|
||||
Array.from(script.attributes).forEach(attr => {
|
||||
if (attr.name !== 'type')
|
||||
newScript.setAttribute(attr.name, attr.value);
|
||||
});
|
||||
|
||||
// handle both inline and external scripts
|
||||
// Handle both inline and external scripts.
|
||||
if (script.src) {
|
||||
newScript.src = script.src;
|
||||
// wait for external script to load
|
||||
// Wait for external script to load.
|
||||
await new Promise((resolve, reject) => {
|
||||
newScript.onload = resolve;
|
||||
newScript.onerror = reject;
|
||||
});
|
||||
} else {
|
||||
// wrap inline scripts in a safety check
|
||||
// Wrap inline scripts in a safety check.
|
||||
newScript.textContent = `
|
||||
(async function() {
|
||||
const safeGetElement = (id) => document.getElementById(id);
|
||||
@@ -458,13 +458,13 @@ async function processViewScriptsAsync(sourceContainer) {
|
||||
element.addEventListener(e, handler);
|
||||
};
|
||||
${script.textContent}
|
||||
// call Initialize function, if defined in this script's scope
|
||||
// Call Initialize function, if defined in this script's scope.
|
||||
if (typeof InitializeAsync === 'function')
|
||||
await InitializeAsync();
|
||||
})();
|
||||
`;
|
||||
}
|
||||
// add script to scripts container
|
||||
// Add script to scripts container.
|
||||
scriptsContainer.appendChild(newScript);
|
||||
}
|
||||
}
|
||||
@@ -476,13 +476,13 @@ async function processViewScriptsAsync(sourceContainer) {
|
||||
*/
|
||||
async function updateContentAsync(url, addToHistory) {
|
||||
try {
|
||||
// first, run cleanup of current view's scripts (unsubscribes handlers in the currently displayed razor views' script section, so it can be properly unloaded)
|
||||
// First, run cleanup of current view's scripts (unsubscribes handlers in the currently displayed razor views' script section, so it can be properly unloaded).
|
||||
if (window.viewCleanups) {
|
||||
Object.values(window.viewCleanups).forEach(cleanup => {
|
||||
if (typeof cleanup === 'function')
|
||||
cleanup();
|
||||
});
|
||||
// reset cleanups object
|
||||
// Reset cleanups object.
|
||||
window.viewCleanups = {};
|
||||
}
|
||||
|
||||
@@ -494,7 +494,7 @@ async function updateContentAsync(url, addToHistory) {
|
||||
'Accept': 'text/html'
|
||||
}
|
||||
});
|
||||
if (response.redirected) // if a redirect is requested, perform it
|
||||
if (response.redirected) // If a redirect is requested, perform it.
|
||||
window.location.href = response.url;
|
||||
else if (!response.ok) {
|
||||
// The server answered with an error page for the requested address. Keep the address the user asked for in the bar
|
||||
@@ -510,29 +510,29 @@ async function updateContentAsync(url, addToHistory) {
|
||||
else {
|
||||
const html = await response.text();
|
||||
|
||||
// parse the new content
|
||||
// Parse the new content.
|
||||
const parser = new DOMParser();
|
||||
const doc = parser.parseFromString(html, 'text/html');
|
||||
const content = doc.querySelector('main').innerHTML;
|
||||
const title = doc.querySelector('title')?.textContent || document.title;
|
||||
|
||||
// update the page content
|
||||
// Update the page content.
|
||||
document.querySelector('main').innerHTML = content;
|
||||
document.title = title;
|
||||
// The page scripts may start calling the API immediately, so the outage flag must be set before they run.
|
||||
showServerUnreachableNotificationIfNeeded();
|
||||
|
||||
// process all scripts in order: component scripts first, then view scripts
|
||||
// Process all scripts in order: component scripts first, then view scripts.
|
||||
const componentScripts = doc.querySelectorAll('script[data-component-script]');
|
||||
for (const script of componentScripts) {
|
||||
const newScript = document.createElement('script');
|
||||
// copy script attributes
|
||||
// Copy script attributes.
|
||||
Array.from(script.attributes).forEach(attr => {
|
||||
newScript.setAttribute(attr.name, attr.value);
|
||||
});
|
||||
|
||||
if (script.src) {
|
||||
// wait for external script to fully load before continuing
|
||||
// Wait for external script to fully load before continuing.
|
||||
await new Promise((resolve, reject) => {
|
||||
newScript.onload = resolve;
|
||||
newScript.onerror = reject;
|
||||
@@ -540,23 +540,23 @@ async function updateContentAsync(url, addToHistory) {
|
||||
});
|
||||
}
|
||||
}
|
||||
// execute component initialization scripts
|
||||
// Execute component initialization scripts.
|
||||
const componentInits = doc.querySelectorAll('script[data-component-init]');
|
||||
for (const script of componentInits) {
|
||||
const newScript = document.createElement('script');
|
||||
// copy script attributes
|
||||
// Copy script attributes.
|
||||
Array.from(script.attributes).forEach(attr => {
|
||||
newScript.setAttribute(attr.name, attr.value);
|
||||
});
|
||||
newScript.textContent = script.textContent;
|
||||
document.body.appendChild(newScript);
|
||||
}
|
||||
// process view scripts
|
||||
// Process view scripts.
|
||||
await processViewScriptsAsync(doc.querySelector('[data-section="scripts"]'));
|
||||
// bind navigation links in the new content
|
||||
// Bind navigation links in the new content.
|
||||
bindNavigationLinks();
|
||||
|
||||
// save to history if needed
|
||||
// Save to history if needed.
|
||||
if (addToHistory) {
|
||||
const state = { url, content, title };
|
||||
history.pushState(state, title, url);
|
||||
@@ -647,7 +647,7 @@ async function blobToBase64Async(blob) {
|
||||
* @returns {boolean} True if the file path ends with an image file extension, false otherwise.
|
||||
*/
|
||||
function isImageFile(filePath) {
|
||||
// Adjust the regex pattern to match the image file extensions you support
|
||||
// Adjust the regex pattern to match the image file extensions you support.
|
||||
return /\.(jpe?g|png|gif|bmp|svg|ico|webp)$/i.test(filePath);
|
||||
}
|
||||
|
||||
@@ -684,7 +684,7 @@ function hasScrollbars(element) {
|
||||
* @returns {number} Height of the scrollbar in pixels.
|
||||
*/
|
||||
function getScrollbarHeight() {
|
||||
// create an outer div and set its height and overflowY properties
|
||||
// Create an outer div and set its height and overflowY properties.
|
||||
const outer = document.createElement('div');
|
||||
outer.style.visibility = 'hidden';
|
||||
outer.style.height = '100px';
|
||||
@@ -692,7 +692,7 @@ function getScrollbarHeight() {
|
||||
document.body.appendChild(outer);
|
||||
const heightNoScroll = outer.offsetHeight;
|
||||
const heightWithScroll = outer.clientHeight;
|
||||
// cleanup after measuring
|
||||
// Cleanup after measuring.
|
||||
outer.parentNode.removeChild(outer);
|
||||
return heightNoScroll - heightWithScroll;
|
||||
}
|
||||
@@ -702,19 +702,19 @@ function getScrollbarHeight() {
|
||||
* @returns {number} Width of the scrollbar in pixels.
|
||||
*/
|
||||
function getScrollbarWidth() {
|
||||
// create an outer div and set its width
|
||||
// Create an outer div and set its width.
|
||||
const outer = document.createElement('div');
|
||||
outer.style.visibility = 'hidden';
|
||||
outer.style.width = '100px';
|
||||
document.body.appendChild(outer);
|
||||
const widthNoScroll = outer.offsetWidth;
|
||||
// apply overflow and append an inner div
|
||||
// Apply overflow and append an inner div.
|
||||
outer.style.overflow = 'scroll';
|
||||
const inner = document.createElement('div');
|
||||
inner.style.width = '100%';
|
||||
outer.appendChild(inner);
|
||||
const widthWithScroll = inner.offsetWidth;
|
||||
// cleanup and calculate the difference
|
||||
// Cleanup and calculate the difference.
|
||||
outer.parentNode.removeChild(outer);
|
||||
return widthNoScroll - widthWithScroll;
|
||||
}
|
||||
@@ -824,15 +824,15 @@ document.addEventListener('click', function (e) {
|
||||
var value = e.target.getAttribute('data-value');
|
||||
var combobox = e.target.closest('.enlightenment-combobox');
|
||||
|
||||
// update the displayed text
|
||||
// Update the displayed text.
|
||||
var selectedText = combobox.querySelector('.enlightenment-selected-text');
|
||||
if (selectedText) {
|
||||
selectedText.textContent = text;
|
||||
// update the data-value attribute with the actual value
|
||||
// Update the data-value attribute with the actual value.
|
||||
selectedText.setAttribute('data-value', value);
|
||||
}
|
||||
|
||||
// close the dropdown
|
||||
// Close the dropdown.
|
||||
var toggleCheckbox = combobox.querySelector('.enlightenment-toggle-checkbox');
|
||||
if (toggleCheckbox)
|
||||
toggleCheckbox.checked = false;
|
||||
@@ -843,18 +843,18 @@ document.addEventListener('click', function (e) {
|
||||
* Global click event for the entire document. Closes all combobox dropdowns if the clicked target is outside any combobox.
|
||||
*/
|
||||
document.addEventListener('click', function (e) {
|
||||
// enlightenment combobox logic
|
||||
// Enlightenment combobox logic.
|
||||
if (!e.target.closest('.enlightenment-combobox')) {
|
||||
const checkbox = document.querySelector('.enlightenment-toggle-checkbox:checked');
|
||||
if (checkbox)
|
||||
checkbox.checked = false;
|
||||
}
|
||||
// navigator combobox logic
|
||||
// Navigator combobox logic.
|
||||
if (!e.target.closest('.navigator-combobox') && typeof addressBar !== 'undefined' && addressBar !== null) {
|
||||
const checkbox = document.querySelector('.navigator-toggle-checkbox:checked');
|
||||
if (checkbox)
|
||||
checkbox.checked = false;
|
||||
// when drop down closes, hide address bar overflow
|
||||
// When drop down closes, hide address bar overflow.
|
||||
addressBar.style.overflowX = 'auto';
|
||||
addressBar.style.overflowY = 'hidden';
|
||||
reattachDropdown();
|
||||
@@ -866,7 +866,7 @@ document.addEventListener('click', function (e) {
|
||||
*/
|
||||
document.addEventListener("click", function (e) {
|
||||
if (e.target.matches('.navigator-option')) {
|
||||
// the address bar drop downs may be destroyed when an option is clicked - they are regenerated each time anyway
|
||||
// The address bar drop downs may be destroyed when an option is clicked - they are regenerated each time anyway.
|
||||
addressBar.removeEventListener('scroll', adjustDropdownPosition);
|
||||
|
||||
var parentElement = e.target.parentElement;
|
||||
|
||||
@@ -55,10 +55,10 @@
|
||||
function readMember(target, name) {
|
||||
if (target === null || target === undefined || typeof target !== 'object')
|
||||
return undefined;
|
||||
// expose the collection count under the same 'Count' member as the server side engine
|
||||
// Expose the collection count under the same 'Count' member as the server side engine.
|
||||
if (name.toLowerCase() === 'count' && Array.isArray(target))
|
||||
return target.length;
|
||||
// match member names case-insensitively, only against the own enumerable properties, so prototype members cannot be reached
|
||||
// Match member names case-insensitively, only against the own enumerable properties, so prototype members cannot be reached.
|
||||
for (const key of Object.keys(target))
|
||||
if (key.toLowerCase() === name.toLowerCase())
|
||||
return target[key];
|
||||
@@ -180,7 +180,7 @@
|
||||
return scope.value;
|
||||
if (explicitParentCount > 0)
|
||||
return resolvePath(scope.value, expression);
|
||||
// resolve against the scope chain, so that a section scope can fall back to its parent values
|
||||
// Resolve against the scope chain, so that a section scope can fall back to its parent values.
|
||||
for (let candidate = scope; candidate !== null; candidate = candidate.parent) {
|
||||
const resolved = resolvePath(candidate.value, expression);
|
||||
if (resolved !== undefined)
|
||||
@@ -207,7 +207,7 @@
|
||||
output += node.shouldEscape ? escapeHtml(value) : value;
|
||||
continue;
|
||||
}
|
||||
// sections are rendered when their expression is truthy, iterated when it is an array, and skipped otherwise
|
||||
// Sections are rendered when their expression is truthy, iterated when it is an array, and skipped otherwise.
|
||||
const value = resolveExpression(node.expression, scope);
|
||||
const truthy = isTruthy(value);
|
||||
if (node.inverted) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# this file is required because the default base output path for the projects has been changed, and we need to tell docker compose where to take the files from, in debug mode
|
||||
# this file is the last in the chain of files when docker-compose commands are called, so it always takes precedence
|
||||
# This file is required because the default base output path for the projects has been changed, and we need to tell docker compose where to take the files from, in debug mode.
|
||||
# This file is the last in the chain of files when docker-compose commands are called, so it always takes precedence.
|
||||
services:
|
||||
lumina-api:
|
||||
labels:
|
||||
|
||||
@@ -81,7 +81,7 @@ services:
|
||||
container_name: grafana
|
||||
image: grafana/grafana:13.0.7-ubuntu-slim
|
||||
environment:
|
||||
# dev-only stack: set a non-default admin password (override GRAFANA_ADMIN_PASSWORD in real deployments)
|
||||
# Dev-only stack: set a non-default admin password (override GRAFANA_ADMIN_PASSWORD in real deployments).
|
||||
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD:-lumina-admin}
|
||||
volumes:
|
||||
- ./grafana/provisioning:/etc/grafana/provisioning:ro
|
||||
|
||||
Reference in new issue
Block a user