Promote authenticated BIM share viewers
This commit is contained in:
parent
f680d6bad2
commit
09492a5fdc
|
|
@ -4,7 +4,7 @@ const SDK_URL = "./lib/dc-camera-context.es.js?v=3";
|
|||
import { createLogo } from "./src/ui/logo.js";
|
||||
import { applyToolbarVars } from "./src/ui/toolbar.js?v=3";
|
||||
import { createTemplatesMenu } from "./src/ui/templatesMenu.js?v=3";
|
||||
import { createSettingsMenu } from "./src/ui/settingsMenu.js?v=14";
|
||||
import { createSettingsMenu } from "./src/ui/settingsMenu.js?v=15";
|
||||
import { createMeasurementModal } from "./src/ui/measurementModal.js";
|
||||
import { createGlassSelect } from "./src/ui/glassSelect.js";
|
||||
import { createColorControl } from "./src/ui/controls/color.js";
|
||||
|
|
@ -1774,6 +1774,14 @@ const initializeRuntimeMode = async () => {
|
|||
console.warn("BIM session status unavailable", err);
|
||||
}
|
||||
|
||||
if (shareToken) {
|
||||
const authenticatedShare = runtimeSessionInfo.authenticated === true ||
|
||||
startupSharePayload?.authenticated === true ||
|
||||
startupSharePayload?.mode === "standard" ||
|
||||
startupSharePayload?.readonly === false;
|
||||
viewerMode = authenticatedShare ? "standard" : "guest";
|
||||
}
|
||||
|
||||
applyRuntimeMode();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -651,6 +651,6 @@
|
|||
<input id="fileInput" class="hidden" type="file"
|
||||
accept=".xkt,.glb,.gltf,.bim,.las,.laz,.obj,.stl">
|
||||
|
||||
<script type="module" src="/dcViewer.js?v=55"></script>
|
||||
<script type="module" src="/dcViewer.js?v=56"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -76,10 +76,13 @@ const isSharedViewerPath = () => (
|
|||
typeof window !== "undefined" &&
|
||||
/^\/share\/[^/]+\/?$/.test(window.location.pathname || "")
|
||||
);
|
||||
const isReadonlySettingsContext = () => (
|
||||
isSharedViewerPath() ||
|
||||
(typeof document !== "undefined" && document.body?.dataset?.viewerMode === "guest")
|
||||
);
|
||||
const isReadonlySettingsContext = () => {
|
||||
if (typeof document !== "undefined") {
|
||||
const mode = document.body?.dataset?.viewerMode;
|
||||
if (mode) return mode === "guest";
|
||||
}
|
||||
return isSharedViewerPath();
|
||||
};
|
||||
const projectSettings = typeof window !== "undefined" && window.__BIMDC_THEME__
|
||||
? { ...defaultSettings, ...window.__BIMDC_THEME__ }
|
||||
: { ...defaultSettings };
|
||||
|
|
|
|||
|
|
@ -1531,10 +1531,15 @@ const handleGetShare = async (req, res, token) => {
|
|||
sendText(res, 404, "Share not found");
|
||||
return;
|
||||
}
|
||||
const session = getCurrentBimSession(req);
|
||||
const authenticated = !!session;
|
||||
sendJSON(res, 200, {
|
||||
ok: true,
|
||||
mode: "guest",
|
||||
readonly: true,
|
||||
mode: authenticated ? "standard" : "guest",
|
||||
readonly: !authenticated,
|
||||
authenticated,
|
||||
canShare: !BIM_AUTH_REQUIRED || authenticated,
|
||||
user: session?.user || null,
|
||||
viewer: {
|
||||
src: publicUrlForUploadSrc(req, share.src),
|
||||
settingsSrc: publicUrlForUploadSrc(req, share.settingsSrc || share.src),
|
||||
|
|
|
|||
Loading…
Reference in New Issue