Skip to content

Commit 172060d

Browse files
authored
save all play screen options (#326)
* save all play screen options * fixed semicolons was hard to catch in nvim sorry
1 parent 9e53633 commit 172060d

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

lib/menus/play_screen.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,14 @@ class PlayScreen extends LitElement {
6363

6464
constructor () {
6565
super()
66-
this.server = ''
67-
this.serverport = 25565
68-
this.proxy = ''
69-
this.proxyport = ''
7066
this.username = window.localStorage.getItem('username') ?? 'pviewer' + (Math.floor(Math.random() * 1000))
71-
this.password = ''
72-
this.version = ''
73-
67+
this.password = window.localStorage.getItem('password') ?? ''
7468
window.fetch('config.json').then(res => res.json()).then(config => {
75-
this.server = config.defaultHost
76-
this.serverport = config.defaultHostPort ?? 25565
77-
this.proxy = config.defaultProxy
78-
this.proxyport = !config.defaultProxy && !config.defaultProxyPort ? '' : config.defaultProxyPort ?? 443
79-
this.version = config.defaultVersion
69+
this.server = window.localStorage.getItem('server') ?? config.defaultHost
70+
this.serverport = window.localStorage.getItem('serverport') ?? config.defaultHostPort ?? 25565
71+
this.proxy = window.localStorage.getItem('proxy') ?? config.defaultProxy
72+
this.proxyport = window.localStorage.getItem('proxyport') ?? (!config.defaultProxy && !config.defaultProxyPort ? '' : config.defaultProxyPort ?? 443)
73+
this.version = window.localStorage.getItem('version') ?? config.defaultVersion
8074
})
8175
}
8276

@@ -147,6 +141,12 @@ class PlayScreen extends LitElement {
147141

148142
onConnectPress () {
149143
window.localStorage.setItem('username', this.username)
144+
window.localStorage.setItem('password', this.password)
145+
window.localStorage.setItem('server', this.server)
146+
window.localStorage.setItem('serverport', this.serverport)
147+
window.localStorage.setItem('proxy', this.proxy)
148+
window.localStorage.setItem('proxyport', this.proxyport)
149+
window.localStorage.setItem('version', this.version)
150150

151151
this.dispatchEvent(new window.CustomEvent('connect', {
152152
detail: {

0 commit comments

Comments
 (0)