key-screen-framework 1.2.0 → 1.2.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/main/index.js CHANGED
@@ -1083,6 +1083,29 @@ const MEDIA_EXTENSION_BY_TYPE = {
1083
1083
  audio: /* @__PURE__ */ new Set([".aac", ".flac", ".m4a", ".mp3", ".oga", ".ogg", ".wav", ".weba"]),
1084
1084
  font: /* @__PURE__ */ new Set([".otf", ".ttf", ".woff", ".woff2"])
1085
1085
  };
1086
+ function getMediaContentType(fileName) {
1087
+ const extension = extname(fileName).toLowerCase();
1088
+ if (extension === ".mp4" || extension === ".m4v") return "video/mp4";
1089
+ if (extension === ".mov") return "video/quicktime";
1090
+ if (extension === ".webm") return "video/webm";
1091
+ if (extension === ".ogg" || extension === ".ogv") return "video/ogg";
1092
+ if (extension === ".mp3") return "audio/mpeg";
1093
+ if (extension === ".wav") return "audio/wav";
1094
+ if (extension === ".m4a") return "audio/mp4";
1095
+ if (extension === ".aac") return "audio/aac";
1096
+ if (extension === ".flac") return "audio/flac";
1097
+ if (extension === ".png") return "image/png";
1098
+ if (extension === ".jpg" || extension === ".jpeg") return "image/jpeg";
1099
+ if (extension === ".webp") return "image/webp";
1100
+ if (extension === ".gif") return "image/gif";
1101
+ if (extension === ".avif") return "image/avif";
1102
+ if (extension === ".svg") return "image/svg+xml";
1103
+ if (extension === ".woff2") return "font/woff2";
1104
+ if (extension === ".woff") return "font/woff";
1105
+ if (extension === ".ttf") return "font/ttf";
1106
+ if (extension === ".otf") return "font/otf";
1107
+ return "application/octet-stream";
1108
+ }
1086
1109
  function assertMediaType(type) {
1087
1110
  if (!MEDIA_TYPES.includes(type)) {
1088
1111
  throw new Error(`Unsupported media type: ${type}`);
@@ -1566,28 +1589,6 @@ function startKeyScreenMain(options) {
1566
1589
  const name = decodeURIComponent(url.pathname.replace(/^\/+/, ""));
1567
1590
  return { type, name };
1568
1591
  }
1569
- function getMediaContentType(fileName) {
1570
- const extension = extname(fileName).toLowerCase();
1571
- if (extension === ".mp4" || extension === ".m4v") return "video/mp4";
1572
- if (extension === ".mov") return "video/quicktime";
1573
- if (extension === ".webm") return "video/webm";
1574
- if (extension === ".ogg" || extension === ".ogv") return "video/ogg";
1575
- if (extension === ".mp3") return "audio/mpeg";
1576
- if (extension === ".wav") return "audio/wav";
1577
- if (extension === ".m4a") return "audio/mp4";
1578
- if (extension === ".aac") return "audio/aac";
1579
- if (extension === ".flac") return "audio/flac";
1580
- if (extension === ".png") return "image/png";
1581
- if (extension === ".jpg" || extension === ".jpeg") return "image/jpeg";
1582
- if (extension === ".webp") return "image/webp";
1583
- if (extension === ".gif") return "image/gif";
1584
- if (extension === ".avif") return "image/avif";
1585
- if (extension === ".woff2") return "font/woff2";
1586
- if (extension === ".woff") return "font/woff";
1587
- if (extension === ".ttf") return "font/ttf";
1588
- if (extension === ".otf") return "font/otf";
1589
- return "application/octet-stream";
1590
- }
1591
1592
  async function createMediaProtocolResponse(mediaManager, request) {
1592
1593
  const ref = parseMediaProtocolUrl(request.url);
1593
1594
  const filePath = mediaManager.resolveMediaPath(ref);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "key-screen-framework",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Screen framework for Keyescape desktop projects.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,4 +1,5 @@
1
1
  import type { MediaLibrary, MediaRef } from '../shared/types.js';
2
+ export declare function getMediaContentType(fileName: string): string;
2
3
  export declare class MediaManager {
3
4
  private readonly rootPath;
4
5
  constructor(rootPath: string);