refactor: add pinned property for date
This commit is contained in:
parent
7ea4af1346
commit
ea395df494
|
@ -3,9 +3,7 @@ import {S5Client} from "@lumeweb/s5-js";
|
||||||
import {PROTOCOL_S5} from "@lumeweb/portal-sdk";
|
import {PROTOCOL_S5} from "@lumeweb/portal-sdk";
|
||||||
import {Multihash} from "@lumeweb/libs5/lib/multihash.js";
|
import {Multihash} from "@lumeweb/libs5/lib/multihash.js";
|
||||||
import {AxiosProgressEvent} from "axios";
|
import {AxiosProgressEvent} from "axios";
|
||||||
import {CancelablePromise} from "@lumeweb/s5-js/lib/axios.js";
|
import {CID, CID_TYPES, METADATA_TYPES, metadataMagicByte, Unpacker} from "@lumeweb/libs5";
|
||||||
import {MetadataResult} from "@lumeweb/s5-js/lib/options/download.js";
|
|
||||||
import {metadataMagicByte, Unpacker, CID, METADATA_TYPES, CID_TYPES} from "@lumeweb/libs5";
|
|
||||||
|
|
||||||
async function getIsManifest(s5: S5Client, hash: string): Promise<boolean | number> {
|
async function getIsManifest(s5: S5Client, hash: string): Promise<boolean | number> {
|
||||||
|
|
||||||
|
@ -63,6 +61,7 @@ export interface FileItem {
|
||||||
cid: string;
|
cid: string;
|
||||||
type: string;
|
type: string;
|
||||||
mimeType: string;
|
mimeType: string;
|
||||||
|
pinned: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const fileProvider: SdkProvider = {
|
export const fileProvider: SdkProvider = {
|
||||||
|
@ -81,12 +80,14 @@ export const fileProvider: SdkProvider = {
|
||||||
cid: new CID(manifest, mHash, pin.size).toString(),
|
cid: new CID(manifest, mHash, pin.size).toString(),
|
||||||
type: "manifest",
|
type: "manifest",
|
||||||
mimeType: "application/octet-stream",
|
mimeType: "application/octet-stream",
|
||||||
|
pinned: pin.pinned_at,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
items.push({
|
items.push({
|
||||||
cid: new CID(CID_TYPES.RAW, Multihash.fromBase64Url(pin.hash), pin.size).toString(),
|
cid: new CID(CID_TYPES.RAW, Multihash.fromBase64Url(pin.hash), pin.size).toString(),
|
||||||
type: "raw",
|
type: "raw",
|
||||||
mimeType: pin.mime_type,
|
mimeType: pin.mime_type,
|
||||||
|
pinned: pin.pinned_at,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue