mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-12-02 04:53:40 +08:00
fix galaxy support code entry
This commit is contained in:
@@ -1834,7 +1834,7 @@ def make_server(*, port=8082, host='127.0.0.1', monitor=None, owner=None, crashe
|
||||
self.json(401, {'error': 'Sign in to Galaxy'})
|
||||
return
|
||||
if (not isinstance(payload, dict) or not isinstance(payload.get('code'), str) or
|
||||
not re.fullmatch(r'[0-9a-f]{16}', payload['code']) or payload.get('action') not in ('check', 'send')):
|
||||
not re.fullmatch(r'[0-9a-hjkmnp-tv-z]{12}', payload['code']) or payload.get('action') not in ('check', 'send')):
|
||||
self.json(400, {'error': 'Enter the code from the Discord request.'})
|
||||
return
|
||||
relay = 'https://starpilot-log-relay.nathan-g-hubbard.workers.dev/report/galaxy/device'
|
||||
|
||||
@@ -75,7 +75,7 @@ class DiagnosticHTTPTest(unittest.TestCase):
|
||||
|
||||
def test_support_code_captures_on_device_and_confirms_delivery(self):
|
||||
_, _, self.cookie = self.request('/api/auth/session')
|
||||
code = 'ab12' * 3
|
||||
code = 'j2q7m4x8z0tw'
|
||||
path = '/api/companion/support-ticket'
|
||||
def post(action):
|
||||
return self.request(path, method='POST', payload={'code': code, 'action': action})
|
||||
|
||||
@@ -69,6 +69,7 @@ export const ConnectionLogs = {
|
||||
this.captureError = ""
|
||||
},
|
||||
async threadAction(action) {
|
||||
this.$refs?.supportCodeField?.blur()
|
||||
if (this.supportBusy) return
|
||||
this.supportBusy = true
|
||||
this.captureError = ""
|
||||
@@ -141,7 +142,7 @@ export const ConnectionLogs = {
|
||||
<details v-if="!ticket"><summary class="gx-btn">Send to existing Discord thread</summary>
|
||||
<p v-if="supportSent" role="status">Support received the logs. Your Discord thread has the receipt.</p>
|
||||
<form v-else class="gx-log-form" @submit.prevent="threadAction(supportTicket ? 'send' : 'check')">
|
||||
<label class="gx-field-group">Discord request code<input class="gx-field" v-model="supportCode" :disabled="supportBusy" @input="supportTicket = null; captureError = ''" maxlength="24" autocomplete="off" spellcheck="false"></label>
|
||||
<label class="gx-field-group">Discord request code<input ref="supportCodeField" class="gx-field" v-model="supportCode" enterkeyhint="go" autocapitalize="none" autocorrect="off" :disabled="supportBusy" @input="supportTicket = null; captureError = ''" maxlength="24" autocomplete="off" spellcheck="false"></label>
|
||||
<button v-if="!supportTicket" class="gx-btn" type="submit" :disabled="supportBusy || !supportCode.trim()">{{ supportBusy ? 'Finding report…' : 'Find report' }}</button>
|
||||
<template v-else><p>{{ supportTicket.title }}</p><p>Only support staff receive the {{ supportTicket.kind }} logs.</p>
|
||||
<button class="gx-btn" type="submit" :disabled="supportBusy">{{ supportBusy ? 'Sending…' : 'Capture and send' }}</button>
|
||||
|
||||
Reference in New Issue
Block a user