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
|
||||
// supporters.json served on the same origin instead.
|
||||
let patrons = Task::perform(
|
||||
crate::patreon::fetch_patrons_web(),
|
||||
Message::PatronsFetched,
|
||||
);
|
||||
s.videos_loading = true;
|
||||
let videos = Task::perform(
|
||||
crate::videos::fetch_playlist_web(),
|
||||
Message::VideosFetched,
|
||||
);
|
||||
s.discussions_loading = true;
|
||||
let discussions = Task::perform(
|
||||
crate::discussions::fetch_discussions_web(),
|
||||
Message::DiscussionsFetched,
|
||||
);
|
||||
//
|
||||
// CMMS embedding (not upstream): none of this Start-page decoration
|
||||
// (supporters list, tutorial videos, GitHub Discussions) is ever
|
||||
// shown when launched from edit.php - the embedded editor always
|
||||
// opens straight into a file, never the Start tab - and CMMS's own
|
||||
// vendored build never carries opencadstudio.com's supporters.json /
|
||||
// video_thumbs/*.jpg / discussions payloads (they're fetched from
|
||||
// pages.dev-style static hosting upstream, not part of `trunk
|
||||
// build`'s output), so every one of these requests 404s from a CMMS
|
||||
// deployment. Skipped entirely rather than left to fail silently.
|
||||
let embedded = crate::sys::cmms_config().is_some();
|
||||
let patrons = if embedded {
|
||||
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();
|
||||
|
||||
// CMMS embedding (not upstream): if launched from cad-edit.php to
|
||||
|
|
|
|||
Loading…
Reference in a new issue