always display reconnect button on mcraft.fun
This commit is contained in:
parent
d112b01177
commit
fcf987efe4
11 changed files with 52 additions and 5 deletions
2
.github/workflows/build-single-file.yml
vendored
2
.github/workflows/build-single-file.yml
vendored
|
|
@ -23,6 +23,8 @@ jobs:
|
|||
|
||||
- name: Build single-file version - minecraft.html
|
||||
run: pnpm build-single-file && mv dist/single/index.html minecraft.html
|
||||
env:
|
||||
LOCAL_CONFIG_FILE: config.mcraft-only.json
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
|
|
|
|||
2
.github/workflows/build-zip.yml
vendored
2
.github/workflows/build-zip.yml
vendored
|
|
@ -23,6 +23,8 @@ jobs:
|
|||
|
||||
- name: Build project
|
||||
run: pnpm build
|
||||
env:
|
||||
LOCAL_CONFIG_FILE: config.mcraft-only.json
|
||||
|
||||
- name: Bundle server.js
|
||||
run: |
|
||||
|
|
|
|||
1
.github/workflows/next-deploy.yml
vendored
1
.github/workflows/next-deploy.yml
vendored
|
|
@ -36,6 +36,7 @@ jobs:
|
|||
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
|
||||
env:
|
||||
CONFIG_JSON_SOURCE: BUNDLED
|
||||
LOCAL_CONFIG_FILE: config.mcraft-only.json
|
||||
- name: Copy playground files
|
||||
run: |
|
||||
mkdir -p .vercel/output/static/playground
|
||||
|
|
|
|||
1
.github/workflows/preview.yml
vendored
1
.github/workflows/preview.yml
vendored
|
|
@ -78,6 +78,7 @@ jobs:
|
|||
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
|
||||
env:
|
||||
CONFIG_JSON_SOURCE: BUNDLED
|
||||
LOCAL_CONFIG_FILE: config.mcraft-only.json
|
||||
- name: Copy playground files
|
||||
run: |
|
||||
mkdir -p .vercel/output/static/playground
|
||||
|
|
|
|||
1
.github/workflows/release.yml
vendored
1
.github/workflows/release.yml
vendored
|
|
@ -34,6 +34,7 @@ jobs:
|
|||
- run: vercel build --token=${{ secrets.VERCEL_TOKEN }} --prod
|
||||
env:
|
||||
CONFIG_JSON_SOURCE: BUNDLED
|
||||
LOCAL_CONFIG_FILE: config.mcraft-only.json
|
||||
- name: Copy playground files
|
||||
run: |
|
||||
mkdir -p .vercel/output/static/playground
|
||||
|
|
|
|||
3
config.mcraft-only.json
Normal file
3
config.mcraft-only.json
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"alwaysReconnectButton": true
|
||||
}
|
||||
|
|
@ -39,7 +39,9 @@ export class ThreeJsSound implements SoundSystem {
|
|||
sound.position.set(position.x, position.y, position.z)
|
||||
sound.onEnded = () => {
|
||||
this.worldRenderer.scene.remove(sound)
|
||||
sound.disconnect()
|
||||
if (sound.source) {
|
||||
sound.disconnect()
|
||||
}
|
||||
this.activeSounds.delete(sound)
|
||||
audioLoader.manager.itemEnd(path)
|
||||
}
|
||||
|
|
@ -51,7 +53,9 @@ export class ThreeJsSound implements SoundSystem {
|
|||
// Stop and clean up all active sounds
|
||||
for (const sound of this.activeSounds) {
|
||||
sound.stop()
|
||||
sound.disconnect()
|
||||
if (sound.source) {
|
||||
sound.disconnect()
|
||||
}
|
||||
}
|
||||
|
||||
// Remove and cleanup audio listener
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/// <reference types="./src/env" />
|
||||
import { defineConfig, mergeRsbuildConfig, RsbuildPluginAPI } from '@rsbuild/core'
|
||||
import { pluginReact } from '@rsbuild/plugin-react'
|
||||
import { pluginTypedCSSModules } from '@rsbuild/plugin-typed-css-modules'
|
||||
|
|
@ -48,7 +49,7 @@ if (fs.existsSync('./assets/release.json')) {
|
|||
|
||||
const configJson = JSON.parse(fs.readFileSync('./config.json', 'utf8'))
|
||||
try {
|
||||
Object.assign(configJson, JSON.parse(fs.readFileSync('./config.local.json', 'utf8')))
|
||||
Object.assign(configJson, JSON.parse(fs.readFileSync(process.env.LOCAL_CONFIG_FILE || './config.local.json', 'utf8')))
|
||||
} catch (err) {}
|
||||
if (dev) {
|
||||
configJson.defaultProxy = ':8080'
|
||||
|
|
@ -198,7 +199,7 @@ const appConfig = defineConfig({
|
|||
}
|
||||
|
||||
if (configSource === 'REMOTE') {
|
||||
fs.writeFileSync('./dist/config.json', JSON.stringify(configJson), 'utf8')
|
||||
fs.writeFileSync('./dist/config.json', JSON.stringify(configJson, undefined, 2), 'utf8')
|
||||
}
|
||||
if (fs.existsSync('./generated/sounds.js')) {
|
||||
fs.copyFileSync('./generated/sounds.js', './dist/sounds.js')
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ export type AppConfig = {
|
|||
showModsButton?: boolean
|
||||
defaultUsername?: string
|
||||
skinTexturesProxy?: string
|
||||
alwaysReconnectButton?: boolean
|
||||
}
|
||||
|
||||
export const loadAppConfig = (appConfig: AppConfig) => {
|
||||
|
|
|
|||
30
src/env.d.ts
vendored
Normal file
30
src/env.d.ts
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
declare namespace NodeJS {
|
||||
interface ProcessEnv {
|
||||
// Build configuration
|
||||
NODE_ENV: 'development' | 'production'
|
||||
SINGLE_FILE_BUILD?: string
|
||||
DISABLE_SERVICE_WORKER?: string
|
||||
CONFIG_JSON_SOURCE?: 'BUNDLED' | 'REMOTE'
|
||||
LOCAL_CONFIG_FILE?: string
|
||||
BUILD_VERSION?: string
|
||||
|
||||
// GitHub and Vercel related
|
||||
GITHUB_REPOSITORY?: string
|
||||
VERCEL_GIT_REPO_OWNER?: string
|
||||
VERCEL_GIT_REPO_SLUG?: string
|
||||
|
||||
// UI and Features
|
||||
MAIN_MENU_LINKS?: string
|
||||
ENABLE_COOKIE_STORAGE?: string
|
||||
COOKIE_STORAGE_PREFIX?: string
|
||||
|
||||
// Release information
|
||||
RELEASE_TAG?: string
|
||||
RELEASE_LINK?: string
|
||||
RELEASE_CHANGELOG?: string
|
||||
|
||||
// Other configurations
|
||||
DEPS_VERSIONS?: string
|
||||
INLINED_APP_CONFIG?: string
|
||||
}
|
||||
}
|
||||
|
|
@ -163,6 +163,7 @@ export default () => {
|
|||
const { noConnection } = useSnapshot(gameAdditionalState)
|
||||
const { active: packetsReplaceActive, hasRecordedPackets: packetsReplaceHasRecordedPackets } = useSnapshot(packetsRecordingState)
|
||||
const { displayRecordButton: displayPacketsButtons } = useSnapshot(options)
|
||||
const { appConfig } = useSnapshot(miscUiState)
|
||||
|
||||
const handlePointerLockChange = () => {
|
||||
if (!pointerLock.hasPointerLock && activeModalStack.length === 0) {
|
||||
|
|
@ -293,7 +294,7 @@ export default () => {
|
|||
{fsState.inMemorySave && !fsState.syncFs && !fsState.isReadonly ? 'Save & Quit' : 'Disconnect & Reset'}
|
||||
</Button>
|
||||
</>}
|
||||
{noConnection && (
|
||||
{(noConnection || appConfig?.alwaysReconnectButton) && (
|
||||
<Button className="button" style={{ width: '204px' }} onClick={reconnectReload}>
|
||||
Reconnect
|
||||
</Button>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue