mirror of
https://github.com/rommapp/romm.git
synced 2026-06-27 22:35:57 +00:00
Merge pull request #3373 from rommapp/copilot/feature-disable-console-button
Apply `DISABLE_EMULATOR_JS` to Console mode (disable Play + block direct player route)
This commit is contained in:
@@ -64,6 +64,9 @@ const descriptionOverlayRef = useTemplateRef<HTMLDivElement>(
|
||||
"description-overlay-ref",
|
||||
);
|
||||
const detailsOverlayRef = useTemplateRef<HTMLDivElement>("details-overlay-ref");
|
||||
const isConsoleEmulationDisabled = computed(
|
||||
() => heartbeatStore.value.EMULATION.DISABLE_EMULATOR_JS,
|
||||
);
|
||||
|
||||
const releaseDate = computed(() => {
|
||||
if (!rom.value?.metadatum.first_release_date) return null;
|
||||
@@ -351,7 +354,7 @@ function handleAction(action: InputAction): boolean {
|
||||
}
|
||||
|
||||
async function play() {
|
||||
if (!rom.value) return;
|
||||
if (!rom.value || isConsoleEmulationDisabled.value) return;
|
||||
|
||||
romApi
|
||||
.updateUserRomProps({
|
||||
@@ -633,7 +636,10 @@ onUnmounted(() => {
|
||||
:class="{
|
||||
'scale-105 shadow-[0_8px_28px_rgba(0,0,0,0.35),_0_0_0_2px_var(--console-game-play-button-focus-border),_0_0_16px_var(--console-accent-secondary)]':
|
||||
selectedZone === 'play',
|
||||
'opacity-60 cursor-not-allowed':
|
||||
isConsoleEmulationDisabled,
|
||||
}"
|
||||
:disabled="isConsoleEmulationDisabled"
|
||||
@click="play()"
|
||||
>
|
||||
<span class="text-lg md:text-xl">▶</span>
|
||||
|
||||
@@ -26,6 +26,7 @@ import playSessionApi from "@/services/api/play-session";
|
||||
import romApi from "@/services/api/rom";
|
||||
import storeAuth from "@/stores/auth";
|
||||
import storeConfig from "@/stores/config";
|
||||
import storeHeartbeat from "@/stores/heartbeat";
|
||||
import storeLanguage from "@/stores/language";
|
||||
import type { DetailedRom } from "@/stores/roms";
|
||||
import {
|
||||
@@ -59,6 +60,7 @@ const router = useRouter();
|
||||
const { getBezelImagePath } = useThemeAssets();
|
||||
const authStore = storeAuth();
|
||||
const configStore = storeConfig();
|
||||
const heartbeatStore = storeHeartbeat();
|
||||
const languageStore = storeLanguage();
|
||||
const { selectedLanguage } = storeToRefs(languageStore);
|
||||
const romId = Number(route.params.rom);
|
||||
@@ -727,6 +729,15 @@ onMounted(async () => {
|
||||
// Guard against duplicate mounts
|
||||
if (booted) return;
|
||||
|
||||
if (heartbeatStore.value.EMULATION.DISABLE_EMULATOR_JS) {
|
||||
await router.replace({
|
||||
name: ROUTES.CONSOLE_ROM,
|
||||
params: { rom: romId },
|
||||
query: route.query,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
booted = true;
|
||||
await boot();
|
||||
detachKey = attachKeyboardExit();
|
||||
|
||||
Reference in New Issue
Block a user