mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-06-11 22:43:04 +00:00
116 lines
4.2 KiB
HTML
116 lines
4.2 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<!--
|
|
If you are serving your web app in a path other than the root, change the
|
|
href value below to reflect the base path you are serving from.
|
|
|
|
The path provided below has to start and end with a slash "/" in order for
|
|
it to work correctly.
|
|
|
|
For more details:
|
|
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
|
|
|
|
This is a placeholder for base href that will be replaced by the value of
|
|
the `--base-href` argument provided to `flutter build`.
|
|
-->
|
|
<base href="/web/flutter_web/">
|
|
|
|
<meta charset="UTF-8">
|
|
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
|
|
<meta name="description" content="Snapmaker Orca">
|
|
<!-- 添加权限策略 -->
|
|
<meta http-equiv="Permissions-Policy" content="local-files-write=*">
|
|
<meta http-equiv="Access-Control-Allow-Origin" content="*">
|
|
<meta http-equiv="Access-Control-Allow-Methods" content="GET, POST, PUT, DELETE, OPTIONS">
|
|
<meta http-equiv="Access-Control-Allow-Headers" content="Content-Type, Authorization, x-amz-checksum-sha256">
|
|
<!-- iOS meta tags & icons -->
|
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
|
<meta name="apple-mobile-web-app-title" content="web">
|
|
<link rel="apple-touch-icon" href="icons/Icon-192.png">
|
|
|
|
<!-- Favicon -->
|
|
<link rel="icon" type="image/png" href="favicon.png"/>
|
|
|
|
<title>Snapmaker Orca</title>
|
|
<link rel="manifest" href="manifest.json">
|
|
|
|
|
|
<!-- 针对 macOS 的优化 -->
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
|
<!-- 在head中添加 -->
|
|
<meta name="theme-color" content="#ffffff">
|
|
<link rel="apple-touch-startup-image" href="splash.png">
|
|
</head>
|
|
<body>
|
|
<script>
|
|
(async function bootstrapDesktopFlutter() {
|
|
if ('serviceWorker' in navigator) {
|
|
try {
|
|
const registrations = await navigator.serviceWorker.getRegistrations();
|
|
await Promise.allSettled(registrations.map((registration) => registration.unregister()));
|
|
} catch (error) {
|
|
console.warn('Failed to unregister service workers:', error);
|
|
}
|
|
}
|
|
|
|
if ('caches' in window) {
|
|
try {
|
|
const cacheNames = await caches.keys();
|
|
const flutterCaches = cacheNames.filter((name) => name.startsWith('flutter-'));
|
|
await Promise.allSettled(flutterCaches.map((name) => caches.delete(name)));
|
|
} catch (error) {
|
|
console.warn('Failed to clear Flutter caches:', error);
|
|
}
|
|
}
|
|
|
|
const bootstrapScript = document.createElement('script');
|
|
bootstrapScript.src = 'flutter_bootstrap.js';
|
|
bootstrapScript.async = true;
|
|
document.body.appendChild(bootstrapScript);
|
|
})();
|
|
</script>
|
|
|
|
<script>
|
|
if ('application/octet-stream' in MimeType) {
|
|
MimeType['image/webp'] = 'webp';
|
|
}
|
|
</script>
|
|
<script>
|
|
|
|
function open_orca_webview() {
|
|
const message = JSON.stringify({
|
|
seqid: 1222222,
|
|
cmd: "sw_OpenOrcaWebview",
|
|
params: {
|
|
url: "http://127.0.0.1:7357/?locale=zh-cn-CN&dark_model=1&path=/",
|
|
},
|
|
});
|
|
// 调用 window.postMessage 传递消息给 flutter
|
|
window.wx && window.wx.postMessage(message); // 调用 window.postMessage 传递消息给 原生系统
|
|
///模拟收到响应结果5000
|
|
if(!window.wx) {
|
|
// 我不能发现 window.wx
|
|
console.log('i dont find window.wx, so i simulate a return by postMessage, message: ', message)
|
|
}
|
|
}
|
|
|
|
// 发送消息
|
|
window.sendMessage = function (message) {
|
|
//console.log("I am proxy in html to send message to container: " + message);
|
|
|
|
// 调用 window.postMessage 传递消息给 flutter
|
|
window.wx && window.wx.postMessage(message); // 调用 window.postMessage 传递消息给 原生系统
|
|
///模拟收到响应结果5000
|
|
if(!window.wx) {
|
|
// 我不能发现 window.wx
|
|
console.log('i dont find window.wx, so i simulate a return by postMessage')
|
|
}
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|