@medialane/ui 0.125.0 → 0.125.2
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/dist/utils/ipfs.cjs +8 -1
- package/dist/utils/ipfs.cjs.map +1 -1
- package/dist/utils/ipfs.js +8 -1
- package/dist/utils/ipfs.js.map +1 -1
- package/package.json +1 -1
package/dist/utils/ipfs.cjs
CHANGED
|
@@ -21,19 +21,26 @@ __export(ipfs_exports, {
|
|
|
21
21
|
ipfsToHttp: () => ipfsToHttp
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(ipfs_exports);
|
|
24
|
-
const
|
|
24
|
+
const MEDIA_BASE_URL = "https://medialane-backend-production.up.railway.app";
|
|
25
|
+
const DEFAULT_GATEWAY = `${MEDIA_BASE_URL}/media/ipfs/`;
|
|
25
26
|
const ALLOWED_PROTOCOLS = /* @__PURE__ */ new Set(["http:", "https:", "ipfs:"]);
|
|
26
27
|
function ipfsToHttp(uri, gateway = DEFAULT_GATEWAY) {
|
|
27
28
|
if (!uri) return "";
|
|
28
29
|
if (uri.startsWith("ipfs://")) {
|
|
29
30
|
return uri.replace("ipfs://", gateway);
|
|
30
31
|
}
|
|
32
|
+
if (uri.startsWith(MEDIA_BASE_URL)) {
|
|
33
|
+
return uri;
|
|
34
|
+
}
|
|
31
35
|
try {
|
|
32
36
|
const { protocol } = new URL(uri);
|
|
33
37
|
if (!ALLOWED_PROTOCOLS.has(protocol)) return "";
|
|
34
38
|
} catch {
|
|
35
39
|
return "";
|
|
36
40
|
}
|
|
41
|
+
if (uri.startsWith("https://") || uri.startsWith("http://")) {
|
|
42
|
+
return `${MEDIA_BASE_URL}/media/external?url=${encodeURIComponent(uri)}`;
|
|
43
|
+
}
|
|
37
44
|
return uri;
|
|
38
45
|
}
|
|
39
46
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/utils/ipfs.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/ipfs.ts"],"sourcesContent":["const
|
|
1
|
+
{"version":3,"sources":["../../src/utils/ipfs.ts"],"sourcesContent":["const MEDIA_BASE_URL = \"https://medialane-backend-production.up.railway.app\";\nconst DEFAULT_GATEWAY = `${MEDIA_BASE_URL}/media/ipfs/`;\n\nconst ALLOWED_PROTOCOLS = new Set([\"http:\", \"https:\", \"ipfs:\"]);\n\nexport function ipfsToHttp(\n uri: string | null | undefined,\n gateway = DEFAULT_GATEWAY\n): string {\n if (!uri) return \"\";\n if (uri.startsWith(\"ipfs://\")) {\n return uri.replace(\"ipfs://\", gateway);\n }\n if (uri.startsWith(MEDIA_BASE_URL)) {\n return uri;\n }\n try {\n const { protocol } = new URL(uri);\n if (!ALLOWED_PROTOCOLS.has(protocol)) return \"\";\n } catch {\n return \"\";\n }\n if (uri.startsWith(\"https://\") || uri.startsWith(\"http://\")) {\n return `${MEDIA_BASE_URL}/media/external?url=${encodeURIComponent(uri)}`;\n }\n return uri;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAAM,iBAAiB;AACvB,MAAM,kBAAkB,GAAG,cAAc;AAEzC,MAAM,oBAAoB,oBAAI,IAAI,CAAC,SAAS,UAAU,OAAO,CAAC;AAEvD,SAAS,WACd,KACA,UAAU,iBACF;AACR,MAAI,CAAC,IAAK,QAAO;AACjB,MAAI,IAAI,WAAW,SAAS,GAAG;AAC7B,WAAO,IAAI,QAAQ,WAAW,OAAO;AAAA,EACvC;AACA,MAAI,IAAI,WAAW,cAAc,GAAG;AAClC,WAAO;AAAA,EACT;AACA,MAAI;AACF,UAAM,EAAE,SAAS,IAAI,IAAI,IAAI,GAAG;AAChC,QAAI,CAAC,kBAAkB,IAAI,QAAQ,EAAG,QAAO;AAAA,EAC/C,QAAQ;AACN,WAAO;AAAA,EACT;AACA,MAAI,IAAI,WAAW,UAAU,KAAK,IAAI,WAAW,SAAS,GAAG;AAC3D,WAAO,GAAG,cAAc,uBAAuB,mBAAmB,GAAG,CAAC;AAAA,EACxE;AACA,SAAO;AACT;","names":[]}
|
package/dist/utils/ipfs.js
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
const
|
|
1
|
+
const MEDIA_BASE_URL = "https://medialane-backend-production.up.railway.app";
|
|
2
|
+
const DEFAULT_GATEWAY = `${MEDIA_BASE_URL}/media/ipfs/`;
|
|
2
3
|
const ALLOWED_PROTOCOLS = /* @__PURE__ */ new Set(["http:", "https:", "ipfs:"]);
|
|
3
4
|
function ipfsToHttp(uri, gateway = DEFAULT_GATEWAY) {
|
|
4
5
|
if (!uri) return "";
|
|
5
6
|
if (uri.startsWith("ipfs://")) {
|
|
6
7
|
return uri.replace("ipfs://", gateway);
|
|
7
8
|
}
|
|
9
|
+
if (uri.startsWith(MEDIA_BASE_URL)) {
|
|
10
|
+
return uri;
|
|
11
|
+
}
|
|
8
12
|
try {
|
|
9
13
|
const { protocol } = new URL(uri);
|
|
10
14
|
if (!ALLOWED_PROTOCOLS.has(protocol)) return "";
|
|
11
15
|
} catch {
|
|
12
16
|
return "";
|
|
13
17
|
}
|
|
18
|
+
if (uri.startsWith("https://") || uri.startsWith("http://")) {
|
|
19
|
+
return `${MEDIA_BASE_URL}/media/external?url=${encodeURIComponent(uri)}`;
|
|
20
|
+
}
|
|
14
21
|
return uri;
|
|
15
22
|
}
|
|
16
23
|
export {
|
package/dist/utils/ipfs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/ipfs.ts"],"sourcesContent":["const
|
|
1
|
+
{"version":3,"sources":["../../src/utils/ipfs.ts"],"sourcesContent":["const MEDIA_BASE_URL = \"https://medialane-backend-production.up.railway.app\";\nconst DEFAULT_GATEWAY = `${MEDIA_BASE_URL}/media/ipfs/`;\n\nconst ALLOWED_PROTOCOLS = new Set([\"http:\", \"https:\", \"ipfs:\"]);\n\nexport function ipfsToHttp(\n uri: string | null | undefined,\n gateway = DEFAULT_GATEWAY\n): string {\n if (!uri) return \"\";\n if (uri.startsWith(\"ipfs://\")) {\n return uri.replace(\"ipfs://\", gateway);\n }\n if (uri.startsWith(MEDIA_BASE_URL)) {\n return uri;\n }\n try {\n const { protocol } = new URL(uri);\n if (!ALLOWED_PROTOCOLS.has(protocol)) return \"\";\n } catch {\n return \"\";\n }\n if (uri.startsWith(\"https://\") || uri.startsWith(\"http://\")) {\n return `${MEDIA_BASE_URL}/media/external?url=${encodeURIComponent(uri)}`;\n }\n return uri;\n}\n"],"mappings":"AAAA,MAAM,iBAAiB;AACvB,MAAM,kBAAkB,GAAG,cAAc;AAEzC,MAAM,oBAAoB,oBAAI,IAAI,CAAC,SAAS,UAAU,OAAO,CAAC;AAEvD,SAAS,WACd,KACA,UAAU,iBACF;AACR,MAAI,CAAC,IAAK,QAAO;AACjB,MAAI,IAAI,WAAW,SAAS,GAAG;AAC7B,WAAO,IAAI,QAAQ,WAAW,OAAO;AAAA,EACvC;AACA,MAAI,IAAI,WAAW,cAAc,GAAG;AAClC,WAAO;AAAA,EACT;AACA,MAAI;AACF,UAAM,EAAE,SAAS,IAAI,IAAI,IAAI,GAAG;AAChC,QAAI,CAAC,kBAAkB,IAAI,QAAQ,EAAG,QAAO;AAAA,EAC/C,QAAQ;AACN,WAAO;AAAA,EACT;AACA,MAAI,IAAI,WAAW,UAAU,KAAK,IAAI,WAAW,SAAS,GAAG;AAC3D,WAAO,GAAG,cAAc,uBAAuB,mBAAmB,GAAG,CAAC;AAAA,EACxE;AACA,SAAO;AACT;","names":[]}
|