Add camera settings and Vercel deployment
This commit is contained in:
1 parent
62a529ef3f
commit
4108cd04b3
5 files changed
+57
No files matched your search
@@ -0,0 +1,9 @@
|
||||
.git
|
||||
.github
|
||||
.vercel
|
||||
node_modules
|
||||
dist
|
||||
tools
|
||||
.env*
|
||||
config.local.*
|
||||
*.log
|
||||
+11
@@ -671,6 +671,17 @@
|
||||
<div class="card" id="card-persistent-global">
|
||||
<div class="card-title" data-i18n="persistentGlobalTitle">⚙️ สวิตช์ระบบพิเศษของ GaC</div>
|
||||
<div style="display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem;">
|
||||
<div class="ex-switch-card">
|
||||
<div>
|
||||
<div style="font-weight: 700;">Freecam / FaceCam</div>
|
||||
<div style="font-size: 0.8rem; color: var(--text-muted);">เลือกโหมด แล้วกด Tab ในเกมเพื่อเปิดหรือปิดกล้อง</div>
|
||||
<label for="camera-mode">โหมดกล้อง</label>
|
||||
<select id="camera-mode"><option value="freecam">Freecam</option><option value="facecam">FaceCam (ทดลอง)</option></select>
|
||||
<label for="camera-distance">ระยะ FaceCam</label>
|
||||
<input id="camera-distance" type="number" min="0.5" max="5" step="0.1" value="2">
|
||||
<button type="button" class="btn btn-success" id="btn-save-camera">บันทึกกล้อง</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ex-switch-card">
|
||||
<div>
|
||||
<div style="font-weight: 700;" data-i18n="globalFeatureSilverWolf">Silver Wolf Global Feature</div>
|
||||
|
||||
@@ -7614,6 +7614,11 @@ async function loadPersistentSettings() {
|
||||
}
|
||||
if (!data) return;
|
||||
|
||||
const cameraMode = document.getElementById('camera-mode');
|
||||
const cameraDistance = document.getElementById('camera-distance');
|
||||
if (cameraMode) cameraMode.value = data.camera_settings?.mode || 'freecam';
|
||||
if (cameraDistance) cameraDistance.value = data.camera_settings?.distance ?? 2;
|
||||
|
||||
if (data.main_character && el.persistentMcSelect) {
|
||||
el.persistentMcSelect.value = data.main_character;
|
||||
}
|
||||
@@ -8422,6 +8427,21 @@ function setupEvents() {
|
||||
});
|
||||
|
||||
// Persistent Toggles
|
||||
document.getElementById('btn-save-camera')?.addEventListener('click', async () => {
|
||||
const button = document.getElementById('btn-save-camera');
|
||||
const mode = document.getElementById('camera-mode').value;
|
||||
const distance = Number(document.getElementById('camera-distance').value);
|
||||
if (!Number.isFinite(distance) || distance < 0.5 || distance > 5) {
|
||||
showToast('ระยะ FaceCam ต้องอยู่ระหว่าง 0.5 ถึง 5', 'error'); return;
|
||||
}
|
||||
button.disabled = true;
|
||||
try {
|
||||
const saved = await apiCall('/api/camera', 'POST', { mode, distance });
|
||||
if (state.persistentData) state.persistentData.camera_settings = saved;
|
||||
showToast('บันทึกกล้องแล้ว', 'success');
|
||||
} catch (err) { showToast(err.message, 'error'); }
|
||||
finally { button.disabled = false; }
|
||||
});
|
||||
document.getElementById('btn-save-aha-help')?.addEventListener('click', async () => {
|
||||
const select = document.getElementById('aha-help-level');
|
||||
const button = document.getElementById('btn-save-aha-help');
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// Only the static web application is published; repository tools and local
|
||||
// configuration are not copied to the public deployment.
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const root = path.resolve(__dirname, '..');
|
||||
const output = path.join(root, 'dist');
|
||||
fs.mkdirSync(output, { recursive: true });
|
||||
for (const name of ['index.html', 'version.json', 'assets', 'css', 'js']) {
|
||||
const source = path.join(root, name);
|
||||
if (!fs.existsSync(source)) throw new Error(`Missing static application input: ${name}`);
|
||||
fs.cpSync(source, path.join(output, name), { recursive: true, force: true });
|
||||
}
|
||||
console.log('Static application prepared for Vercel.');
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"buildCommand": "node scripts/build-vercel.cjs",
|
||||
"outputDirectory": "dist"
|
||||
}
|
||||
Reference in new issue
Block a user