store permission file and hide it from being listed
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import path from 'path';
|
||||
import { writeFile } from 'fs/promises';
|
||||
import { Buffer } from 'buffer';
|
||||
import { createReadStream } from 'fs';
|
||||
/** import Minio from 'minio'; */
|
||||
import { Readable } from 'stream';
|
||||
@@ -36,7 +37,13 @@ export const actions = {
|
||||
|
||||
const url = await client.presignedPutObject('tatort', objectName);
|
||||
|
||||
// enter code
|
||||
// store code in S3
|
||||
// tatort/<vorgang>/__perm__
|
||||
const code_filename = '__perm__';
|
||||
const buf = Buffer.from(code, 'utf-8');
|
||||
const code_stream = Readable.from(buf);
|
||||
const code_path = `${vorgang}/${code_filename}`;
|
||||
await client.putObject('tatort', code_path, code_stream);
|
||||
|
||||
return { url };
|
||||
},
|
||||
@@ -109,8 +116,5 @@ export const actions = {
|
||||
|
||||
return { etag, error };
|
||||
//await writeFile(filePath, Buffer.from(await data.file.arrayBuffer()));
|
||||
},
|
||||
get_code: async ({ request }) => {
|
||||
console.log('TO-DO');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -15,6 +15,8 @@ export async function GET({ params }) {
|
||||
|
||||
const name = data.name.slice(prefix.length);
|
||||
if (name === 'config.json') return;
|
||||
// zugangscode datei
|
||||
if (name === '__perm__') return;
|
||||
|
||||
controller.enqueue(`${JSON.stringify({ ...data, name, prefix })}\n`);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user