Skip to content

Commit fcf987e

Browse files
committed
always display reconnect button on mcraft.fun
1 parent d112b01 commit fcf987e

File tree

11 files changed

+52
-5
lines changed

11 files changed

+52
-5
lines changed

.github/workflows/build-single-file.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ jobs:
2323

2424
- name: Build single-file version - minecraft.html
2525
run: pnpm build-single-file && mv dist/single/index.html minecraft.html
26+
env:
27+
LOCAL_CONFIG_FILE: config.mcraft-only.json
2628

2729
- name: Upload artifact
2830
uses: actions/upload-artifact@v4

.github/workflows/build-zip.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ jobs:
2323

2424
- name: Build project
2525
run: pnpm build
26+
env:
27+
LOCAL_CONFIG_FILE: config.mcraft-only.json
2628

2729
- name: Bundle server.js
2830
run: |

.github/workflows/next-deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
3737
env:
3838
CONFIG_JSON_SOURCE: BUNDLED
39+
LOCAL_CONFIG_FILE: config.mcraft-only.json
3940
- name: Copy playground files
4041
run: |
4142
mkdir -p .vercel/output/static/playground

.github/workflows/preview.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ jobs:
7878
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
7979
env:
8080
CONFIG_JSON_SOURCE: BUNDLED
81+
LOCAL_CONFIG_FILE: config.mcraft-only.json
8182
- name: Copy playground files
8283
run: |
8384
mkdir -p .vercel/output/static/playground

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
- run: vercel build --token=${{ secrets.VERCEL_TOKEN }} --prod
3535
env:
3636
CONFIG_JSON_SOURCE: BUNDLED
37+
LOCAL_CONFIG_FILE: config.mcraft-only.json
3738
- name: Copy playground files
3839
run: |
3940
mkdir -p .vercel/output/static/playground

config.mcraft-only.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"alwaysReconnectButton": true
3+
}

renderer/viewer/three/threeJsSound.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ export class ThreeJsSound implements SoundSystem {
3939
sound.position.set(position.x, position.y, position.z)
4040
sound.onEnded = () => {
4141
this.worldRenderer.scene.remove(sound)
42-
sound.disconnect()
42+
if (sound.source) {
43+
sound.disconnect()
44+
}
4345
this.activeSounds.delete(sound)
4446
audioLoader.manager.itemEnd(path)
4547
}
@@ -51,7 +53,9 @@ export class ThreeJsSound implements SoundSystem {
5153
// Stop and clean up all active sounds
5254
for (const sound of this.activeSounds) {
5355
sound.stop()
54-
sound.disconnect()
56+
if (sound.source) {
57+
sound.disconnect()
58+
}
5559
}
5660

5761
// Remove and cleanup audio listener

rsbuild.config.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/// <reference types="./src/env" />
12
import { defineConfig, mergeRsbuildConfig, RsbuildPluginAPI } from '@rsbuild/core'
23
import { pluginReact } from '@rsbuild/plugin-react'
34
import { pluginTypedCSSModules } from '@rsbuild/plugin-typed-css-modules'
@@ -48,7 +49,7 @@ if (fs.existsSync('./assets/release.json')) {
4849

4950
const configJson = JSON.parse(fs.readFileSync('./config.json', 'utf8'))
5051
try {
51-
Object.assign(configJson, JSON.parse(fs.readFileSync('./config.local.json', 'utf8')))
52+
Object.assign(configJson, JSON.parse(fs.readFileSync(process.env.LOCAL_CONFIG_FILE || './config.local.json', 'utf8')))
5253
} catch (err) {}
5354
if (dev) {
5455
configJson.defaultProxy = ':8080'
@@ -198,7 +199,7 @@ const appConfig = defineConfig({
198199
}
199200

200201
if (configSource === 'REMOTE') {
201-
fs.writeFileSync('./dist/config.json', JSON.stringify(configJson), 'utf8')
202+
fs.writeFileSync('./dist/config.json', JSON.stringify(configJson, undefined, 2), 'utf8')
202203
}
203204
if (fs.existsSync('./generated/sounds.js')) {
204205
fs.copyFileSync('./generated/sounds.js', './dist/sounds.js')

src/appConfig.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export type AppConfig = {
5555
showModsButton?: boolean
5656
defaultUsername?: string
5757
skinTexturesProxy?: string
58+
alwaysReconnectButton?: boolean
5859
}
5960

6061
export const loadAppConfig = (appConfig: AppConfig) => {

src/env.d.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
declare namespace NodeJS {
2+
interface ProcessEnv {
3+
// Build configuration
4+
NODE_ENV: 'development' | 'production'
5+
SINGLE_FILE_BUILD?: string
6+
DISABLE_SERVICE_WORKER?: string
7+
CONFIG_JSON_SOURCE?: 'BUNDLED' | 'REMOTE'
8+
LOCAL_CONFIG_FILE?: string
9+
BUILD_VERSION?: string
10+
11+
// GitHub and Vercel related
12+
GITHUB_REPOSITORY?: string
13+
VERCEL_GIT_REPO_OWNER?: string
14+
VERCEL_GIT_REPO_SLUG?: string
15+
16+
// UI and Features
17+
MAIN_MENU_LINKS?: string
18+
ENABLE_COOKIE_STORAGE?: string
19+
COOKIE_STORAGE_PREFIX?: string
20+
21+
// Release information
22+
RELEASE_TAG?: string
23+
RELEASE_LINK?: string
24+
RELEASE_CHANGELOG?: string
25+
26+
// Other configurations
27+
DEPS_VERSIONS?: string
28+
INLINED_APP_CONFIG?: string
29+
}
30+
}

0 commit comments

Comments
 (0)