lightnet 4.5.0 → 4.5.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # lightnet
2
2
 
3
+ ## 4.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#421](https://github.com/LightNetDev/LightNet/pull/421) [`9935fa9`](https://github.com/LightNetDev/LightNet/commit/9935fa94b22a4f70d09ac7118ee9abc1c63bfad3) - Update dependencies.
8
+
3
9
  ## 4.5.0
4
10
 
5
11
  ### Minor Changes
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "LightNet makes it easy to run your own digital media library.",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
- "version": "4.5.0",
6
+ "version": "4.5.1",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "https://github.com/LightNetDev/lightnet",
@@ -52,24 +52,24 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "@astrojs/react": "^5.0.7",
55
- "@iconify-json/lucide": "^1.2.114",
55
+ "@iconify-json/lucide": "^1.2.115",
56
56
  "@iconify-json/mdi": "^1.2.3",
57
57
  "@iconify/tailwind": "^1.2.0",
58
58
  "@tailwindcss/typography": "^0.5.20",
59
- "@tanstack/react-virtual": "^3.14.3",
60
- "autoprefixer": "^10.5.0",
59
+ "@tanstack/react-virtual": "^3.14.4",
60
+ "autoprefixer": "^10.5.2",
61
61
  "embla-carousel": "^8.6.0",
62
62
  "embla-carousel-wheel-gestures": "^8.1.0",
63
63
  "fuse.js": "^7.4.2",
64
- "i18next": "^26.3.1",
65
- "lucide-react": "^1.21.0",
64
+ "i18next": "^26.3.3",
65
+ "lucide-react": "^1.22.0",
66
66
  "marked": "^18.0.5",
67
- "postcss": "^8.5.15",
67
+ "postcss": "^8.5.16",
68
68
  "postcss-load-config": "^6.0.1",
69
69
  "yaml": "^2.9.0"
70
70
  },
