mirror of
https://github.com/PretendoNetwork/BOSS.git
synced 2026-03-21 17:34:19 -05:00
feat(3ds): Add support for no payload contents
Having a task file with no payload contents is perfectly valid and supported officially. This can be used for files where only the metadata is relevant, such as on Team Kirby Clash Deluxe passwords which are stored on a file description and the prize comes from the attributes.
This commit is contained in:
parent
17bdbb2751
commit
f3c57f99ef
|
|
@ -140,11 +140,12 @@ const createCmd = new Command('create')
|
|||
.option('--attribute3 [attribute3]', 'Attribute 3 for this task file')
|
||||
.option('--desc [desc]', 'Description for this task file')
|
||||
.option('-m, --mark-arrived-privileged', 'Only notify of new content to privileged titles')
|
||||
.option('-n, --no-payload', 'Make this task file have no payload contents')
|
||||
.action(commandHandler<[string, string]>(async (cmd): Promise<void> => {
|
||||
const [appId, taskId] = cmd.args;
|
||||
// TODO - Handle multiple payload contents
|
||||
const opts = cmd.opts<{ name: string; titleId: string; contentDatatype: string; nsDataId: string; version: string; file: string; country: string[]; lang: string[]; attribute1?: string; attribute2?: string; attribute3?: string; desc?: string; markArrivedPrivileged: boolean }>();
|
||||
const fileBuf = await fs.readFile(opts.file);
|
||||
const opts = cmd.opts<{ name: string; titleId: string; contentDatatype: string; nsDataId: string; version: string; file: string; country: string[]; lang: string[]; attribute1?: string; attribute2?: string; attribute3?: string; desc?: string; markArrivedPrivileged: boolean; payload: boolean }>();
|
||||
const fileBuf = opts.payload ? await fs.readFile(opts.file) : Buffer.alloc(0);
|
||||
const ctx = getCliContext();
|
||||
const { file } = await ctx.grpc.uploadFileCTR({
|
||||
taskId: taskId,
|
||||
|
|
@ -158,13 +159,15 @@ const createCmd = new Command('create')
|
|||
description: opts.desc
|
||||
},
|
||||
name: opts.name,
|
||||
payloadContents: [{
|
||||
titleId: BigInt(parseInt(opts.titleId, 16)),
|
||||
contentDatatype: Number(opts.contentDatatype),
|
||||
nsDataId: Number(opts.nsDataId),
|
||||
version: Number(opts.version),
|
||||
content: fileBuf
|
||||
}],
|
||||
payloadContents: opts.payload
|
||||
? [{
|
||||
titleId: BigInt(parseInt(opts.titleId, 16)),
|
||||
contentDatatype: Number(opts.contentDatatype),
|
||||
nsDataId: Number(opts.nsDataId),
|
||||
version: Number(opts.version),
|
||||
content: fileBuf
|
||||
}]
|
||||
: [],
|
||||
flags: {
|
||||
markArrivedPrivileged: opts.markArrivedPrivileged
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,10 +57,6 @@ export async function uploadFileCTR(request: UploadFileCTRRequest, context: Call
|
|||
}
|
||||
}
|
||||
|
||||
if (payloads.length === 0) {
|
||||
throw new ServerError(Status.INVALID_ARGUMENT, 'Cannot upload empty file');
|
||||
}
|
||||
|
||||
if (!request.attributes) {
|
||||
request.attributes = {
|
||||
attribute1: '',
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user