@adminforth/upload 2.14.4 → 2.15.0
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/build.log +2 -2
- package/custom/uploader.vue +1 -1
- package/dist/custom/uploader.vue +1 -1
- package/dist/index.js +18 -0
- package/index.ts +16 -0
- package/package.json +1 -1
package/build.log
CHANGED
|
@@ -12,5 +12,5 @@ custom/preview.vue
|
|
|
12
12
|
custom/tsconfig.json
|
|
13
13
|
custom/uploader.vue
|
|
14
14
|
|
|
15
|
-
sent 68,
|
|
16
|
-
total size is 68,
|
|
15
|
+
sent 68,569 bytes received 153 bytes 137,444.00 bytes/sec
|
|
16
|
+
total size is 68,007 speedup is 0.99
|
package/custom/uploader.vue
CHANGED
|
@@ -175,7 +175,7 @@ onMounted(async () => {
|
|
|
175
175
|
if (!uploaded.value && props.record?.[previewColumnName]) {
|
|
176
176
|
if (Array.isArray(props.record[previewColumnName]) && props.record[previewColumnName].length > 0) {
|
|
177
177
|
const resp = await callAdminForthApi({
|
|
178
|
-
path: `/plugin/${props.meta.pluginInstanceId}/get-file-
|
|
178
|
+
path: `/plugin/${props.meta.pluginInstanceId}/get-file-download-url`,
|
|
179
179
|
method: 'POST',
|
|
180
180
|
body: { filePath: existingFilePath },
|
|
181
181
|
});
|
package/dist/custom/uploader.vue
CHANGED
|
@@ -175,7 +175,7 @@ onMounted(async () => {
|
|
|
175
175
|
if (!uploaded.value && props.record?.[previewColumnName]) {
|
|
176
176
|
if (Array.isArray(props.record[previewColumnName]) && props.record[previewColumnName].length > 0) {
|
|
177
177
|
const resp = await callAdminForthApi({
|
|
178
|
-
path: `/plugin/${props.meta.pluginInstanceId}/get-file-
|
|
178
|
+
path: `/plugin/${props.meta.pluginInstanceId}/get-file-download-url`,
|
|
179
179
|
method: 'POST',
|
|
180
180
|
body: { filePath: existingFilePath },
|
|
181
181
|
});
|
package/dist/index.js
CHANGED
|
@@ -134,6 +134,24 @@ export default class UploadPlugin extends AdminForthPlugin {
|
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
136
|
;
|
|
137
|
+
isInternalUrl(url) {
|
|
138
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
139
|
+
const adapter = this.options.storageAdapter;
|
|
140
|
+
if (adapter && typeof adapter.isInternalUrl === 'function') {
|
|
141
|
+
try {
|
|
142
|
+
return yield adapter.isInternalUrl(url);
|
|
143
|
+
}
|
|
144
|
+
catch (err) {
|
|
145
|
+
console.error(`[UploadPlugin] Error calling isInternalUrl on adapter:`, err);
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
throw new Error('Plese update storage adapter');
|
|
151
|
+
}
|
|
152
|
+
return false;
|
|
153
|
+
});
|
|
154
|
+
}
|
|
137
155
|
instanceUniqueRepresentation(pluginOptions) {
|
|
138
156
|
return `${pluginOptions.pathColumnName}`;
|
|
139
157
|
}
|
package/index.ts
CHANGED
|
@@ -162,6 +162,22 @@ export default class UploadPlugin extends AdminForthPlugin {
|
|
|
162
162
|
return { ok: true };
|
|
163
163
|
};
|
|
164
164
|
|
|
165
|
+
async isInternalUrl(url: string): Promise<boolean> {
|
|
166
|
+
const adapter = this.options.storageAdapter as any;
|
|
167
|
+
|
|
168
|
+
if (adapter && typeof adapter.isInternalUrl === 'function') {
|
|
169
|
+
try {
|
|
170
|
+
return await adapter.isInternalUrl(url);
|
|
171
|
+
} catch (err) {
|
|
172
|
+
console.error(`[UploadPlugin] Error calling isInternalUrl on adapter:`, err);
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
} else {
|
|
176
|
+
throw new Error ('Plese update storage adapter')
|
|
177
|
+
}
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
|
|
165
181
|
instanceUniqueRepresentation(pluginOptions: any) : string {
|
|
166
182
|
return `${pluginOptions.pathColumnName}`;
|
|
167
183
|
}
|