Merge branch 'master' into blockexc/experiments
# Conflicts: # ProjectPlugins/CodexPlugin/CodexContainerRecipe.cs
This commit is contained in:
commit
a1833c52cc
|
@ -10,7 +10,7 @@ namespace CodexPlugin
|
||||||
public class ApiChecker
|
public class ApiChecker
|
||||||
{
|
{
|
||||||
// <INSERT-OPENAPI-YAML-HASH>
|
// <INSERT-OPENAPI-YAML-HASH>
|
||||||
private const string OpenApiYamlHash = "C1-50-18-D5-73-64-1C-D8-74-DB-75-0D-C1-3D-AB-82-D6-A3-05-3E-49-2B-82-0B-0F-92-BC-DC-32-BE-56-C9";
|
private const string OpenApiYamlHash = "39-0C-32-A3-EA-90-4F-29-1C-67-12-F1-D5-BE-31-67-8D-90-43-1E-F2-02-63-5B-0C-49-F7-1E-E5-EC-F7-00";
|
||||||
private const string OpenApiFilePath = "/codex/openapi.yaml";
|
private const string OpenApiFilePath = "/codex/openapi.yaml";
|
||||||
private const string DisableEnvironmentVariable = "CODEXPLUGIN_DISABLE_APICHECK";
|
private const string DisableEnvironmentVariable = "CODEXPLUGIN_DISABLE_APICHECK";
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ namespace CodexPlugin
|
||||||
|
|
||||||
public LocalDatasetList LocalFiles()
|
public LocalDatasetList LocalFiles()
|
||||||
{
|
{
|
||||||
return mapper.Map(OnCodex(api => api.ListDataAsync()));
|
return mapper.Map(OnCodex(api => api.ListDataAsync("", "")));
|
||||||
}
|
}
|
||||||
|
|
||||||
public StorageAvailability SalesAvailability(StorageAvailability request)
|
public StorageAvailability SalesAvailability(StorageAvailability request)
|
||||||
|
|
|
@ -16,8 +16,8 @@ namespace CodexPlugin
|
||||||
Spr = debugInfo.Spr,
|
Spr = debugInfo.Spr,
|
||||||
Addrs = debugInfo.Addrs.ToArray(),
|
Addrs = debugInfo.Addrs.ToArray(),
|
||||||
AnnounceAddresses = JArray(debugInfo.AdditionalProperties, "announceAddresses").Select(x => x.ToString()).ToArray(),
|
AnnounceAddresses = JArray(debugInfo.AdditionalProperties, "announceAddresses").Select(x => x.ToString()).ToArray(),
|
||||||
Version = MapDebugInfoVersion(JObject(debugInfo.AdditionalProperties, "codex")),
|
Version = Map(debugInfo.Codex),
|
||||||
Table = MapDebugInfoTable(JObject(debugInfo.AdditionalProperties, "table"))
|
Table = Map(debugInfo.Table)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,47 +136,45 @@ namespace CodexPlugin
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private DebugInfoVersion MapDebugInfoVersion(JObject obj)
|
private DebugInfoVersion Map(CodexVersion obj)
|
||||||
{
|
{
|
||||||
return new DebugInfoVersion
|
return new DebugInfoVersion
|
||||||
{
|
{
|
||||||
Version = StringOrEmpty(obj, "version"),
|
Version = obj.Version,
|
||||||
Revision = StringOrEmpty(obj, "revision")
|
Revision = obj.Revision
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private DebugInfoTable MapDebugInfoTable(JObject obj)
|
private DebugInfoTable Map(PeersTable obj)
|
||||||
{
|
{
|
||||||
return new DebugInfoTable
|
return new DebugInfoTable
|
||||||
{
|
{
|
||||||
LocalNode = MapDebugInfoTableNode(obj.GetValue("localNode")),
|
LocalNode = Map(obj.LocalNode),
|
||||||
Nodes = MapDebugInfoTableNodeArray(obj.GetValue("nodes") as JArray)
|
Nodes = Map(obj.Nodes)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private DebugInfoTableNode MapDebugInfoTableNode(JToken? token)
|
private DebugInfoTableNode Map(Node? token)
|
||||||
{
|
{
|
||||||
var obj = token as JObject;
|
if (token == null) return new DebugInfoTableNode();
|
||||||
if (obj == null) return new DebugInfoTableNode();
|
|
||||||
|
|
||||||
return new DebugInfoTableNode
|
return new DebugInfoTableNode
|
||||||
{
|
{
|
||||||
Address = StringOrEmpty(obj, "address"),
|
Address = token.Address,
|
||||||
NodeId = StringOrEmpty(obj, "nodeId"),
|
NodeId = token.NodeId,
|
||||||
PeerId = StringOrEmpty(obj, "peerId"),
|
PeerId = token.PeerId,
|
||||||
Record = StringOrEmpty(obj, "record"),
|
Record = token.Record,
|
||||||
Seen = Bool(obj, "seen")
|
Seen = token.Seen
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private DebugInfoTableNode[] MapDebugInfoTableNodeArray(JArray? nodes)
|
private DebugInfoTableNode[] Map(ICollection<Node> nodes)
|
||||||
{
|
{
|
||||||
if (nodes == null || nodes.Count == 0)
|
if (nodes == null || nodes.Count == 0)
|
||||||
{
|
{
|
||||||
return new DebugInfoTableNode[0];
|
return new DebugInfoTableNode[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
return nodes.Select(MapDebugInfoTableNode).ToArray();
|
return nodes.Select(Map).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Manifest MapManifest(CodexOpenApi.ManifestItem manifest)
|
private Manifest MapManifest(CodexOpenApi.ManifestItem manifest)
|
||||||
|
|
|
@ -90,6 +90,40 @@ components:
|
||||||
cid:
|
cid:
|
||||||
$ref: "#/components/schemas/Cid"
|
$ref: "#/components/schemas/Cid"
|
||||||
|
|
||||||
|
Node:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
nodeId:
|
||||||
|
type: string
|
||||||
|
peerId:
|
||||||
|
type: string
|
||||||
|
record:
|
||||||
|
type: string
|
||||||
|
address:
|
||||||
|
type: string
|
||||||
|
seen:
|
||||||
|
type: boolean
|
||||||
|
|
||||||
|
CodexVersion:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
version:
|
||||||
|
type: string
|
||||||
|
example: v0.1.7
|
||||||
|
revision:
|
||||||
|
type: string
|
||||||
|
example: 0c647d8
|
||||||
|
|
||||||
|
PeersTable:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
localNode:
|
||||||
|
$ref: "#/components/schemas/Node"
|
||||||
|
nodes:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/Node"
|
||||||
|
|
||||||
DebugInfo:
|
DebugInfo:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
@ -104,6 +138,10 @@ components:
|
||||||
description: Path of the data repository where all nodes data are stored
|
description: Path of the data repository where all nodes data are stored
|
||||||
spr:
|
spr:
|
||||||
$ref: "#/components/schemas/SPR"
|
$ref: "#/components/schemas/SPR"
|
||||||
|
table:
|
||||||
|
$ref: "#/components/schemas/PeersTable"
|
||||||
|
codex:
|
||||||
|
$ref: "#/components/schemas/CodexVersion"
|
||||||
|
|
||||||
SalesAvailability:
|
SalesAvailability:
|
||||||
type: object
|
type: object
|
||||||
|
@ -319,6 +357,19 @@ components:
|
||||||
protected:
|
protected:
|
||||||
type: boolean
|
type: boolean
|
||||||
description: "Indicates if content is protected by erasure-coding"
|
description: "Indicates if content is protected by erasure-coding"
|
||||||
|
filename:
|
||||||
|
type: string
|
||||||
|
description: "The original name of the uploaded content (optional)"
|
||||||
|
example: codex.png
|
||||||
|
mimetype:
|
||||||
|
type: string
|
||||||
|
description: "The original mimetype of the uploaded content (optional)"
|
||||||
|
example: image/png
|
||||||
|
uploadedAt:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
description: "The UTC upload timestamp in seconds"
|
||||||
|
example: 1729244192
|
||||||
|
|
||||||
Space:
|
Space:
|
||||||
type: object
|
type: object
|
||||||
|
@ -392,6 +443,21 @@ paths:
|
||||||
summary: "Lists manifest CIDs stored locally in node."
|
summary: "Lists manifest CIDs stored locally in node."
|
||||||
tags: [ Data ]
|
tags: [ Data ]
|
||||||
operationId: listData
|
operationId: listData
|
||||||
|
parameters:
|
||||||
|
- name: content-type
|
||||||
|
in: header
|
||||||
|
required: false
|
||||||
|
description: The content type of the file. Must be valid.
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
example: "image/png"
|
||||||
|
- name: content-disposition
|
||||||
|
in: header
|
||||||
|
required: false
|
||||||
|
description: The content disposition used to send the filename.
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
example: "attachment; filename=\"codex.png\""
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: Retrieved list of content CIDs
|
description: Retrieved list of content CIDs
|
||||||
|
@ -404,6 +470,8 @@ paths:
|
||||||
description: Invalid CID is specified
|
description: Invalid CID is specified
|
||||||
"404":
|
"404":
|
||||||
description: Content specified by the CID is not found
|
description: Content specified by the CID is not found
|
||||||
|
"422":
|
||||||
|
description: The content type is not a valid content type or the filename is not valid
|
||||||
"500":
|
"500":
|
||||||
description: Well it was bad-bad
|
description: Well it was bad-bad
|
||||||
post:
|
post:
|
||||||
|
|
Loading…
Reference in New Issue