Add "Old" pairing method to the UI
This commit is contained in:
		
							parent
							
								
									0e1aa86096
								
							
						
					
					
						commit
						d84ad34434
					
				
					 2 changed files with 14 additions and 7 deletions
				
			
		
							
								
								
									
										3
									
								
								dance.py
									
										
									
									
									
								
							
							
						
						
									
										3
									
								
								dance.py
									
										
									
									
									
								
							|  | @ -28,6 +28,7 @@ class WsCommand(Enum): | ||||||
| class PairingMethod(Enum): | class PairingMethod(Enum): | ||||||
|     DEFAULT = 'default' |     DEFAULT = 'default' | ||||||
|     FAST = 'fast' |     FAST = 'fast' | ||||||
|  |     OLD = 'old' | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| REGEX_PAIRING_CODE = re.compile(r'^\d{6}$') | REGEX_PAIRING_CODE = re.compile(r'^\d{6}$') | ||||||
|  | @ -222,7 +223,7 @@ def is_valid_ip_address(val): | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def is_valid_pairing_method(val): | def is_valid_pairing_method(val): | ||||||
|     return val in [PairingMethod.DEFAULT.value, PairingMethod.FAST.value] |     return val in [PairingMethod.DEFAULT.value, PairingMethod.FAST.value, PairingMethod.OLD.value] | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def get_host_ip(): | def get_host_ip(): | ||||||
|  |  | ||||||
|  | @ -17,7 +17,8 @@ const BATTERY_LEVEL = { | ||||||
| 
 | 
 | ||||||
| const PairingMethod = { | const PairingMethod = { | ||||||
|     DEFAULT: 'default', |     DEFAULT: 'default', | ||||||
|     FAST: 'fast' |     FAST: 'fast', | ||||||
|  |     OLD: 'old', | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| const WsCommand = { | const WsCommand = { | ||||||
|  | @ -83,8 +84,13 @@ class PairingMethodPicker extends Component { | ||||||
|         return html` |         return html` | ||||||
|             <label for="stacked-state">Pairing Method</label> |             <label for="stacked-state">Pairing Method</label> | ||||||
|             <select id="stacked-state" onChange=${this.onChange} value=${props.pairing_method}> |             <select id="stacked-state" onChange=${this.onChange} value=${props.pairing_method}> | ||||||
|                 <option value="${PairingMethod.DEFAULT}">Default: All platforms (incl. Xbox Series/Stadia)</option> |                 <optgroup label="JD 2020 and later"> | ||||||
|                 <option value="${PairingMethod.FAST}">Fast: Xbox One/PlayStation/Nintendo Switch</option> |                     <option value="${PairingMethod.DEFAULT}">Default: All platforms (incl. Xbox Series/Stadia)</option> | ||||||
|  |                     <option value="${PairingMethod.FAST}">Fast: Xbox One/PlayStation/Nintendo Switch</option> | ||||||
|  |                 </optgroup> | ||||||
|  |                 <optgroup label="JD 2016-2019"> | ||||||
|  |                     <option value="${PairingMethod.OLD}">Old: All platforms (incl. PC)</option> | ||||||
|  |                 </optgroup> | ||||||
|             </select> |             </select> | ||||||
|         ` |         ` | ||||||
|     } |     } | ||||||
|  | @ -141,14 +147,14 @@ class PrivateIpAddress extends Component { | ||||||
|         return html` |         return html` | ||||||
|             <label> |             <label> | ||||||
|                 ${pairing_method == PairingMethod.DEFAULT && html`Host's Private IP Address`} |                 ${pairing_method == PairingMethod.DEFAULT && html`Host's Private IP Address`} | ||||||
|                 ${pairing_method == PairingMethod.FAST && html`Console's Private IP Address`} |                 ${pairing_method != PairingMethod.DEFAULT && html`Console's Private IP Address`} | ||||||
|             </label> |             </label> | ||||||
| 
 | 
 | ||||||
|             ${pairing_method == PairingMethod.DEFAULT && state.lock_host && html` |             ${pairing_method == PairingMethod.DEFAULT && state.lock_host && html` | ||||||
|                 <input readonly required id="ipAddr" type="text" size="15" placeholder="${addr}" /> |                 <input readonly required id="ipAddr" type="text" size="15" placeholder="${addr}" /> | ||||||
|             `}
 |             `}
 | ||||||
| 
 | 
 | ||||||
|             ${(pairing_method == PairingMethod.FAST || !state.lock_host) && html` |             ${(pairing_method != PairingMethod.DEFAULT || !state.lock_host) && html` | ||||||
|                 <input required id="ipAddr" type="text" inputmode="decimal" size="15" maxlength="15" placeholder="192.168.x.x" pattern="^192\\.168\\.((\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.)(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])$" value=${addr} onKeyPress=${this.onKeyPress} onChange="${this.onChange}" /> |                 <input required id="ipAddr" type="text" inputmode="decimal" size="15" maxlength="15" placeholder="192.168.x.x" pattern="^192\\.168\\.((\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.)(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])$" value=${addr} onKeyPress=${this.onKeyPress} onChange="${this.onChange}" /> | ||||||
|             `}
 |             `}
 | ||||||
| 
 | 
 | ||||||
|  | @ -181,7 +187,7 @@ class PairingCode extends Component { | ||||||
|             ${props.pairing_method == PairingMethod.DEFAULT && html` |             ${props.pairing_method == PairingMethod.DEFAULT && html` | ||||||
|                 <input required id="pairingCode" type="text" inputmode="decimal" value=${state.pairing_code} placeholder="000000" maxlength="6" size="6" pattern="[0-9]{6}" onKeyPress=${(e) => !/[0-9]/.test(e.key) && e.preventDefault()} onChange=${this.onChange} /> |                 <input required id="pairingCode" type="text" inputmode="decimal" value=${state.pairing_code} placeholder="000000" maxlength="6" size="6" pattern="[0-9]{6}" onKeyPress=${(e) => !/[0-9]/.test(e.key) && e.preventDefault()} onChange=${this.onChange} /> | ||||||
|             `}
 |             `}
 | ||||||
|             ${props.pairing_method == PairingMethod.FAST && html` |             ${props.pairing_method != PairingMethod.DEFAULT && html` | ||||||
|                 <input type="text" id="pairingCode" value="" readonly placeholder="Not Required" size="12" /> |                 <input type="text" id="pairingCode" value="" readonly placeholder="Not Required" size="12" /> | ||||||
|             `}
 |             `}
 | ||||||
|         ` |         ` | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue