redo s3 generation and add filtering to s3 endpoint
This commit is contained in:
parent
11b2a8aa7c
commit
3b4184b551
2 changed files with 10 additions and 2 deletions
|
@ -49,7 +49,10 @@ function createFile(files: S3File[]) {
|
||||||
// run \`vr s3\` to regenerate this File
|
// run \`vr s3\` to regenerate this File
|
||||||
|
|
||||||
const S3Files = [
|
const S3Files = [
|
||||||
${files.map(file => (`{ "${file.key}" : "${file.url}" }`)).join(",\n ")}
|
${files.map(file => (`{
|
||||||
|
"key" : "${file.key}",
|
||||||
|
"url" : "${file.url}"
|
||||||
|
}`)).join(",\n ")}
|
||||||
]
|
]
|
||||||
|
|
||||||
export default S3Files
|
export default S3Files
|
||||||
|
|
|
@ -5,7 +5,12 @@ export default {
|
||||||
method: ["*"],
|
method: ["*"],
|
||||||
domains: ["dreamland.lio.systems", "localhost:3000"],
|
domains: ["dreamland.lio.systems", "localhost:3000"],
|
||||||
handler: (r: pogo.Request, h: pogo.Toolkit) => {
|
handler: (r: pogo.Request, h: pogo.Toolkit) => {
|
||||||
return S3Files
|
const filter = r.searchParams.get("filter")
|
||||||
|
if (!filter) return S3Files
|
||||||
|
const Files = S3Files.filter(File => {
|
||||||
|
return File.key.startsWith(filter)
|
||||||
|
})
|
||||||
|
return Files
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue