mirror of https://github.com/wg-easy/wg-easy
committed by
Bernd Storath
4 changed files with 46 additions and 8 deletions
@ -1,9 +1,31 @@ |
|||||
|
// TODO: check what are missing
|
||||
|
type Client = { |
||||
|
id: string; |
||||
|
name: string; |
||||
|
address: string; |
||||
|
privateKey: string; |
||||
|
publicKey: string; |
||||
|
preSharedKey: string; |
||||
|
createdAt: string; |
||||
|
updatedAt: string; |
||||
|
enabled: boolean; |
||||
|
}; |
||||
|
|
||||
|
type OldConfig = { |
||||
|
server: { |
||||
|
privateKey: string; |
||||
|
publicKey: string; |
||||
|
address: string; |
||||
|
}; |
||||
|
clients: Record<string, Client>; |
||||
|
}; |
||||
|
|
||||
export default defineEventHandler(async (event) => { |
export default defineEventHandler(async (event) => { |
||||
const { file } = await readValidatedBody( |
const { file } = await readValidatedBody(event, validateZod(fileType, event)); |
||||
event, |
const file_ = JSON.parse(file) as OldConfig; |
||||
validateZod(fileType_, event) |
|
||||
); |
|
||||
// TODO: handle migration
|
// TODO: handle migration
|
||||
console.log('fileType_', file); |
console.log('file_', file_); |
||||
|
|
||||
return { success: true }; |
return { success: true }; |
||||
}); |
}); |
||||
|
Loading…
Reference in new issue