71
71
  "devDependencies": {
72
- "@playwright/test": "^1.61.0",
72
+ "@playwright/test": "^1.61.1",
73
73
  "@types/react": "^19.2.17",
74
74
  "astro": "^6.4.8",
75
75
  "typescript": "^6.0.3",
@@ -17,10 +17,3 @@ declare module "virtual:lightnet/components/CustomFooter" {
17
17
  const CustomFooter: ((props: Record<string, any>) => any) | undefined
18
18
  export default CustomFooter
19
19
  }
20
-
21
- declare module "virtual:lightnet/components/media-item-edit-button-controller" {
22
- const mediaItemEditButtonController:
23
- | { shouldShow: () => boolean; createHref: (mediaId: string) => string }
24
- | undefined
25
- export default mediaItemEditButtonController
26
- }
@@ -9,8 +9,6 @@ const CONFIG = "virtual:lightnet/config"
9
9
  const LOGO = "virtual:lightnet/logo"
10
10
  const CUSTOM_HEAD = "virtual:lightnet/components/CustomHead"
11
11
  const CUSTOM_FOOTER = "virtual:lightnet/components/CustomFooter"
12
- const MEDIA_ITEM_EDIT_BUTTON_CONTROLLER =
13
- "virtual:lightnet/components/media-item-edit-button-controller"
14
12
 
15
13
  const TRANSLATION_RUNTIME_MODULES = [
16
14
  fileURLToPath(new URL("../i18n/translations.ts", import.meta.url)),
@@ -18,13 +16,7 @@ const TRANSLATION_RUNTIME_MODULES = [
18
16
  fileURLToPath(new URL("../i18n/locals.ts", import.meta.url)),
19
17
  ]
20
18
 
21
- const VIRTUAL_MODULES = [
22
- CONFIG,
23
- LOGO,
24
- CUSTOM_HEAD,
25
- CUSTOM_FOOTER,
26
- MEDIA_ITEM_EDIT_BUTTON_CONTROLLER,
27
- ] as const
19
+ const VIRTUAL_MODULES = [CONFIG, LOGO, CUSTOM_HEAD, CUSTOM_FOOTER] as const
28
20
 
29
21
  export function vitePluginLightnetConfig(
30
22
  config: ExtendedLightnetConfig,
@@ -72,8 +64,6 @@ export function vitePluginLightnetConfig(
72
64
  return config.footerComponent
73
65
  ? `export { default } from ${resolveFilePath(config.footerComponent)};`
74
66
  : "export default undefined;"
75
- case MEDIA_ITEM_EDIT_BUTTON_CONTROLLER:
76
- return "export default undefined;"
77
67
  }
78
68
  },
79
69
  }
@@ -8,8 +8,7 @@ import { type LightNetTranslationKey, loadTranslations } from "./translations"
8
8
 
9
9
  // We add (string & NonNullable<unknown>) to preserve typescript autocompletion for known keys
10
10
  export type TranslationKey =
11
- | LightNetTranslationKey
12
- | (string & NonNullable<unknown>)
11
+ LightNetTranslationKey | (string & NonNullable<unknown>)
13
12
 
14
13
  export type TranslateFn = (input: TranslationKey, options?: TOptions) => string
15
14
 
@@ -1,5 +1,10 @@
1
1
  ---
2
- import { ExternalLinkIcon, MenuIcon, SearchIcon } from "lucide-react"
2
+ import {
3
+ ExternalLinkIcon,
4
+ MenuIcon,
5
+ SearchIcon,
6
+ SquarePenIcon,
7
+ } from "lucide-react"
3
8
  import config from "virtual:lightnet/config"
4
9
 
5
10
  import { isExternalUrl } from "../../../utils/is-external-url"
@@ -27,6 +32,14 @@ const items = (config.mainMenu ?? []).map(({ href, label, requiresLocale }) => {
27
32
  ---
28
33
 
29
34
  <nav class="-me-3 flex items-center">
35
+ <a
36
+ class="hidden p-3 text-gray-600 hover:text-primary"
37
+ aria-label={t("ln.details.edit")}
38
+ href="#"
39
+ id="header-admin-btn"
40
+ >
41
+ <SquarePenIcon />
42
+ </a>
30
43
  {
31
44
  !config.searchPage?.hideHeaderSearchIcon && (
32
45
  <a
@@ -61,3 +74,22 @@ const items = (config.mainMenu ?? []).map(({ href, label, requiresLocale }) => {
61
74
  )
62
75
  }
63
76
  </nav>
77
+ <script>
78
+ const initAdminButton = () => {
79
+ const adminPath = localStorage.getItem("ln.adminPaths")
80
+ if (!adminPath) {
81
+ return
82
+ }
83
+ const rootPath = JSON.parse(adminPath).rootPath as string | undefined
84
+ const btn: HTMLAnchorElement | null =
85
+ document.querySelector("#header-admin-btn")
86
+
87
+ if (!rootPath || !btn) {
88
+ return
89
+ }
90
+ btn.href = rootPath
91
+ btn.classList.remove("hidden")
92
+ btn.classList.add("flex")
93
+ }
94
+ initAdminButton()
95
+ </script>
@@ -1,10 +1,5 @@
1
1
  ---
2
2
  import { SquarePenIcon } from "lucide-react"
3
- import mediaItemEditButtonController from "virtual:lightnet/components/media-item-edit-button-controller"
4
-
5
- if (!mediaItemEditButtonController) {
6
- return
7
- }
8
3
 
9
4
  interface Props {
10
5
  mediaId: string
@@ -22,19 +17,23 @@ const { mediaId } = Astro.props
22
17
  {Astro.locals.i18n.t("ln.details.edit")}</a
23
18
  >
24
19
  <script>
25
- import mediaItemEditButtonController from "virtual:lightnet/components/media-item-edit-button-controller"
20
+ const initEditButton = () => {
21
+ const adminPath = localStorage.getItem("ln.adminPaths")
22
+ if (!adminPath) {
23
+ return
24
+ }
25
+ const mediaItemPath = JSON.parse(adminPath).mediaItemPath as
26
+ string | undefined
27
+ const btn: HTMLAnchorElement | null = document.querySelector("#edit-btn")
26
28
 
27
- const btn: HTMLAnchorElement | null = document.querySelector("#edit-btn")
28
- const mediaId = btn?.dataset.mediaId
29
+ if (!mediaItemPath || !btn) {
30
+ return
31
+ }
29
32
 
30
- if (
31
- mediaItemEditButtonController &&
32
- btn &&
33
- mediaId &&
34
- mediaItemEditButtonController.shouldShow()
35
- ) {
36
- btn.href = mediaItemEditButtonController.createHref(mediaId)
33
+ const mediaId = btn.dataset.mediaId ?? ""
34
+ btn.href = mediaItemPath.replace("{{mediaId}}", mediaId)
37
35
  btn.classList.remove("hidden")
38
36
  btn.classList.add("flex")
39
37
  }
38
+ initEditButton()
40
39
  </script>
@@ -1,13 +1,7 @@
1
1
  import { isExternalUrl } from "../../../utils/is-external-url"
2
2
 
3
3
  export type UrlType =
4
- | "link"
5
- | "source"
6
- | "image"
7
- | "audio"
8
- | "video"
9
- | "text"
10
- | "package"
4
+ "link" | "source" | "image" | "audio" | "video" | "text" | "package"
11
5
 
12
6
  const KNOWN_EXTENSIONS: Record<
13
7
  string,
@@ -14,10 +14,7 @@ export const CATEGORY = "category"
14
14
  export const UPDATE_QUERY_EVENT = "ln:update-search-query"
15
15
 
16
16
  export type SearchQueryParam =
17
- | typeof SEARCH
18
- | typeof LANGUAGE
19
- | typeof TYPE
20
- | typeof CATEGORY
17
+ typeof SEARCH | typeof LANGUAGE | typeof TYPE | typeof CATEGORY
21
18
 
22
19
  /**
23
20
  * Read the current value of the given search query parameter