feat: Lightsail + svg animation

This commit is contained in:
Zakaria
2026-10-11 14:19:00 -04:00
parent 0036ef7e51
commit ca1e845cb6
40 changed files with 1887 additions and 34 deletions
+35
View File
@@ -14,6 +14,7 @@ import {isServiceType} from '../cloud-spi/serviceCatalog'
import {mapAwsSdkError} from '../adapter-aws/awsErrors'
import {serviceForAccount} from '../cloudProxy'
import {CloudProxyService} from '../service/CloudProxyService'
import {deployLightsailNodeApplication, deployLightsailStaticFiles} from '../services/lightsailDeployment'
// Header (and query-param fallback for direct links such as object downloads)
// used by the frontend to scope every request to an AWS account.
@@ -136,6 +137,40 @@ export function createCloudRoutes(injectedService?: CloudProxyService) {
})
})
app.post('/aws/services/lightsail/resources/:id/static-files', async (c) => {
return withRuntime(c, async () => {
const form = await c.req.formData()
const files = form.getAll('files').filter((entry): entry is File => entry instanceof File)
if (files.length === 0 || files.length !== form.getAll('files').length) {
throw new ValidationError('At least one file is required.')
}
const upload = new FormData()
for (const file of files) {
upload.append('files', file, file.name)
}
return c.json(await deployLightsailStaticFiles(c.req.param('id'), upload))
})
})
app.post('/aws/services/lightsail/resources/:id/node-application', async (c) => {
return withRuntime(c, async () => {
const form = await c.req.formData()
const files = form.getAll('files').filter((entry): entry is File => entry instanceof File)
if (files.length === 0 || files.length !== form.getAll('files').length) {
throw new ValidationError('At least one file or zip archive is required.')
}
const portValue = form.get('port')
const port = typeof portValue === 'string' && /^\d+$/.test(portValue) ? Number(portValue) : 3000
if (port < 1 || port > 65535) throw new ValidationError('Port must be between 1 and 65535.')
const upload = new FormData()
for (const file of files) upload.append('files', file, file.name)
const startCommand = form.get('startCommand')
if (typeof startCommand === 'string' && startCommand.trim()) upload.append('startCommand', startCommand.trim())
upload.append('port', String(port))
return c.json(await deployLightsailNodeApplication(c.req.param('id'), upload))
})
})
app.get('/:cloud/services/nosql/resources/:id/containers', async (c) => {
const cloud = c.req.param('cloud') as CloudProvider
if (!isCloudProvider(cloud)) return c.json({error: 'Unknown cloud'}, 404)