Skip Start-page decoration fetches (patrons/videos/discussions) when embedded in CMMS
Every one of those requests 404s from a CMMS deployment - the embedded editor's build never carries opencadstudio.com's supporters.json / video_thumbs/*.jpg / discussions payloads (fetched from pages.dev-style static hosting upstream, not part of trunk build's output), and the Start page they'd populate is never shown anyway (embedded launches go straight into a file). Gated on the existing window.CAD_EDITOR_CONFIG check; standalone/opencadstudio.com use is unaffected.
This commit is contained in:
parent
201b177429
commit
0d654a8a79
1 changed files with 37 additions and 14 deletions
|
|
@ -3676,20 +3676,43 @@ impl OpenCADStudio {
|
||||||
]);
|
]);
|
||||||
// Web can't reach the Patreon API directly (CORS); fetch the CI-built
|
// Web can't reach the Patreon API directly (CORS); fetch the CI-built
|
||||||
// supporters.json served on the same origin instead.
|
// supporters.json served on the same origin instead.
|
||||||
let patrons = Task::perform(
|
//
|
||||||
crate::patreon::fetch_patrons_web(),
|
// CMMS embedding (not upstream): none of this Start-page decoration
|
||||||
Message::PatronsFetched,
|
// (supporters list, tutorial videos, GitHub Discussions) is ever
|
||||||
);
|
// shown when launched from edit.php - the embedded editor always
|
||||||
s.videos_loading = true;
|
// opens straight into a file, never the Start tab - and CMMS's own
|
||||||
let videos = Task::perform(
|
// vendored build never carries opencadstudio.com's supporters.json /
|
||||||
crate::videos::fetch_playlist_web(),
|
// video_thumbs/*.jpg / discussions payloads (they're fetched from
|
||||||
Message::VideosFetched,
|
// pages.dev-style static hosting upstream, not part of `trunk
|
||||||
);
|
// build`'s output), so every one of these requests 404s from a CMMS
|
||||||
s.discussions_loading = true;
|
// deployment. Skipped entirely rather than left to fail silently.
|
||||||
let discussions = Task::perform(
|
let embedded = crate::sys::cmms_config().is_some();
|
||||||
crate::discussions::fetch_discussions_web(),
|
let patrons = if embedded {
|
||||||
Message::DiscussionsFetched,
|
Task::none()
|
||||||
);
|
} else {
|
||||||
|
Task::perform(
|
||||||
|
crate::patreon::fetch_patrons_web(),
|
||||||
|
Message::PatronsFetched,
|
||||||
|
)
|
||||||
|
};
|
||||||
|
let videos = if embedded {
|
||||||
|
Task::none()
|
||||||
|
} else {
|
||||||
|
s.videos_loading = true;
|
||||||
|
Task::perform(
|
||||||
|
crate::videos::fetch_playlist_web(),
|
||||||
|
Message::VideosFetched,
|
||||||
|
)
|
||||||
|
};
|
||||||
|
let discussions = if embedded {
|
||||||
|
Task::none()
|
||||||
|
} else {
|
||||||
|
s.discussions_loading = true;
|
||||||
|
Task::perform(
|
||||||
|
crate::discussions::fetch_discussions_web(),
|
||||||
|
Message::DiscussionsFetched,
|
||||||
|
)
|
||||||
|
};
|
||||||
let thumbs_fetch = s.refresh_recent_thumbs();
|
let thumbs_fetch = s.refresh_recent_thumbs();
|
||||||
|
|
||||||
// CMMS embedding (not upstream): if launched from cad-edit.php to
|
// CMMS embedding (not upstream): if launched from cad-edit.php to
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue