Compare commits
No commits in common. "c4fa06d3e7ab92875fb75b1fcd5c8a301e7cf25b" and "617d47d94950711aa396794f5f651b584a4d7e9a" have entirely different histories.
c4fa06d3e7
...
617d47d949
5 changed files with 2 additions and 29 deletions
|
@ -1,7 +1,7 @@
|
||||||
import { ColorModeProvider, ColorModeScript } from '@kobalte/core'
|
import { ColorModeProvider, ColorModeScript } from '@kobalte/core'
|
||||||
|
|
||||||
import { workerInit } from 'mtcute-repl-worker/client'
|
import { workerInit } from 'mtcute-repl-worker/client'
|
||||||
import { createSignal, lazy, onCleanup, onMount, Show } from 'solid-js'
|
import { createSignal, lazy, onMount, Show } from 'solid-js'
|
||||||
import { EditorTabs } from './components/editor/EditorTabs.tsx'
|
import { EditorTabs } from './components/editor/EditorTabs.tsx'
|
||||||
import { NavbarMenu } from './components/nav/NavbarMenu.tsx'
|
import { NavbarMenu } from './components/nav/NavbarMenu.tsx'
|
||||||
import { Runner } from './components/runner/Runner.tsx'
|
import { Runner } from './components/runner/Runner.tsx'
|
||||||
|
@ -24,16 +24,6 @@ export function App() {
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
workerInit(workerIframe)
|
workerInit(workerIframe)
|
||||||
|
|
||||||
const handleKeyDown = (e: KeyboardEvent) => {
|
|
||||||
if (e.metaKey && e.key === ',') {
|
|
||||||
setShowSettings(true)
|
|
||||||
e.preventDefault()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
window.addEventListener('keydown', handleKeyDown)
|
|
||||||
onCleanup(() => window.removeEventListener('keydown', handleKeyDown))
|
|
||||||
})
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -64,21 +64,6 @@ async function focusConsole(tabbedPane) {
|
||||||
const injectCss = await waitForElement('#inject-css', document.body);
|
const injectCss = await waitForElement('#inject-css', document.body);
|
||||||
const rootView = await waitForElement('.root-view', document.body);
|
const rootView = await waitForElement('.root-view', document.body);
|
||||||
rootView.appendChild(injectCss);
|
rootView.appendChild(injectCss);
|
||||||
|
|
||||||
// forward some keyboard shortcuts to the parent window
|
|
||||||
document.addEventListener('keydown', (e) => {
|
|
||||||
if (!(e.metaKey && e.key === ',')) return
|
|
||||||
|
|
||||||
const options = {
|
|
||||||
key: e.key,
|
|
||||||
ctrlKey: e.ctrlKey,
|
|
||||||
metaKey: e.metaKey,
|
|
||||||
}
|
|
||||||
const keyboardEvent = new KeyboardEvent('keydown', options)
|
|
||||||
window.parent.dispatchEvent(keyboardEvent)
|
|
||||||
|
|
||||||
e.preventDefault()
|
|
||||||
}, true)
|
|
||||||
})();
|
})();
|
||||||
`
|
`
|
||||||
|
|
||||||
|
|
|
@ -299,7 +299,7 @@ function OtpStep(props: StepProps<'otp'>) {
|
||||||
|
|
||||||
const [innerInputRef, setInnerInputRef] = createSignal<HTMLInputElement | undefined>()
|
const [innerInputRef, setInnerInputRef] = createSignal<HTMLInputElement | undefined>()
|
||||||
|
|
||||||
onMount(() => {
|
createEffect(() => {
|
||||||
const handleKeyDown = (e: KeyboardEvent) => {
|
const handleKeyDown = (e: KeyboardEvent) => {
|
||||||
if (e.key >= '0' && e.key <= '9') {
|
if (e.key >= '0' && e.key <= '9') {
|
||||||
innerInputRef()?.focus()
|
innerInputRef()?.focus()
|
||||||
|
|
|
@ -59,7 +59,6 @@ export async function importAccount(
|
||||||
dcId: asNonNull(session.primaryDcs).main.id,
|
dcId: asNonNull(session.primaryDcs).main.id,
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await client.close()
|
|
||||||
await deleteAccount(accountId)
|
await deleteAccount(accountId)
|
||||||
if (is404) {
|
if (is404) {
|
||||||
throw new Error('Invalid session (auth key not found)')
|
throw new Error('Invalid session (auth key not found)')
|
||||||
|
|
|
@ -45,7 +45,6 @@ async function handleAuthSuccess(accountId: string, user: User) {
|
||||||
const testMode = client.params.testMode ?? false
|
const testMode = client.params.testMode ?? false
|
||||||
|
|
||||||
if ($accounts.get().some(it => it.telegramId === user.id)) {
|
if ($accounts.get().some(it => it.telegramId === user.id)) {
|
||||||
await client.close()
|
|
||||||
await deleteAccount(accountId)
|
await deleteAccount(accountId)
|
||||||
throw new Error(`Account already exists (user ID: ${user.id})`)
|
throw new Error(`Account already exists (user ID: ${user.id})`)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue