@prozilla-os/media-viewer 1.1.16 → 1.1.18

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 Sieben De Beule
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Sieben De Beule
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
package/README.md CHANGED
@@ -1,79 +1,79 @@
1
- <div align="center">
2
- <br />
3
- <p>
4
- <a href="https://os.prozilla.dev/"><img src="https://os.prozilla.dev/assets/logo.svg?v=2" height="200" alt="ProzillaOS" /></a>
5
- </p>
6
- <p>
7
- <a href="https://github.com/prozilla-os/ProzillaOS/blob/main/LICENSE.md"><img alt="License" src="https://img.shields.io/github/license/Prozilla/ProzillaOS?style=flat-square&color=FF4D5B&label=License"></a>
8
- <a href="https://github.com/prozilla-os/ProzillaOS"><img alt="Stars" src="https://img.shields.io/github/stars/Prozilla/ProzillaOS?style=flat-square&color=FED24C&label=%E2%AD%90"></a>
9
- <a href="https://github.com/prozilla-os/ProzillaOS"><img alt="Forks" src="https://img.shields.io/github/forks/Prozilla/ProzillaOS?style=flat-square&color=4D9CFF&label=Forks&logo=github"></a>
10
- <a href="https://www.npmjs.com/package/prozilla-os"><img alt="NPM Version" src="https://img.shields.io/npm/v/prozilla-os?logo=npm&style=flat-square&label=prozilla-os&color=FF4D5B"></a>
11
- </p>
12
- </div>
13
-
14
- ## About
15
-
16
- `@prozilla-os/media-viewer` is a ProzillaOS application for viewing different kinds of media.
17
-
18
- ## Installation
19
-
20
- `@prozilla-os/core` is required to run this application.
21
-
22
- ```sh
23
- npm install @prozilla-os/core @prozilla-os/media-viewer
24
- yarn add @prozilla-os/core @prozilla-os/media-viewer
25
- pnpm add @prozilla-os/core @prozilla-os/media-viewer
26
- ```
27
-
28
- ## Usage
29
-
30
- ### Basic setup
31
-
32
- ```tsx
33
- import { Desktop, ModalsView, ProzillaOS, Taskbar, WindowsView, AppsConfig } from "@prozilla-os/core";
34
- import { mediaViewer } from "@prozilla-os/media-viewer";
35
-
36
- function App() {
37
- return (
38
- <ProzillaOS
39
- systemName="Example"
40
- tagLine="Powered by ProzillaOS"
41
- config={{
42
- apps: new AppsConfig({
43
- apps: [ mediaViewer ]
44
- })
45
- }}
46
- >
47
- <Taskbar/>
48
- <WindowsView/>
49
- <ModalsView/>
50
- <Desktop/>
51
- </ProzillaOS>
52
- );
53
- }
54
- ```
55
-
56
- ### Window options
57
-
58
- ```tsx
59
- /**
60
- * A virtual file containing media to open
61
- */
62
- file: VirtualFile;
63
- ```
64
-
65
- ## Links
66
-
67
- - [Demo][demo]
68
- - [Docs][docs]
69
- - [GitHub][github]
70
- - [npm][npm]
71
- - [Discord][discord]
72
- - [Ko-fi][ko-fi]
73
-
74
- [demo]: https://os.prozilla.dev/media-viewer
75
- [docs]: https://os.prozilla.dev/docs/reference/apps/media-viewer
76
- [github]: https://github.com/prozilla-os/ProzillaOS/tree/main/packages/apps/media-viewer
77
- [npm]: https://www.npmjs.com/package/@prozilla-os/media-viewer
78
- [discord]: https://discord.gg/JwbyQP4tdz
79
- [ko-fi]: https://ko-fi.com/prozilla
1
+ <div align="center">
2
+ <br />
3
+ <p>
4
+ <a href="https://os.prozilla.dev/"><img src="https://os.prozilla.dev/assets/logo.svg?v=2" height="200" alt="ProzillaOS" /></a>
5
+ </p>
6
+ <p>
7
+ <a href="https://github.com/prozilla-os/ProzillaOS/blob/main/LICENSE.md"><img alt="License" src="https://img.shields.io/github/license/Prozilla/ProzillaOS?style=flat-square&color=FF4D5B&label=License"></a>
8
+ <a href="https://github.com/prozilla-os/ProzillaOS"><img alt="Stars" src="https://img.shields.io/github/stars/Prozilla/ProzillaOS?style=flat-square&color=FED24C&label=%E2%AD%90"></a>
9
+ <a href="https://github.com/prozilla-os/ProzillaOS"><img alt="Forks" src="https://img.shields.io/github/forks/Prozilla/ProzillaOS?style=flat-square&color=4D9CFF&label=Forks&logo=github"></a>
10
+ <a href="https://www.npmjs.com/package/prozilla-os"><img alt="NPM Version" src="https://img.shields.io/npm/v/prozilla-os?logo=npm&style=flat-square&label=prozilla-os&color=FF4D5B"></a>
11
+ </p>
12
+ </div>
13
+
14
+ ## About
15
+
16
+ `@prozilla-os/media-viewer` is a ProzillaOS application for viewing different kinds of media.
17
+
18
+ ## Installation
19
+
20
+ `@prozilla-os/core` is required to run this application.
21
+
22
+ ```sh
23
+ npm install @prozilla-os/core @prozilla-os/media-viewer
24
+ yarn add @prozilla-os/core @prozilla-os/media-viewer
25
+ pnpm add @prozilla-os/core @prozilla-os/media-viewer
26
+ ```
27
+
28
+ ## Usage
29
+
30
+ ### Basic setup
31
+
32
+ ```tsx
33
+ import { Desktop, ModalsView, ProzillaOS, Taskbar, WindowsView, AppsConfig } from "@prozilla-os/core";
34
+ import { mediaViewer } from "@prozilla-os/media-viewer";
35
+
36
+ function App() {
37
+ return (
38
+ <ProzillaOS
39
+ systemName="Example"
40
+ tagLine="Powered by ProzillaOS"
41
+ config={{
42
+ apps: new AppsConfig({
43
+ apps: [ mediaViewer ]
44
+ })
45
+ }}
46
+ >
47
+ <Taskbar/>
48
+ <WindowsView/>
49
+ <ModalsView/>
50
+ <Desktop/>
51
+ </ProzillaOS>
52
+ );
53
+ }
54
+ ```
55
+
56
+ ### Window options
57
+
58
+ ```tsx
59
+ /**
60
+ * A virtual file containing media to open
61
+ */
62
+ file: VirtualFile;
63
+ ```
64
+
65
+ ## Links
66
+
67
+ - [Demo][demo]
68
+ - [Docs][docs]
69
+ - [GitHub][github]
70
+ - [npm][npm]
71
+ - [Discord][discord]
72
+ - [Ko-fi][ko-fi]
73
+
74
+ [demo]: https://os.prozilla.dev/media-viewer
75
+ [docs]: https://os.prozilla.dev/docs/reference/apps/media-viewer
76
+ [github]: https://github.com/prozilla-os/ProzillaOS/tree/main/packages/apps/media-viewer
77
+ [npm]: https://www.npmjs.com/package/@prozilla-os/media-viewer
78
+ [discord]: https://discord.gg/JwbyQP4tdz
79
+ [ko-fi]: https://ko-fi.com/prozilla
package/dist/main.js CHANGED
@@ -1,26 +1,47 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("._MediaViewer_1u5j4_1{display:flex;justify-content:center;align-items:center;width:100%;height:100%;padding:2rem}._MediaViewer_1u5j4_1 img{width:100%;height:100%;object-fit:contain}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
- import { useSystemManager as p, useWindowsManager as l, AppsConfig as s, IMAGE_EXTENSIONS as t, App as u } from "@prozilla-os/core";
3
- import { jsx as r } from "react/jsx-runtime";
4
- import { useEffect as m } from "react";
5
- const c = "_MediaViewer_1u5j4_1", f = {
6
- MediaViewer: c
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("._MediaViewer_vkowo_1{display:flex;justify-content:center;align-items:center;width:100%;height:100%;padding:2rem}._MediaViewer_vkowo_1 img{width:100%;height:100%;object-fit:contain}._VideoViewer_vkowo_16,._AudioViewer_vkowo_16{display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:100%}._VideoViewer_vkowo_16 h3{margin:0}._VideoViewer_vkowo_16>*{width:100%;height:100%;border:none;background:transparent}")),document.head.appendChild(e)}}catch(i){console.error("vite-plugin-css-injected-by-js",i)}})();
2
+ import { useSystemManager as x, useWindowsManager as E, AUDIO_EXTENSIONS as a, VIDEO_EXTENSIONS as d, AppsConfig as m, MEDIA_EXTENSIONS as V, IMAGE_EXTENSIONS as _, App as h } from "@prozilla-os/core";
3
+ import { jsx as r, jsxs as l } from "react/jsx-runtime";
4
+ import { useRef as p, useEffect as w } from "react";
5
+ const y = "_MediaViewer_vkowo_1", A = "_VideoViewer_vkowo_16", N = "_AudioViewer_vkowo_16", n = {
6
+ MediaViewer: y,
7
+ VideoViewer: A,
8
+ AudioViewer: N
7
9
  };
