mirror of
https://github.com/Andre-Bzk/twitch4steamdeck.git
synced 2026-11-15 15:43:08 +01:00
style: translate all source code comments to English
German inline comments alongside English identifiers create a language mismatch that makes the code harder to read for anyone not fluent in German. All 28 affected comments across 14 files are now in English, consistent with the rest of the project's written artifacts.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Orchestriert den kompletten Twitch-Login-Lifecycle und hält den aktuellen Token-Status.
|
||||
// Orchestrates the full Twitch login lifecycle and tracks current token status.
|
||||
|
||||
import { EventEmitter } from 'node:events'
|
||||
import {
|
||||
|
||||
@@ -92,7 +92,7 @@ export async function pollForToken(opts: PollOptions): Promise<PollOutcome> {
|
||||
return { kind: 'authorized', token }
|
||||
}
|
||||
|
||||
// Twitch liefert bei Pending einen 400 mit message-Feld.
|
||||
// Twitch returns a 400 with a message field while the code is pending.
|
||||
let payload: ErrorResponse = {}
|
||||
try {
|
||||
const json = (await res.json()) as unknown
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Verschlüsselte Persistenz für Twitch-Tokens.
|
||||
// Nutzt Electron safeStorage (OS-Keystore unter der Haube) — keine native Module nötig.
|
||||
// Encrypted persistence for Twitch tokens.
|
||||
// Uses Electron safeStorage (OS keystore under the hood) — no native modules required.
|
||||
|
||||
import { app, safeStorage } from 'electron'
|
||||
import { promises as fs } from 'node:fs'
|
||||
@@ -27,8 +27,8 @@ export async function saveTokens(tokens: StoredTokens): Promise<void> {
|
||||
const encrypted = safeStorage.encryptString(json)
|
||||
await fs.writeFile(path, encrypted)
|
||||
} else {
|
||||
// Fallback: unverschlüsselt (z. B. headless Linux ohne Keyring).
|
||||
// Datei nur für aktuellen User lesbar machen.
|
||||
// Fallback: plaintext (e.g. headless Linux without a keyring).
|
||||
// Restrict file permissions to the current user.
|
||||
await fs.writeFile(path, json, { mode: 0o600 })
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,7 @@ export async function loadTokens(): Promise<StoredTokens | null> {
|
||||
try {
|
||||
json = safeStorage.decryptString(raw)
|
||||
} catch {
|
||||
// Datei evtl. mit anderem Key geschrieben — als ungültig behandeln.
|
||||
// File may have been written with a different key — treat as invalid.
|
||||
return null
|
||||
}
|
||||
} else {
|
||||
|
||||
+5
-4
@@ -9,11 +9,12 @@ import { getHlsCacheEnabled } from './prefs/hlsCachePref'
|
||||
|
||||
const isDev = !app.isPackaged
|
||||
|
||||
// Erlaubt video.play() ohne vorangehende User-Geste (nötig, weil play() in hls.js-Callbacks
|
||||
// aufgerufen wird, die asynchron weit nach dem ursprünglichen Click-Event stattfinden).
|
||||
// Allows video.play() without a prior user gesture — play() is called from hls.js callbacks
|
||||
// that fire asynchronously long after the original click event.
|
||||
app.commandLine.appendSwitch('autoplay-policy', 'no-user-gesture-required')
|
||||
// Explizite Cache-Größe verhindert Chromiums dynamische Größenberechnung, die bei
|
||||
// wechselndem freiem Speicherplatz zu "Invalid cache (current) size"-Fehlern führt.
|
||||
// Explicit cache size prevents Chromium's dynamic sizing, which causes "Invalid cache (current)
|
||||
// size" errors when available disk space fluctuates.
|
||||
|
||||
app.commandLine.appendSwitch('disk-cache-size', String(500 * 1024 * 1024))
|
||||
|
||||
function createWindow(): BrowserWindow {
|
||||
|
||||
@@ -41,7 +41,7 @@ const INPUT_EVENT_SIZE = 24
|
||||
const EV_KEY = 0x01
|
||||
const EV_ABS = 0x03
|
||||
|
||||
// Button-Codes (BTN_GAMEPAD-Bereich) – konsistent über alle Controller und Treiber
|
||||
// Button codes (BTN_GAMEPAD range) — consistent across all controllers and drivers
|
||||
const BTN_SOUTH = 0x130
|
||||
const BTN_EAST = 0x131
|
||||
const BTN_NORTH = 0x133
|
||||
@@ -70,10 +70,10 @@ const BUTTON_MAP: Record<number, string> = {
|
||||
[BTN_TR2]: 'r2',
|
||||
}
|
||||
|
||||
const STICK_THRESHOLD = 16384 // ~50% von 32767
|
||||
const STICK_THRESHOLD = 16384 // ~50% of 32767
|
||||
const REPEAT_INITIAL_MS = 400
|
||||
const REPEAT_INTERVAL_MS = 150
|
||||
// Trigger-Achsen sollen kein Auto-Repeat auslösen (300s-Sprünge nicht wiederholen)
|
||||
// Trigger axes must not fire auto-repeat (avoid repeating 300 s jumps)
|
||||
const NO_REPEAT_ABS_CODES = new Set([ABS_Z, ABS_RZ])
|
||||
|
||||
interface AxisState {
|
||||
@@ -96,7 +96,7 @@ function findEventDevice(jsDevicePath: string): string | null {
|
||||
const eventEntry = entries.find((e) => /^event\d+$/.test(e))
|
||||
if (eventEntry) return `/dev/input/${eventEntry}`
|
||||
} catch {
|
||||
// Kein /sys-Zugriff oder Device verschwunden
|
||||
// No /sys access or device has disappeared
|
||||
}
|
||||
return null
|
||||
}
|
||||
@@ -400,7 +400,7 @@ export function startGamepadReader(getWindow: () => BrowserWindow | null): () =>
|
||||
console.log(`[gamepad] geöffnet (evdev): ${jsPath} → ${eventPath}`)
|
||||
}
|
||||
} else {
|
||||
// Fallback auf altes Joystick-API wenn kein /sys-Mapping gefunden
|
||||
// Fallback to legacy joystick API when no /sys mapping is found
|
||||
reader = new JoystickFallbackReader(jsPath, onKey)
|
||||
if (reader.start()) {
|
||||
readers.set(jsPath, reader)
|
||||
@@ -417,7 +417,7 @@ export function startGamepadReader(getWindow: () => BrowserWindow | null): () =>
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// /dev/input nicht zugänglich
|
||||
// /dev/input not accessible
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ export function registerIpcHandlers(
|
||||
)
|
||||
ipcMain.handle(IPC.playbackStop, () => playback.stop())
|
||||
ipcMain.handle(IPC.playbackPause, () => {
|
||||
// Fokus auf Electron-Fenster zurückholen (Windows: Win Gamepad API braucht Fokus)
|
||||
// Bring Electron window back into focus (Windows: Gamepad API requires window focus)
|
||||
for (const win of BrowserWindow.getAllWindows()) win.focus()
|
||||
})
|
||||
ipcMain.handle(
|
||||
|
||||
@@ -68,7 +68,7 @@ export function getStreamUrl(url: string, quality: string): Promise<string> {
|
||||
proc.stdout?.on('data', (d: Buffer) => { out += d.toString() })
|
||||
proc.on('error', reject)
|
||||
proc.on('exit', (code) => {
|
||||
// Nimm die letzte Zeile die mit https:// beginnt — ignoriert Info-/Warn-Zeilen
|
||||
// Take the last line starting with https:// — skips info/warn lines from streamlink
|
||||
const hlsUrl = out.split('\n').map((l) => l.trim()).filter((l) => l.startsWith('https://')).at(-1) ?? ''
|
||||
if (code === 0 && hlsUrl) {
|
||||
resolve(hlsUrl)
|
||||
|
||||
@@ -308,7 +308,7 @@ export class HelixClient {
|
||||
}
|
||||
})
|
||||
|
||||
// Live-Kanäle zuerst, dann alphabetisch
|
||||
// Live channels first, then alphabetical
|
||||
return channels.sort((a, b) => {
|
||||
if (a.isLive !== b.isLive) return a.isLive ? -1 : 1
|
||||
return a.broadcasterName.localeCompare(b.broadcasterName)
|
||||
|
||||
Reference in New Issue
Block a user