@muhammedaksam/easiarr 0.1.9 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muhammedaksam/easiarr",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "TUI tool for generating docker-compose files for the *arr media ecosystem with 41 apps, TRaSH Guides best practices, VPN routing, and Traefik reverse proxy support",
5
5
  "module": "src/index.ts",
6
6
  "type": "module",
@@ -86,6 +86,7 @@ export function createQBittorrentConfig(
86
86
  { name: "username", value: username },
87
87
  { name: "password", value: password },
88
88
  { name: categoryField, value: category },
89
+ { name: "savePath", value: "/data/torrents" },
89
90
  { name: "recentMoviePriority", value: 0 },
90
91
  { name: "olderMoviePriority", value: 0 },
91
92
  { name: "initialState", value: 0 },
@@ -111,6 +112,7 @@ export function createSABnzbdConfig(host: string, port: number, apiKey: string,
111
112
  { name: "port", value: port },
112
113
  { name: "apiKey", value: apiKey },
113
114
  { name: categoryField, value: category },
115
+ { name: "savePath", value: "/data/usenet" },
114
116
  { name: "recentMoviePriority", value: -100 },
115
117
  { name: "olderMoviePriority", value: -100 },
116
118
  ],
@@ -13,7 +13,6 @@ import {
13
13
  } from "@opentui/core"
14
14
  import { existsSync, readFileSync } from "node:fs"
15
15
  import { writeFile, readFile } from "node:fs/promises"
16
- import { join } from "node:path"
17
16
  import { createPageLayout } from "../components/PageLayout"
18
17
  import { EasiarrConfig, AppId } from "../../config/schema"
19
18
  import { getApp } from "../../apps/registry"
@@ -114,7 +113,7 @@ export class AppConfigurator extends BoxRenderable {
114
113
  const { container, content } = createPageLayout(this.cliRenderer, {
115
114
  title: "Configure Apps",
116
115
  stepInfo: "Global Credentials",
117
- footerHint: "Enter credentials for all *arr apps Tab Next Field Enter Continue Esc Skip",
116
+ footerHint: "Tab Cycle Fields/Shortcuts O Override Enter Continue Esc Skip",
118
117
  })
119
118
  this.pageContainer = container
120
119
  this.add(container)
@@ -174,13 +173,16 @@ export class AppConfigurator extends BoxRenderable {
174
173
  overrideText.content = `[O] Override existing: ${this.overrideExisting ? "Yes" : "No"}`
175
174
  overrideText.fg = this.overrideExisting ? "#50fa7b" : "#6272a4"
176
175
  } else if (key.name === "tab") {
177
- // Toggle focus between inputs
176
+ // Cycle focus: username -> password -> no focus (shortcuts work) -> username
178
177
  if (focusedInput === userInput) {
179
178
  userInput.blur()
180
179
  passInput.focus()
181
180
  focusedInput = passInput
182
- } else {
181
+ } else if (focusedInput === passInput) {
183
182
  passInput.blur()
183
+ focusedInput = null // No focus state - shortcuts available
184
+ } else {
185
+ // No input focused, go back to username
184
186
  userInput.focus()
185
187
  focusedInput = userInput
186
188
  }
@@ -343,27 +345,25 @@ export class AppConfigurator extends BoxRenderable {
343
345
  }
344
346
 
345
347
  private extractApiKey(appId: AppId): string | null {
346
- const appDef = getApp(appId)
347
- if (!appDef?.apiKeyMeta) return null
348
-
349
- const volumes = appDef.volumes(this.config.rootDir)
350
- if (volumes.length === 0) return null
351
-
352
- const parts = volumes[0].split(":")
353
- const hostPath = parts[0]
354
- const configFilePath = join(hostPath, appDef.apiKeyMeta.configFile)
348
+ // Use API keys from .env file (format: API_KEY_APPNAME)
349
+ try {
350
+ const envPath = getComposePath().replace("docker-compose.yml", ".env")
351
+ if (!existsSync(envPath)) return null
355
352
 
356
- if (!existsSync(configFilePath)) return null
353
+ const content = readFileSync(envPath, "utf-8")
354
+ const envKey = `API_KEY_${appId.toUpperCase()}`
357
355
 
358
- const content = readFileSync(configFilePath, "utf-8")
356
+ for (const line of content.split("\n")) {
357
+ const [key, ...val] = line.split("=")
358
+ if (key?.trim() === envKey && val.length > 0) {
359
+ return val.join("=").trim()
360
+ }
361
+ }
359
362
 
360
- if (appDef.apiKeyMeta.parser === "regex") {
361
- const regex = new RegExp(appDef.apiKeyMeta.selector)
362
- const match = regex.exec(content)
363
- return match?.[1] || null
363
+ return null
364
+ } catch {
365
+ return null
364
366
  }
365
-
366
- return null
367
367
  }
368
368
 
369
369
  private renderConfigProgress() {