Skip to content

Commit b075b97

Browse files
committed
Use browser generation for local static previews
1 parent 47e5ce5 commit b075b97

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

public/app.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,9 +544,19 @@ function assetUrl(value) {
544544
function shouldUseBrowserGenerator() {
545545
return window.GITGREEN_FORCE_BROWSER_GENERATOR === true
546546
|| new URLSearchParams(window.location.search).has("static")
547+
|| isLocalStaticPreviewHost()
547548
|| isStaticPagesHost();
548549
}
549550

551+
function isLocalStaticPreviewHost() {
552+
if (API_BASE_URL) {
553+
return false;
554+
}
555+
556+
const localHosts = ["127.0.0.1", "localhost", "::1"];
557+
return localHosts.includes(window.location.hostname) && window.location.port !== "4173";
558+
}
559+
550560
function isStaticPagesHost() {
551561
if (API_BASE_URL) {
552562
return false;

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,6 @@ <h2 data-i18n="posterSettings">海报设置</h2>
257257
</aside>
258258
</div>
259259

260-
<script src="/app.js?v=20260605-real-qr" type="module"></script>
260+
<script src="/app.js?v=20260605-local-static-fix" type="module"></script>
261261
</body>
262262
</html>

0 commit comments

Comments
 (0)