Implement TR-069 Upload method
This commit is contained in:
1 parent
d29448e3a7
commit
dae521ae89
22 files changed
+1016
-68
No files matched your search
@@ -229,6 +229,44 @@ export function download(
|
||||
return true;
|
||||
}
|
||||
|
||||
export function upload(
|
||||
sessionContext: SessionContext,
|
||||
provision: (string | number | boolean)[],
|
||||
declarations: Declaration[]
|
||||
): boolean {
|
||||
if (
|
||||
provision.length !== 3 ||
|
||||
typeof provision[1] !== "string" ||
|
||||
typeof provision[2] !== "string"
|
||||
)
|
||||
throw new Error("Invalid arguments");
|
||||
|
||||
const alias = [
|
||||
`FileType:${JSON.stringify(provision[1] || "")}`,
|
||||
`FileName:${JSON.stringify(provision[2] || "")}`,
|
||||
].join(",");
|
||||
|
||||
declarations.push({
|
||||
path: Path.parse(`Uploads.[${alias}]`),
|
||||
pathGet: 1,
|
||||
pathSet: 1,
|
||||
attrGet: null,
|
||||
attrSet: null,
|
||||
defer: true,
|
||||
});
|
||||
|
||||
declarations.push({
|
||||
path: Path.parse(`Uploads.[${alias}].Upload`),
|
||||
pathGet: 1,
|
||||
pathSet: null,
|
||||
attrGet: { value: 1 },
|
||||
attrSet: { value: [sessionContext.timestamp] },
|
||||
defer: true,
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
export function instances(
|
||||
sessionContext: SessionContext,
|
||||
provision: (string | number | boolean)[],
|
||||
|
||||
Reference in new issue
Block a user