8
- function w({ file: e, close: o, setTitle: i }) {
9
- const { appsConfig: d } = p(), a = l();
10
- if (m(() => {
11
- e != null && (i == null || i(e.id));
12
- }, [e, i]), e == null) {
13
- const n = d.getAppByRole(s.APP_ROLES.fileExplorer);
14
- setTimeout(() => {
15
- n != null && (a == null || a.open(n.id, { path: "~/Pictures" })), o == null || o();
16
- }, 10);
17
- return;
10
+ function g({ file: e, close: t, setTitle: s }) {
11
+ const { appsConfig: v } = x(), u = E(), o = p(null), i = p(null);
12
+ if (w(() => {
13
+ e != null && (s == null || s(e.id));
14
+ }, [e, s]), w(() => {
15
+ if (!(e == null || e.source == null))
16
+ return e.extension && a.includes(e.extension) && o.current && (o.current.src = e.source, o.current.play()), e.extension && d.includes(e.extension) && i.current && (i.current.src = e.source, i.current.play()), () => {
17
+ o.current && (o.current.pause(), o.current.currentTime = 0), i.current && (i.current.pause(), i.current.currentTime = 0);
18
+ };
19
+ }, [e]), e == null) {
20
+ const c = v.getAppByRole(m.APP_ROLES.fileExplorer);
21
+ return setTimeout(() => {
22
+ c != null && (u == null || u.open(c.id, { path: "~/Pictures" })), t == null || t();
23
+ }, 10), null;
18
24
  }
19
- return e.extension == null || !t.includes(e.extension) ? /* @__PURE__ */ r("p", { children: "Invalid file format." }) : e.source == null ? /* @__PURE__ */ r("p", { children: "File failed to load." }) : /* @__PURE__ */ r("div", { className: f.MediaViewer, children: /* @__PURE__ */ r("img", { src: e.source, alt: e.id, draggable: "false" }) });
25
+ return e.extension == null || !V.includes(e.extension) ? /* @__PURE__ */ r("p", { children: "Invalid file format." }) : e.source == null ? /* @__PURE__ */ r("p", { children: "File failed to load." }) : _.includes(e.extension) ? /* @__PURE__ */ r("div", { className: n.MediaViewer, children: /* @__PURE__ */ r("img", { src: e.source, alt: e.id, draggable: "false" }) }) : a.includes(e.extension) ? /* @__PURE__ */ r("div", { className: n.AudioViewer, children: /* @__PURE__ */ l("audio", { ref: o, controls: !0, children: [
26
+ /* @__PURE__ */ r("source", { src: e.source, type: `video/${e.extension}` }),
27
+ "Your browser does not support audio."
28
+ ] }) }) : d.includes(e.extension) ? e.extension === "yt" ? /* @__PURE__ */ r("div", { className: n.VideoViewer, children: /* @__PURE__ */ r(
29
+ "iframe",
30
+ {
31
+ src: e.source.replace("watch?v=", "embed/"),
32
+ title: e.id,
33
+ allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
34
+ allowFullScreen: !0,
35
+ allowTransparency: !0
36
+ }
37
+ ) }) : /* @__PURE__ */ r("div", { className: n.VideoViewer, children: /* @__PURE__ */ l("video", { ref: i, controls: !0, className: n.VideoPlayer, children: [
38
+ /* @__PURE__ */ r("source", { src: e.source, type: `video/${e.extension}` }),
39
+ "Your browser does not support videos."
40
+ ] }) }) : /* @__PURE__ */ r("div", { className: n.MediaViewer, children: /* @__PURE__ */ r("img", { src: e.source, alt: e.id, draggable: "false" }) });
20
41
  }
21
- const g = new u("Media Viewer", "media-viewer", w).setIconUrl("https://os.prozilla.dev/assets/apps/icons/media-viewer.svg").setRole(s.APP_ROLES.mediaViewer).setAssociatedExtensions(t).setCategory("Photo & video");
22
- g.setMetadata({ name: "@prozilla-os/media-viewer", version: "1.1.15", author: "Prozilla" });
42
+ const S = new h("Media Viewer", "media-viewer", g).setIconUrl("https://os.prozilla.dev/assets/apps/icons/media-viewer.svg").setRole(m.APP_ROLES.mediaViewer).setAssociatedExtensions(V).setCategory("Photo & video");
43
+ S.setMetadata({ name: "@prozilla-os/media-viewer", version: "1.1.17", author: "Prozilla" });
23
44
  export {
24
- g as mediaViewer
45
+ S as mediaViewer
25
46
  };
26
47
  //# sourceMappingURL=main.js.map
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sources":["../src/components/MediaViewer.tsx","../src/main.ts"],"sourcesContent":["import { useEffect } from \"react\";\nimport styles from \"./MediaViewer.module.css\";\nimport { AppsConfig, IMAGE_EXTENSIONS, useSystemManager, useWindowsManager, VirtualFile, WindowProps } from \"@prozilla-os/core\";\n\nexport interface MediaViewerProps extends WindowProps {\n\tfile?: VirtualFile;\n}\n\nexport function MediaViewer({ file, close, setTitle }: MediaViewerProps) {\n\tconst { appsConfig } = useSystemManager();\n\tconst windowsManager = useWindowsManager();\n\n\tuseEffect(() => {\n\t\tif (file != null) setTitle?.(file.id);\n\t}, [file, setTitle]);\n\n\tif (file == null) {\n\t\tconst fileExplorerApp = appsConfig.getAppByRole(AppsConfig.APP_ROLES.fileExplorer);\n\n\t\tsetTimeout(() => {\n\t\t\tif (fileExplorerApp != null)\n\t\t\t\twindowsManager?.open(fileExplorerApp.id, { path: \"~/Pictures\" });\n\t\t\tclose?.();\n\t\t}, 10);\n\t\treturn;\n\t}\n\n\tif (file.extension == null || !IMAGE_EXTENSIONS.includes(file.extension)) return <p>Invalid file format.</p>;\n\n\tif (file.source == null) return <p>File failed to load.</p>;\n\n\treturn <div className={styles.MediaViewer}>\n\t\t<img src={file.source} alt={file.id} draggable=\"false\"/>\n\t</div>;\n}","import { App, AppsConfig, IMAGE_EXTENSIONS } from \"@prozilla-os/core\";\nimport { MediaViewer, MediaViewerProps } from \"./components/MediaViewer\";\n\nconst mediaViewer = new App<MediaViewerProps>(\"Media Viewer\", \"media-viewer\", MediaViewer)\n\t.setIconUrl(\"https://os.prozilla.dev/assets/apps/icons/media-viewer.svg\")\n\t.setRole(AppsConfig.APP_ROLES.mediaViewer)\n\t.setAssociatedExtensions(IMAGE_EXTENSIONS)\n\t.setCategory(\"Photo & video\");\nmediaViewer.setMetadata({ name: \"@prozilla-os/media-viewer\", version: \"1.1.15\", author: \"Prozilla\" });\n\n\nexport { mediaViewer };"],"names":["MediaViewer","file","close","setTitle","appsConfig","useSystemManager","windowsManager","useWindowsManager","useEffect","fileExplorerApp","AppsConfig","IMAGE_EXTENSIONS","jsx","styles","mediaViewer","App"],"mappings":";;;;;;AAQO,SAASA,EAAY,EAAE,MAAAC,GAAM,OAAAC,GAAO,UAAAC,KAA8B;AAClE,QAAA,EAAE,YAAAC,MAAeC,KACjBC,IAAiBC;AAMvB,MAJAC,EAAU,MAAM;AACf,IAAIP,KAAQ,SAAiBE,KAAA,QAAAA,EAAAF,EAAK;AAAA,EAAE,GAClC,CAACA,GAAME,CAAQ,CAAC,GAEfF,KAAQ,MAAM;AACjB,UAAMQ,IAAkBL,EAAW,aAAaM,EAAW,UAAU,YAAY;AAEjF,eAAW,MAAM;AAChB,MAAID,KAAmB,SACtBH,KAAA,QAAAA,EAAgB,KAAKG,EAAgB,IAAI,EAAE,MAAM,kBAC1CP,KAAA,QAAAA;AAAA,OACN,EAAE;AACL;AAAA,EACD;AAEA,SAAID,EAAK,aAAa,QAAQ,CAACU,EAAiB,SAASV,EAAK,SAAS,IAAW,gBAAAW,EAAA,KAAA,EAAE,UAAoB,uBAAA,CAAA,IAEpGX,EAAK,UAAU,OAAa,gBAAAW,EAAC,OAAE,UAAoB,uBAAA,CAAA,IAE/C,gBAAAA,EAAA,OAAA,EAAI,WAAWC,EAAO,aAC7B,UAAC,gBAAAD,EAAA,OAAA,EAAI,KAAKX,EAAK,QAAQ,KAAKA,EAAK,IAAI,WAAU,SAAO,EACvD,CAAA;AACD;AC/BA,MAAMa,IAAc,IAAIC,EAAsB,gBAAgB,gBAAgBf,CAAW,EACvF,WAAW,4DAA4D,EACvE,QAAQU,EAAW,UAAU,WAAW,EACxC,wBAAwBC,CAAgB,EACxC,YAAY,eAAe;AAC7BG,EAAY,YAAY,EAAE,MAAM,6BAA6B,SAAS,UAAU,QAAQ,YAAY;"}
1
+ {"version":3,"file":"main.js","sources":["../src/components/MediaViewer.tsx","../src/main.ts"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport styles from \"./MediaViewer.module.css\";\nimport { AppsConfig, IMAGE_EXTENSIONS, VIDEO_EXTENSIONS, AUDIO_EXTENSIONS, useSystemManager, useWindowsManager, VirtualFile, WindowProps, MEDIA_EXTENSIONS } from \"@prozilla-os/core\";\n\nexport interface MediaViewerProps extends WindowProps {\n\tfile?: VirtualFile;\n}\n\nexport function MediaViewer({ file, close, setTitle }: MediaViewerProps) {\n\tconst { appsConfig } = useSystemManager();\n\tconst windowsManager = useWindowsManager();\n\tconst audioRef = useRef<HTMLAudioElement | null>(null);\n\tconst videoRef = useRef<HTMLVideoElement | null>(null);\n\n\tuseEffect(() => {\n\t\tif (file != null)\n\t\t\tsetTitle?.(file.id);\n\t}, [file, setTitle]);\n\n\tuseEffect(() => {\n\t\tif (file == null || file.source == null)\n\t\t\treturn;\n\n\t\tif (file.extension && AUDIO_EXTENSIONS.includes(file.extension)) {\n\t\t\tif (audioRef.current) {\n\t\t\t\taudioRef.current.src = file.source;\n\t\t\t\tvoid audioRef.current.play();\n\t\t\t}\n\t\t}\n\n\t\tif (file.extension && VIDEO_EXTENSIONS.includes(file.extension)) {\n\t\t\tif (videoRef.current) {\n\t\t\t\tvideoRef.current.src = file.source;\n\t\t\t\tvoid videoRef.current.play();\n\t\t\t}\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (audioRef.current) {\n\t\t\t\taudioRef.current.pause();\n\t\t\t\taudioRef.current.currentTime = 0;\n\t\t\t}\n\t\t\tif (videoRef.current) {\n\t\t\t\tvideoRef.current.pause();\n\t\t\t\tvideoRef.current.currentTime = 0;\n\t\t\t}\n\t\t};\n\t}, [file]);\n\n\tif (file == null) {\n\t\tconst fileExplorerApp = appsConfig.getAppByRole(AppsConfig.APP_ROLES.fileExplorer);\n\n\t\tsetTimeout(() => {\n\t\t\tif (fileExplorerApp != null)\n\t\t\t\twindowsManager?.open(fileExplorerApp.id, { path: \"~/Pictures\" });\n\t\t\tclose?.();\n\t\t}, 10);\n\t\treturn null;\n\t}\n\n\tif (file.extension == null || !MEDIA_EXTENSIONS.includes(file.extension)) {\n\t\treturn <p>Invalid file format.</p>;\n\t}\n\n\tif (file.source == null)\n\t\treturn <p>File failed to load.</p>;\n\n\tif (IMAGE_EXTENSIONS.includes(file.extension)) {\n\t\treturn <div className={styles.MediaViewer}>\n\t\t\t<img src={file.source} alt={file.id} draggable=\"false\" />\n\t\t</div>;\n\t} else if (AUDIO_EXTENSIONS.includes(file.extension)) {\n\t\treturn <div className={styles.AudioViewer}>\n\t\t\t<audio ref={audioRef} controls>\n\t\t\t\t<source src={file.source} type={`video/${file.extension}`}/>\n\t\t\t\tYour browser does not support audio.\n\t\t\t</audio> \n\t\t</div>;\n\t} else if (VIDEO_EXTENSIONS.includes(file.extension)) {\n\t\tif (file.extension === \"yt\") {\n\t\t\treturn <div className={styles.VideoViewer}>\n\t\t\t\t<iframe\n\t\t\t\t\tsrc={file.source.replace(\"watch?v=\", \"embed/\")}\n\t\t\t\t\ttitle={file.id}\n\t\t\t\t\tallow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\"\n\t\t\t\t\tallowFullScreen\n\t\t\t\t\tallowTransparency={true}\n\t\t\t\t/>\n\t\t\t</div>;\n\t\t} else {\n\t\t\treturn <div className={styles.VideoViewer}>\n\t\t\t\t<video ref={videoRef} controls className={styles.VideoPlayer}>\n\t\t\t\t\t<source src={file.source} type={`video/${file.extension}`} />\n\t\t\t\t\tYour browser does not support videos.\n\t\t\t\t</video>\n\t\t\t</div>;\n\t\t}\n\t}\n\n\treturn <div className={styles.MediaViewer}>\n\t\t<img src={file.source} alt={file.id} draggable=\"false\"/>\n\t</div>;\n}","import { App, AppsConfig, MEDIA_EXTENSIONS } from \"@prozilla-os/core\";\nimport { MediaViewer, MediaViewerProps } from \"./components/MediaViewer\";\n\nconst mediaViewer = new App<MediaViewerProps>(\"Media Viewer\", \"media-viewer\", MediaViewer)\n\t.setIconUrl(\"https://os.prozilla.dev/assets/apps/icons/media-viewer.svg\")\n\t.setRole(AppsConfig.APP_ROLES.mediaViewer)\n\t.setAssociatedExtensions(MEDIA_EXTENSIONS)\n\t.setCategory(\"Photo & video\");\nmediaViewer.setMetadata({ name: \"@prozilla-os/media-viewer\", version: \"1.1.17\", author: \"Prozilla\" });\n\n\nexport { mediaViewer };"],"names":["MediaViewer","file","close","setTitle","appsConfig","useSystemManager","windowsManager","useWindowsManager","audioRef","useRef","videoRef","useEffect","AUDIO_EXTENSIONS","VIDEO_EXTENSIONS","fileExplorerApp","AppsConfig","MEDIA_EXTENSIONS","jsx","IMAGE_EXTENSIONS","styles","jsxs","mediaViewer","App"],"mappings":"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"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prozilla-os/media-viewer",
3
3
  "description": "A ProzillaOS application for viewing different kinds of media.",
4
- "version": "1.1.16",
4
+ "version": "1.1.18",
5
5
  "homepage": "https://os.prozilla.dev/media-viewer",
6
6
  "author": {
7
7
  "name": "Prozilla",
@@ -20,7 +20,7 @@
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
22
  "react": "^18.3.1",
23
- "@prozilla-os/core": "1.3.11"
23
+ "@prozilla-os/core": "1.3.13"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "^20.14.5",
@@ -30,7 +30,7 @@
30
30
  "vite": "^5.4.8",
31
31
  "vite-plugin-dts": "^3.9.1",
32
32
  "vite-plugin-lib-inject-css": "^2.1.1",
33
- "@prozilla-os/dev-tools": "1.1.8"
33
+ "@prozilla-os/dev-tools": "1.1.10"
34
34
  },
35
35
  "files": [
36
36
  "dist"