@vilio/vercel-blob-module 0.0.3 → 0.0.4
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/actions/settings.d.ts +2 -1
- package/dist/actions/settings.d.ts.map +1 -0
- package/dist/actions/settings.js +13 -0
- package/dist/actions/settings.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/pages/settings-page.d.ts +2 -2
- package/dist/pages/settings-page.d.ts.map +1 -0
- package/dist/pages/settings-page.js +37 -0
- package/dist/pages/settings-page.js.map +1 -0
- package/dist/providers/vercel.d.ts +1 -0
- package/dist/providers/vercel.d.ts.map +1 -0
- package/dist/providers/vercel.js +32 -0
- package/dist/providers/vercel.js.map +1 -0
- package/dist/routes.d.ts +1 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +11 -0
- package/dist/routes.js.map +1 -0
- package/locales/pl/global.json +1 -1
- package/package.json +15 -23
- package/dist/actions/settings.cjs +0 -23
- package/dist/actions/settings.mjs +0 -16
- package/dist/index.cjs +0 -54
- package/dist/index.mjs +0 -49
- package/dist/pages/settings-page.cjs +0 -64
- package/dist/pages/settings-page.mjs +0 -57
- package/dist/providers/vercel.cjs +0 -41
- package/dist/providers/vercel.mjs +0 -30
- package/dist/routes.cjs +0 -17
- package/dist/routes.mjs +0 -12
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export interface BlobConfig {
|
|
2
2
|
clientId: string;
|
|
3
3
|
}
|
|
4
|
-
export declare function getBlobConfig(): Promise<
|
|
4
|
+
export declare function getBlobConfig(): Promise<BlobConfig>;
|
|
5
5
|
export declare function updateBlobConfig(config: BlobConfig): Promise<{
|
|
6
6
|
success: boolean;
|
|
7
7
|
}>;
|
|
8
|
+
//# sourceMappingURL=settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/actions/settings.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAsB,aAAa,wBAGlC;AAED,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,UAAU;;GAKxD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
import { getModuleConfig, getVilioPathPrefix, updateModuleConfig, } from "@vilio/modules/server";
|
|
3
|
+
import { revalidatePath } from "next/cache";
|
|
4
|
+
export async function getBlobConfig() {
|
|
5
|
+
const config = await getModuleConfig("vercel-blob-module");
|
|
6
|
+
return config || { clientId: "" };
|
|
7
|
+
}
|
|
8
|
+
export async function updateBlobConfig(config) {
|
|
9
|
+
await updateModuleConfig("vercel-blob-module", config);
|
|
10
|
+
revalidatePath(`${getVilioPathPrefix()}/settings/vercel-blob`);
|
|
11
|
+
return { success: true };
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/actions/settings.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAM5C,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,MAAM,MAAM,GAAG,MAAM,eAAe,CAAa,oBAAoB,CAAC,CAAC;IACvE,OAAO,MAAM,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;AACpC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,MAAkB;IACvD,MAAM,kBAAkB,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;IACvD,cAAc,CAAC,GAAG,kBAAkB,EAAE,uBAAuB,CAAC,CAAC;IAE/D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC3B,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAQ9C,QAAA,MAAM,gBAAgB,EAAE,OAgDvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { filesystemService } from "@vilio/core/server";
|
|
2
|
+
import { i18n } from "@vilio/intl";
|
|
3
|
+
import localesEn from "../locales/en/global.json" with { type: "json" };
|
|
4
|
+
import localesPl from "../locales/pl/global.json" with { type: "json" };
|
|
5
|
+
import manifest from "../manifest.json";
|
|
6
|
+
import { getBlobConfig } from "./actions/settings";
|
|
7
|
+
import { VercelBlobProvider } from "./providers/vercel";
|
|
8
|
+
import { privateRoutes } from "./routes";
|
|
9
|
+
const vercelBlobModule = {
|
|
10
|
+
manifest,
|
|
11
|
+
translations: {
|
|
12
|
+
en: localesEn,
|
|
13
|
+
pl: localesPl,
|
|
14
|
+
},
|
|
15
|
+
routes: {
|
|
16
|
+
private: privateRoutes,
|
|
17
|
+
},
|
|
18
|
+
navigation: {
|
|
19
|
+
settings: {
|
|
20
|
+
[i18n("Storage")]: [
|
|
21
|
+
{
|
|
22
|
+
id: "vercel-blob-settings",
|
|
23
|
+
title: i18n("Vercel Blob Storage"),
|
|
24
|
+
url: "/settings/vercel-blob",
|
|
25
|
+
icon: "solar:folder-with-files-bold-duotone",
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
onEnable: async () => {
|
|
31
|
+
filesystemService.registerProvider(new VercelBlobProvider());
|
|
32
|
+
const config = await getBlobConfig();
|
|
33
|
+
if (process.env.BLOB_READ_WRITE_TOKEN || config.clientId) {
|
|
34
|
+
filesystemService.setDefaultProvider("vercel-blob");
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
onDisable: async () => {
|
|
38
|
+
filesystemService.setDefaultProvider("local");
|
|
39
|
+
filesystemService.unregisterProvider("vercel-blob");
|
|
40
|
+
},
|
|
41
|
+
init: async () => {
|
|
42
|
+
// This runs on app start. Registry already checks if enabled.
|
|
43
|
+
filesystemService.registerProvider(new VercelBlobProvider());
|
|
44
|
+
const config = await getBlobConfig();
|
|
45
|
+
if (process.env.BLOB_READ_WRITE_TOKEN || config.clientId) {
|
|
46
|
+
filesystemService.setDefaultProvider("vercel-blob");
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
export default vercelBlobModule;
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,OAAO,SAAS,MAAM,2BAA2B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACxE,OAAO,SAAS,MAAM,2BAA2B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACxE,OAAO,QAAQ,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,gBAAgB,GAAY;IAChC,QAAQ;IAER,YAAY,EAAE;QACZ,EAAE,EAAE,SAAS;QACb,EAAE,EAAE,SAAS;KACd;IACD,MAAM,EAAE;QACN,OAAO,EAAE,aAAa;KACvB;IAED,UAAU,EAAE;QACV,QAAQ,EAAE;YACR,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE;gBACjB;oBACE,EAAE,EAAE,sBAAsB;oBAC1B,KAAK,EAAE,IAAI,CAAC,qBAAqB,CAAC;oBAClC,GAAG,EAAE,uBAAuB;oBAC5B,IAAI,EAAE,sCAAsC;iBAC7C;aACF;SACF;KACF;IAED,QAAQ,EAAE,KAAK,IAAI,EAAE;QACnB,iBAAiB,CAAC,gBAAgB,CAAC,IAAI,kBAAkB,EAAE,CAAC,CAAC;QAE7D,MAAM,MAAM,GAAG,MAAM,aAAa,EAAE,CAAC;QAErC,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YACzD,iBAAiB,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;IAED,SAAS,EAAE,KAAK,IAAI,EAAE;QACpB,iBAAiB,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAC9C,iBAAiB,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC;IACtD,CAAC;IAED,IAAI,EAAE,KAAK,IAAI,EAAE;QACf,8DAA8D;QAC9D,iBAAiB,CAAC,gBAAgB,CAAC,IAAI,kBAAkB,EAAE,CAAC,CAAC;QAC7D,MAAM,MAAM,GAAG,MAAM,aAAa,EAAE,CAAC;QAErC,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YACzD,iBAAiB,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;CACF,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export default function BlobSettingsPage(): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
//# sourceMappingURL=settings-page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings-page.d.ts","sourceRoot":"","sources":["../../src/pages/settings-page.tsx"],"names":[],"mappings":"AAqBA,MAAM,CAAC,OAAO,UAAU,gBAAgB,4CAkEvC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useTranslation } from "@vilio/intl";
|
|
4
|
+
import { toast } from "@vilio/ui";
|
|
5
|
+
import { Button } from "@vilio/ui/components/button";
|
|
6
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@vilio/ui/components/card";
|
|
7
|
+
import { Input } from "@vilio/ui/components/input";
|
|
8
|
+
import { Label } from "@vilio/ui/components/label";
|
|
9
|
+
import { useEffect, useState } from "react";
|
|
10
|
+
import { getBlobConfig, updateBlobConfig, } from "../actions/settings";
|
|
11
|
+
export default function BlobSettingsPage() {
|
|
12
|
+
const { t } = useTranslation();
|
|
13
|
+
const [config, setConfig] = useState({
|
|
14
|
+
clientId: "",
|
|
15
|
+
});
|
|
16
|
+
const [loading, setLoading] = useState(true);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
getBlobConfig().then((data) => {
|
|
19
|
+
setConfig(data);
|
|
20
|
+
setLoading(false);
|
|
21
|
+
});
|
|
22
|
+
}, []);
|
|
23
|
+
const handleSave = async (e) => {
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
try {
|
|
26
|
+
await updateBlobConfig(config);
|
|
27
|
+
toast.success(t("Settings saved successfully"));
|
|
28
|
+
}
|
|
29
|
+
catch (_error) {
|
|
30
|
+
toast.error(t("Failed to save settings. Please check your configuration and try again."));
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
if (loading)
|
|
34
|
+
return _jsx("div", { children: t("Vercel Blob loading...") });
|
|
35
|
+
return (_jsx("div", { className: "container mx-auto py-10 max-w-2xl", children: _jsxs(Card, { children: [_jsxs(CardHeader, { children: [_jsx("div", { children: t("Vercel Blob") }), _jsx("div", { children: t("") }), _jsx(CardTitle, { children: t("Vercel Blob Settings") }), _jsx(CardDescription, { children: t("Configure your Vercel Blob credentials. You can find these in the Vercel Dashboard.") })] }), _jsx(CardContent, { children: _jsxs("form", { onSubmit: handleSave, className: "space-y-4", children: [_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "clientId", children: t("Client ID") }), _jsx(Input, { id: "clientId", value: config.clientId, onChange: (e) => setConfig({ ...config, clientId: e.target.value }), placeholder: "vercel_blob_rw_********************************" })] }), _jsx(Button, { type: "submit", className: "w-full", children: t("Save Configuration") })] }) })] }) }));
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=settings-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings-page.js","sourceRoot":"","sources":["../../src/pages/settings-page.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,EACL,IAAI,EACJ,WAAW,EACX,eAAe,EACf,UAAU,EACV,SAAS,GACV,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAEL,aAAa,EACb,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,CAAC,OAAO,UAAU,gBAAgB;IACtC,MAAM,EAAE,CAAC,EAAE,GAAG,cAAc,EAAE,CAAC;IAE/B,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAa;QAC/C,QAAQ,EAAE,EAAE;KACb,CAAC,CAAC;IACH,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAE7C,SAAS,CAAC,GAAG,EAAE;QACb,aAAa,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;YAC5B,SAAS,CAAC,IAAI,CAAC,CAAC;YAChB,UAAU,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,UAAU,GAAG,KAAK,EAAE,CAAkB,EAAE,EAAE;QAC9C,CAAC,CAAC,cAAc,EAAE,CAAC;QACnB,IAAI,CAAC;YACH,MAAM,gBAAgB,CAAC,MAAM,CAAC,CAAC;YAC/B,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,6BAA6B,CAAC,CAAC,CAAC;QAClD,CAAC;QAAC,OAAO,MAAM,EAAE,CAAC;YAChB,KAAK,CAAC,KAAK,CACT,CAAC,CACC,yEAAyE,CAC1E,CACF,CAAC;QACJ,CAAC;IACH,CAAC,CAAC;IAEF,IAAI,OAAO;QAAE,OAAO,wBAAM,CAAC,CAAC,wBAAwB,CAAC,GAAO,CAAC;IAE7D,OAAO,CACL,cAAK,SAAS,EAAC,mCAAmC,YAChD,MAAC,IAAI,eACH,MAAC,UAAU,eACT,wBAAM,CAAC,CAAC,aAAa,CAAC,GAAO,EAC7B,wBAAM,CAAC,CAAC,EAAE,CAAC,GAAO,EAElB,KAAC,SAAS,cAAE,CAAC,CAAC,sBAAsB,CAAC,GAAa,EAClD,KAAC,eAAe,cACb,CAAC,CACA,qFAAqF,CACtF,GACe,IACP,EACb,KAAC,WAAW,cACV,gBAAM,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAC,WAAW,aAC/C,eAAK,SAAS,EAAC,WAAW,aACxB,KAAC,KAAK,IAAC,OAAO,EAAC,UAAU,YAAE,CAAC,CAAC,WAAW,CAAC,GAAS,EAClD,KAAC,KAAK,IACJ,EAAE,EAAC,UAAU,EACb,KAAK,EAAE,MAAM,CAAC,QAAQ,EACtB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CACd,SAAS,CAAC,EAAE,GAAG,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAEpD,WAAW,EAAC,iDAAiD,GAC7D,IACE,EACN,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,QAAQ,YACrC,CAAC,CAAC,oBAAoB,CAAC,GACjB,IACJ,GACK,IACT,GACH,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercel.d.ts","sourceRoot":"","sources":["../../src/providers/vercel.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAG1E,qBAAa,kBAAmB,YAAW,gBAAgB;IAClD,EAAE,SAAiB;IACnB,IAAI,SAAiB;IAEf,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC;CA2BxD"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { put } from "@vercel/blob";
|
|
2
|
+
import { getBlobConfig } from "../actions/settings";
|
|
3
|
+
export class VercelBlobProvider {
|
|
4
|
+
id = "vercel-blob";
|
|
5
|
+
name = "Vercel Blob";
|
|
6
|
+
async upload(file) {
|
|
7
|
+
const config = await getBlobConfig();
|
|
8
|
+
if (!config.clientId) {
|
|
9
|
+
return { error: "Vercel Blob token is not configured" };
|
|
10
|
+
}
|
|
11
|
+
try {
|
|
12
|
+
const blob = await put(file.name, file, {
|
|
13
|
+
access: "public",
|
|
14
|
+
addRandomSuffix: true,
|
|
15
|
+
token: config.clientId,
|
|
16
|
+
});
|
|
17
|
+
return {
|
|
18
|
+
name: file.name,
|
|
19
|
+
url: blob.url,
|
|
20
|
+
type: file.type,
|
|
21
|
+
size: file.size,
|
|
22
|
+
service: "vercel-blob",
|
|
23
|
+
serviceId: blob.pathname,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
console.error("[VercelBlob] Upload error:", error);
|
|
28
|
+
return { error: error.message || "Failed to upload to Vercel Blob" };
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=vercel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercel.js","sourceRoot":"","sources":["../../src/providers/vercel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,OAAO,kBAAkB;IACtB,EAAE,GAAG,aAAa,CAAC;IACnB,IAAI,GAAG,aAAa,CAAC;IAErB,KAAK,CAAC,MAAM,CAAC,IAAU;QAC5B,MAAM,MAAM,GAAG,MAAM,aAAa,EAAE,CAAC;QAErC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YACrB,OAAO,EAAE,KAAK,EAAE,qCAAqC,EAAE,CAAC;QAC1D,CAAC;QAED,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE;gBACtC,MAAM,EAAE,QAAQ;gBAChB,eAAe,EAAE,IAAI;gBACrB,KAAK,EAAE,MAAM,CAAC,QAAQ;aACvB,CAAC,CAAC;YAEH,OAAO;gBACL,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,GAAG,EAAE,IAAI,CAAC,GAAG;gBACb,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,OAAO,EAAE,aAAa;gBACtB,SAAS,EAAE,IAAI,CAAC,QAAQ;aACzB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;YACnD,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,IAAI,iCAAiC,EAAE,CAAC;QACvE,CAAC;IACH,CAAC;CACF"}
|
package/dist/routes.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAG7D,eAAO,MAAM,aAAa,EAAE,sBAAsB,EAQjD,CAAC"}
|
package/dist/routes.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import BlobSettingsPage from "./pages/settings-page";
|
|
2
|
+
export const privateRoutes = [
|
|
3
|
+
{
|
|
4
|
+
path: "/settings/vercel-blob", // Będzie widoczne pod /module/vercel-blob/settings
|
|
5
|
+
component: BlobSettingsPage,
|
|
6
|
+
auth: true,
|
|
7
|
+
roles: ["admin"], // Tylko użytkownicy z rolą "admin" mogą uzyskać dostęp
|
|
8
|
+
// 'permissions': ['system:vercel-blob-settings'], // Tylko użytkownicy z tą konkretną uprawnieniem mogą uzyskać dostęp
|
|
9
|
+
},
|
|
10
|
+
];
|
|
11
|
+
//# sourceMappingURL=routes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AACA,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AAErD,MAAM,CAAC,MAAM,aAAa,GAA6B;IACrD;QACE,IAAI,EAAE,uBAAuB,EAAE,mDAAmD;QAClF,SAAS,EAAE,gBAAgB;QAC3B,IAAI,EAAE,IAAI;QACV,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,uDAAuD;QACzE,uHAAuH;KACxH;CACF,CAAC"}
|
package/locales/pl/global.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"System": "System",
|
|
3
|
-
"Vercel Blob Storage": "Magazyn
|
|
3
|
+
"Vercel Blob Storage": "Magazyn obiektów BLOB Vercel",
|
|
4
4
|
"Settings saved successfully": "Ustawienia zostały zapisane pomyślnie",
|
|
5
5
|
"Failed to save settings. Please check your configuration and try again.": "Nie udało się zapisać ustawień. Sprawdź swoją konfigurację i spróbuj ponownie.",
|
|
6
6
|
"Vercel Blob loading...": "Ładowanie obiektu Vercel Blob...",
|
package/package.json
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vilio/vercel-blob-module",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Activity module for Vilio framework",
|
|
5
|
-
"
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./package.json": "./package.json",
|
|
8
|
-
".":
|
|
9
|
-
"types": "./dist/index.d.ts",
|
|
10
|
-
"import": "./dist/index.mjs",
|
|
11
|
-
"require": "./dist/index.cjs"
|
|
12
|
-
}
|
|
8
|
+
".": "./dist/index.js"
|
|
13
9
|
},
|
|
14
10
|
"files": [
|
|
15
11
|
"dist",
|
|
@@ -19,34 +15,30 @@
|
|
|
19
15
|
"scripts": {
|
|
20
16
|
"release": "npm publish --access public --no-git-checks",
|
|
21
17
|
"clean": "rm -rf ./dist",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"dev": "unbuild --stub",
|
|
25
|
-
"build": "unbuild"
|
|
18
|
+
"dev": "tsc --watch",
|
|
19
|
+
"build": "tsc"
|
|
26
20
|
},
|
|
27
21
|
"dependencies": {
|
|
28
22
|
"@vercel/blob": "^2.2.0",
|
|
29
|
-
"@vilio/ui": "^0.0.
|
|
30
|
-
"@vilio/modules": "^0.0.
|
|
23
|
+
"@vilio/ui": "^0.0.6",
|
|
24
|
+
"@vilio/modules": "^0.0.6",
|
|
31
25
|
"drizzle-orm": "1.0.0-beta.6-4414a19",
|
|
32
26
|
"pg": "^8.16.3",
|
|
33
27
|
"zod": "^3.24.1"
|
|
34
28
|
},
|
|
35
29
|
"devDependencies": {
|
|
36
|
-
"@vilio/core": "^0.0.
|
|
30
|
+
"@vilio/core": "^0.0.9",
|
|
37
31
|
"@types/react": "^19",
|
|
38
32
|
"@types/pg": "^8.16.0",
|
|
39
|
-
"next": "16.1.
|
|
33
|
+
"next": "16.1.6",
|
|
40
34
|
"react": "^19.0.0",
|
|
41
|
-
"typescript": "
|
|
42
|
-
"unbuild": "^3.6.1"
|
|
35
|
+
"typescript": "5.9.2"
|
|
43
36
|
},
|
|
44
37
|
"peerDependencies": {
|
|
45
|
-
"@vilio/core": "^0.0.
|
|
46
|
-
"@vilio/intl": "^0.0.
|
|
47
|
-
"@vilio/ui": "^0.0.
|
|
48
|
-
"next": "
|
|
38
|
+
"@vilio/core": "^0.0.9",
|
|
39
|
+
"@vilio/intl": "^0.0.7",
|
|
40
|
+
"@vilio/ui": "^0.0.6",
|
|
41
|
+
"next": "16.1.6",
|
|
49
42
|
"react": "^19.0.0"
|
|
50
|
-
}
|
|
51
|
-
"main": "./dist/index.mjs"
|
|
43
|
+
}
|
|
52
44
|
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use server";
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.getBlobConfig = getBlobConfig;
|
|
8
|
-
exports.updateBlobConfig = updateBlobConfig;
|
|
9
|
-
var _server = require("@vilio/modules/server");
|
|
10
|
-
var _cache = require("next/cache");
|
|
11
|
-
async function getBlobConfig() {
|
|
12
|
-
const config = await (0, _server.getModuleConfig)("vercel-blob");
|
|
13
|
-
return config || {
|
|
14
|
-
clientId: ""
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
async function updateBlobConfig(config) {
|
|
18
|
-
await (0, _server.updateModuleConfig)("vercel-blob", config);
|
|
19
|
-
(0, _cache.revalidatePath)(`${(0, _server.getVilioPathPrefix)()}/vercel-blob/settings`);
|
|
20
|
-
return {
|
|
21
|
-
success: true
|
|
22
|
-
};
|
|
23
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use server";
|
|
2
|
-
import {
|
|
3
|
-
getModuleConfig,
|
|
4
|
-
getVilioPathPrefix,
|
|
5
|
-
updateModuleConfig
|
|
6
|
-
} from "@vilio/modules/server";
|
|
7
|
-
import { revalidatePath } from "next/cache";
|
|
8
|
-
export async function getBlobConfig() {
|
|
9
|
-
const config = await getModuleConfig("vercel-blob");
|
|
10
|
-
return config || { clientId: "" };
|
|
11
|
-
}
|
|
12
|
-
export async function updateBlobConfig(config) {
|
|
13
|
-
await updateModuleConfig("vercel-blob", config);
|
|
14
|
-
revalidatePath(`${getVilioPathPrefix()}/vercel-blob/settings`);
|
|
15
|
-
return { success: true };
|
|
16
|
-
}
|
package/dist/index.cjs
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var _server = require("@vilio/core/server");
|
|
8
|
-
var _intl = require("@vilio/intl");
|
|
9
|
-
var _global = _interopRequireDefault(require("../locales/en/global.json"));
|
|
10
|
-
var _global2 = _interopRequireDefault(require("../locales/pl/global.json"));
|
|
11
|
-
var _manifest = _interopRequireDefault(require("../manifest.json"));
|
|
12
|
-
var _settings = require("./actions/settings.cjs");
|
|
13
|
-
var _vercel = require("./providers/vercel.cjs");
|
|
14
|
-
var _routes = require("./routes.cjs");
|
|
15
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
-
const vercelBlobModule = {
|
|
17
|
-
manifest: _manifest.default,
|
|
18
|
-
translations: {
|
|
19
|
-
en: _global.default,
|
|
20
|
-
pl: _global2.default
|
|
21
|
-
},
|
|
22
|
-
routes: {
|
|
23
|
-
private: _routes.privateRoutes
|
|
24
|
-
},
|
|
25
|
-
navigation: {
|
|
26
|
-
admin: {
|
|
27
|
-
[(0, _intl.i18n)("System")]: [{
|
|
28
|
-
id: "vercel-blob-settings",
|
|
29
|
-
title: (0, _intl.i18n)("Vercel Blob Storage"),
|
|
30
|
-
url: "/vercel-blob/settings",
|
|
31
|
-
icon: "solar:folder-with-files-bold-duotone"
|
|
32
|
-
}]
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
onEnable: async () => {
|
|
36
|
-
_server.filesystemService.registerProvider(new _vercel.VercelBlobProvider());
|
|
37
|
-
const config = await (0, _settings.getBlobConfig)();
|
|
38
|
-
if (process.env.BLOB_READ_WRITE_TOKEN || config.clientId) {
|
|
39
|
-
_server.filesystemService.setDefaultProvider("vercel-blob");
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
onDisable: async () => {
|
|
43
|
-
_server.filesystemService.setDefaultProvider("local");
|
|
44
|
-
_server.filesystemService.unregisterProvider("vercel-blob");
|
|
45
|
-
},
|
|
46
|
-
init: async () => {
|
|
47
|
-
_server.filesystemService.registerProvider(new _vercel.VercelBlobProvider());
|
|
48
|
-
const config = await (0, _settings.getBlobConfig)();
|
|
49
|
-
if (process.env.BLOB_READ_WRITE_TOKEN || config.clientId) {
|
|
50
|
-
_server.filesystemService.setDefaultProvider("vercel-blob");
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
module.exports = vercelBlobModule;
|
package/dist/index.mjs
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { filesystemService } from "@vilio/core/server";
|
|
2
|
-
import { i18n } from "@vilio/intl";
|
|
3
|
-
import localesEn from "../locales/en/global.json" with { type: "json" };
|
|
4
|
-
import localesPl from "../locales/pl/global.json" with { type: "json" };
|
|
5
|
-
import manifest from "../manifest.json";
|
|
6
|
-
import { getBlobConfig } from "./actions/settings.mjs";
|
|
7
|
-
import { VercelBlobProvider } from "./providers/vercel.mjs";
|
|
8
|
-
import { privateRoutes } from "./routes.mjs";
|
|
9
|
-
const vercelBlobModule = {
|
|
10
|
-
manifest,
|
|
11
|
-
translations: {
|
|
12
|
-
en: localesEn,
|
|
13
|
-
pl: localesPl
|
|
14
|
-
},
|
|
15
|
-
routes: {
|
|
16
|
-
private: privateRoutes
|
|
17
|
-
},
|
|
18
|
-
navigation: {
|
|
19
|
-
admin: {
|
|
20
|
-
[i18n("System")]: [
|
|
21
|
-
{
|
|
22
|
-
id: "vercel-blob-settings",
|
|
23
|
-
title: i18n("Vercel Blob Storage"),
|
|
24
|
-
url: "/vercel-blob/settings",
|
|
25
|
-
icon: "solar:folder-with-files-bold-duotone"
|
|
26
|
-
}
|
|
27
|
-
]
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
onEnable: async () => {
|
|
31
|
-
filesystemService.registerProvider(new VercelBlobProvider());
|
|
32
|
-
const config = await getBlobConfig();
|
|
33
|
-
if (process.env.BLOB_READ_WRITE_TOKEN || config.clientId) {
|
|
34
|
-
filesystemService.setDefaultProvider("vercel-blob");
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
onDisable: async () => {
|
|
38
|
-
filesystemService.setDefaultProvider("local");
|
|
39
|
-
filesystemService.unregisterProvider("vercel-blob");
|
|
40
|
-
},
|
|
41
|
-
init: async () => {
|
|
42
|
-
filesystemService.registerProvider(new VercelBlobProvider());
|
|
43
|
-
const config = await getBlobConfig();
|
|
44
|
-
if (process.env.BLOB_READ_WRITE_TOKEN || config.clientId) {
|
|
45
|
-
filesystemService.setDefaultProvider("vercel-blob");
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
export default vercelBlobModule;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
module.exports = BlobSettingsPage;
|
|
8
|
-
var _intl = require("@vilio/intl");
|
|
9
|
-
var _ui = require("@vilio/ui");
|
|
10
|
-
var _button = require("@vilio/ui/components/button");
|
|
11
|
-
var _card = require("@vilio/ui/components/card");
|
|
12
|
-
var _input = require("@vilio/ui/components/input");
|
|
13
|
-
var _label = require("@vilio/ui/components/label");
|
|
14
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
-
var React = _react;
|
|
16
|
-
var _settings = require("../actions/settings.cjs");
|
|
17
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
18
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
|
-
function BlobSettingsPage() {
|
|
20
|
-
const {
|
|
21
|
-
t
|
|
22
|
-
} = (0, _intl.useTranslation)();
|
|
23
|
-
const [config, setConfig] = (0, _react.useState)({
|
|
24
|
-
clientId: ""
|
|
25
|
-
});
|
|
26
|
-
const [loading, setLoading] = (0, _react.useState)(true);
|
|
27
|
-
(0, _react.useEffect)(() => {
|
|
28
|
-
(0, _settings.getBlobConfig)().then(data => {
|
|
29
|
-
setConfig(data);
|
|
30
|
-
setLoading(false);
|
|
31
|
-
});
|
|
32
|
-
}, []);
|
|
33
|
-
const handleSave = async e => {
|
|
34
|
-
e.preventDefault();
|
|
35
|
-
try {
|
|
36
|
-
await (0, _settings.updateBlobConfig)(config);
|
|
37
|
-
_ui.toast.success(t("Settings saved successfully"));
|
|
38
|
-
} catch (_error) {
|
|
39
|
-
_ui.toast.error(t("Failed to save settings. Please check your configuration and try again."));
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
if (loading) return /* @__PURE__ */React.createElement("div", null, t("Vercel Blob loading..."));
|
|
43
|
-
return /* @__PURE__ */React.createElement("div", {
|
|
44
|
-
className: "container mx-auto py-10 max-w-2xl"
|
|
45
|
-
}, /* @__PURE__ */React.createElement(_card.Card, null, /* @__PURE__ */React.createElement(_card.CardHeader, null, /* @__PURE__ */React.createElement("div", null, t("Vercel Blob")), /* @__PURE__ */React.createElement("div", null, t("")), /* @__PURE__ */React.createElement(_card.CardTitle, null, t("Vercel Blob Settings")), /* @__PURE__ */React.createElement(_card.CardDescription, null, t("Configure your Vercel Blob credentials. You can find these in the Vercel Dashboard."))), /* @__PURE__ */React.createElement(_card.CardContent, null, /* @__PURE__ */React.createElement("form", {
|
|
46
|
-
onSubmit: handleSave,
|
|
47
|
-
className: "space-y-4"
|
|
48
|
-
}, /* @__PURE__ */React.createElement("div", {
|
|
49
|
-
className: "space-y-2"
|
|
50
|
-
}, /* @__PURE__ */React.createElement(_label.Label, {
|
|
51
|
-
htmlFor: "clientId"
|
|
52
|
-
}, t("Client ID")), /* @__PURE__ */React.createElement(_input.Input, {
|
|
53
|
-
id: "clientId",
|
|
54
|
-
value: config.clientId,
|
|
55
|
-
onChange: e => setConfig({
|
|
56
|
-
...config,
|
|
57
|
-
clientId: e.target.value
|
|
58
|
-
}),
|
|
59
|
-
placeholder: "vercel_blob_rw_********************************"
|
|
60
|
-
})), /* @__PURE__ */React.createElement(_button.Button, {
|
|
61
|
-
type: "submit",
|
|
62
|
-
className: "w-full"
|
|
63
|
-
}, t("Save Configuration"))))));
|
|
64
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useTranslation } from "@vilio/intl";
|
|
3
|
-
import { toast } from "@vilio/ui";
|
|
4
|
-
import { Button } from "@vilio/ui/components/button";
|
|
5
|
-
import {
|
|
6
|
-
Card,
|
|
7
|
-
CardContent,
|
|
8
|
-
CardDescription,
|
|
9
|
-
CardHeader,
|
|
10
|
-
CardTitle
|
|
11
|
-
} from "@vilio/ui/components/card";
|
|
12
|
-
import { Input } from "@vilio/ui/components/input";
|
|
13
|
-
import { Label } from "@vilio/ui/components/label";
|
|
14
|
-
import * as React from "react";
|
|
15
|
-
import { useEffect, useState } from "react";
|
|
16
|
-
import {
|
|
17
|
-
getBlobConfig,
|
|
18
|
-
updateBlobConfig
|
|
19
|
-
} from "../actions/settings.mjs";
|
|
20
|
-
export default function BlobSettingsPage() {
|
|
21
|
-
const { t } = useTranslation();
|
|
22
|
-
const [config, setConfig] = useState({
|
|
23
|
-
clientId: ""
|
|
24
|
-
});
|
|
25
|
-
const [loading, setLoading] = useState(true);
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
getBlobConfig().then((data) => {
|
|
28
|
-
setConfig(data);
|
|
29
|
-
setLoading(false);
|
|
30
|
-
});
|
|
31
|
-
}, []);
|
|
32
|
-
const handleSave = async (e) => {
|
|
33
|
-
e.preventDefault();
|
|
34
|
-
try {
|
|
35
|
-
await updateBlobConfig(config);
|
|
36
|
-
toast.success(t("Settings saved successfully"));
|
|
37
|
-
} catch (_error) {
|
|
38
|
-
toast.error(
|
|
39
|
-
t(
|
|
40
|
-
"Failed to save settings. Please check your configuration and try again."
|
|
41
|
-
)
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
if (loading) return /* @__PURE__ */ React.createElement("div", null, t("Vercel Blob loading..."));
|
|
46
|
-
return /* @__PURE__ */ React.createElement("div", { className: "container mx-auto py-10 max-w-2xl" }, /* @__PURE__ */ React.createElement(Card, null, /* @__PURE__ */ React.createElement(CardHeader, null, /* @__PURE__ */ React.createElement("div", null, t("Vercel Blob")), /* @__PURE__ */ React.createElement("div", null, t("")), /* @__PURE__ */ React.createElement(CardTitle, null, t("Vercel Blob Settings")), /* @__PURE__ */ React.createElement(CardDescription, null, t(
|
|
47
|
-
"Configure your Vercel Blob credentials. You can find these in the Vercel Dashboard."
|
|
48
|
-
))), /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement("form", { onSubmit: handleSave, className: "space-y-4" }, /* @__PURE__ */ React.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React.createElement(Label, { htmlFor: "clientId" }, t("Client ID")), /* @__PURE__ */ React.createElement(
|
|
49
|
-
Input,
|
|
50
|
-
{
|
|
51
|
-
id: "clientId",
|
|
52
|
-
value: config.clientId,
|
|
53
|
-
onChange: (e) => setConfig({ ...config, clientId: e.target.value }),
|
|
54
|
-
placeholder: "vercel_blob_rw_********************************"
|
|
55
|
-
}
|
|
56
|
-
)), /* @__PURE__ */ React.createElement(Button, { type: "submit", className: "w-full" }, t("Save Configuration"))))));
|
|
57
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.VercelBlobProvider = void 0;
|
|
7
|
-
var _blob = require("@vercel/blob");
|
|
8
|
-
var _settings = require("../actions/settings.cjs");
|
|
9
|
-
class VercelBlobProvider {
|
|
10
|
-
id = "vercel-blob";
|
|
11
|
-
name = "Vercel Blob";
|
|
12
|
-
async upload(file) {
|
|
13
|
-
const config = await (0, _settings.getBlobConfig)();
|
|
14
|
-
if (!config.clientId) {
|
|
15
|
-
return {
|
|
16
|
-
error: "Vercel Blob token is not configured"
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
try {
|
|
20
|
-
const blob = await (0, _blob.put)(file.name, file, {
|
|
21
|
-
access: "public",
|
|
22
|
-
addRandomSuffix: true,
|
|
23
|
-
token: config.clientId
|
|
24
|
-
});
|
|
25
|
-
return {
|
|
26
|
-
name: file.name,
|
|
27
|
-
url: blob.url,
|
|
28
|
-
type: file.type,
|
|
29
|
-
size: file.size,
|
|
30
|
-
service: "vercel-blob",
|
|
31
|
-
serviceId: blob.pathname
|
|
32
|
-
};
|
|
33
|
-
} catch (error) {
|
|
34
|
-
console.error("[VercelBlob] Upload error:", error);
|
|
35
|
-
return {
|
|
36
|
-
error: error.message || "Failed to upload to Vercel Blob"
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
exports.VercelBlobProvider = VercelBlobProvider;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { put } from "@vercel/blob";
|
|
2
|
-
import { getBlobConfig } from "../actions/settings.mjs";
|
|
3
|
-
export class VercelBlobProvider {
|
|
4
|
-
id = "vercel-blob";
|
|
5
|
-
name = "Vercel Blob";
|
|
6
|
-
async upload(file) {
|
|
7
|
-
const config = await getBlobConfig();
|
|
8
|
-
if (!config.clientId) {
|
|
9
|
-
return { error: "Vercel Blob token is not configured" };
|
|
10
|
-
}
|
|
11
|
-
try {
|
|
12
|
-
const blob = await put(file.name, file, {
|
|
13
|
-
access: "public",
|
|
14
|
-
addRandomSuffix: true,
|
|
15
|
-
token: config.clientId
|
|
16
|
-
});
|
|
17
|
-
return {
|
|
18
|
-
name: file.name,
|
|
19
|
-
url: blob.url,
|
|
20
|
-
type: file.type,
|
|
21
|
-
size: file.size,
|
|
22
|
-
service: "vercel-blob",
|
|
23
|
-
serviceId: blob.pathname
|
|
24
|
-
};
|
|
25
|
-
} catch (error) {
|
|
26
|
-
console.error("[VercelBlob] Upload error:", error);
|
|
27
|
-
return { error: error.message || "Failed to upload to Vercel Blob" };
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
package/dist/routes.cjs
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.privateRoutes = void 0;
|
|
7
|
-
var _settingsPage = _interopRequireDefault(require("./pages/settings-page.cjs"));
|
|
8
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
const privateRoutes = exports.privateRoutes = [{
|
|
10
|
-
path: "/vercel-blob/settings",
|
|
11
|
-
// Będzie widoczne pod /module/vercel-blob/settings
|
|
12
|
-
component: _settingsPage.default,
|
|
13
|
-
auth: true,
|
|
14
|
-
roles: ["admin"]
|
|
15
|
-
// Tylko użytkownicy z rolą "admin" mogą uzyskać dostęp
|
|
16
|
-
// 'permissions': ['system:vercel-blob-settings'], // Tylko użytkownicy z tą konkretną uprawnieniem mogą uzyskać dostęp
|
|
17
|
-
}];
|
package/dist/routes.mjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import BlobSettingsPage from "./pages/settings-page.mjs";
|
|
2
|
-
export const privateRoutes = [
|
|
3
|
-
{
|
|
4
|
-
path: "/vercel-blob/settings",
|
|
5
|
-
// Będzie widoczne pod /module/vercel-blob/settings
|
|
6
|
-
component: BlobSettingsPage,
|
|
7
|
-
auth: true,
|
|
8
|
-
roles: ["admin"]
|
|
9
|
-
// Tylko użytkownicy z rolą "admin" mogą uzyskać dostęp
|
|
10
|
-
// 'permissions': ['system:vercel-blob-settings'], // Tylko użytkownicy z tą konkretną uprawnieniem mogą uzyskać dostęp
|
|
11
|
-
}
|
|
12
|
-
];
|