@muhammedaksam/easiarr 0.9.0 → 0.9.1

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.9.0",
3
+ "version": "0.9.1",
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",
@@ -595,7 +595,8 @@ export const APPS: Record<AppId, AppDefinition> = {
595
595
  pgid: 0,
596
596
  volumes: () => [
597
597
  "${HOME}/.easiarr/config.json:/web/config.json:ro",
598
- "${HOME}/.easiarr/bookmarks.html:/web/bookmarks.html:ro",
598
+ "${HOME}/.easiarr/bookmarks-local.html:/web/bookmarks-local.html:ro",
599
+ "${HOME}/.easiarr/bookmarks-remote.html:/web/bookmarks-remote.html:ro",
599
600
  ],
600
601
  environment: {
601
602
  FOLDER: "/web",
@@ -111,17 +111,39 @@ export function generateBookmarksHtml(config: EasiarrConfig, useLocalUrls = fals
111
111
 
112
112
  /**
113
113
  * Get the path to the bookmarks file
114
+ * @param type - 'local' for local URLs, 'remote' for Traefik URLs
114
115
  */
115
- export function getBookmarksPath(): string {
116
- return join(homedir(), ".easiarr", "bookmarks.html")
116
+ export function getBookmarksPath(type: "local" | "remote" = "local"): string {
117
+ const filename = type === "remote" ? "bookmarks-remote.html" : "bookmarks-local.html"
118
+ return join(homedir(), ".easiarr", filename)
117
119
  }
118
120
 
119
121
  /**
120
122
  * Save bookmarks HTML file
123
+ * @param type - 'local' for local URLs, 'remote' for Traefik URLs
121
124
  */
122
- export async function saveBookmarks(config: EasiarrConfig, useLocalUrls = false): Promise<string> {
125
+ export async function saveBookmarks(config: EasiarrConfig, type: "local" | "remote" = "local"): Promise<string> {
126
+ const useLocalUrls = type === "local"
123
127
  const html = generateBookmarksHtml(config, useLocalUrls)
124
- const path = getBookmarksPath()
128
+ const path = getBookmarksPath(type)
125
129
  await writeFile(path, html, "utf-8")
126
130
  return path
127
131
  }
132
+
133
+ /**
134
+ * Save all bookmarks files
135
+ * Always saves local bookmarks, and remote bookmarks only if Traefik is enabled
136
+ */
137
+ export async function saveAllBookmarks(config: EasiarrConfig): Promise<string[]> {
138
+ const paths: string[] = []
139
+
140
+ // Always save local bookmarks
141
+ paths.push(await saveBookmarks(config, "local"))
142
+
143
+ // Save remote bookmarks only if Traefik is enabled with a domain
144
+ if (config.traefik?.enabled && config.traefik.domain) {
145
+ paths.push(await saveBookmarks(config, "remote"))
146
+ }
147
+
148
+ return paths
149
+ }
@@ -155,12 +155,13 @@ export class MainMenu {
155
155
  })
156
156
  }
157
157
  // Bookmark generation options
158
- const generateAndOpenBookmarks = async (useLocalUrls: boolean) => {
159
- await saveBookmarks(this.config, useLocalUrls)
158
+ const generateAndOpenBookmarks = async (type: "local" | "remote") => {
159
+ await saveBookmarks(this.config, type)
160
160
  // Open in browser if easiarr service is enabled
161
161
  if (this.isAppEnabled("easiarr")) {
162
162
  const port = this.config.apps.find((a) => a.id === "easiarr")?.port ?? 3010
163
- await openUrl(`http://localhost:${port}/bookmarks.html`)
163
+ const filename = type === "remote" ? "bookmarks-remote.html" : "bookmarks-local.html"
164
+ await openUrl(`http://localhost:${port}/${filename}`)
164
165
  }
165
166
  }
166
167
 
@@ -168,18 +169,18 @@ export class MainMenu {
168
169
  items.push({
169
170
  name: "📑 Bookmarks (Local URLs)",
170
171
  description: "Generate bookmarks using localhost addresses",
171
- action: async () => generateAndOpenBookmarks(true),
172
+ action: async () => generateAndOpenBookmarks("local"),
172
173
  })
173
174
  items.push({
174
175
  name: "📑 Bookmarks (Traefik URLs)",
175
176
  description: `Generate bookmarks using ${this.config.traefik.domain} addresses`,
176
- action: async () => generateAndOpenBookmarks(false),
177
+ action: async () => generateAndOpenBookmarks("remote"),
177
178
  })
178
179
  } else {
179
180
  items.push({
180
181
  name: "📑 Generate Bookmarks",
181
182
  description: "Create browser-importable bookmarks file",
182
- action: async () => generateAndOpenBookmarks(true),
183
+ action: async () => generateAndOpenBookmarks("local"),
183
184
  })
184
185
  }
185
186