mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-11 20:08:37 +00:00
refactor(infra): directory structure (#4615)
This commit is contained in:
16
packages/backend/server/scripts/gen-auth-key.ts
Normal file
16
packages/backend/server/scripts/gen-auth-key.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import crypto from 'node:crypto';
|
||||
|
||||
const { privateKey, publicKey } = crypto.generateKeyPairSync('ec', {
|
||||
namedCurve: 'prime256v1',
|
||||
publicKeyEncoding: {
|
||||
type: 'spki',
|
||||
format: 'pem',
|
||||
},
|
||||
privateKeyEncoding: {
|
||||
type: 'pkcs8',
|
||||
format: 'pem',
|
||||
},
|
||||
});
|
||||
|
||||
console.log('ECDSA Public Key:\n', publicKey);
|
||||
console.log('ECDSA Private Key:\n', privateKey);
|
||||
23
packages/backend/server/scripts/init-db.ts
Normal file
23
packages/backend/server/scripts/init-db.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import userA from '@affine-test/fixtures/userA.json' assert { type: 'json' };
|
||||
import { hash } from '@node-rs/argon2';
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
async function main() {
|
||||
await prisma.user.create({
|
||||
data: {
|
||||
...userA,
|
||||
password: await hash(userA.password),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
main()
|
||||
.then(async () => {
|
||||
await prisma.$disconnect();
|
||||
})
|
||||
.catch(async e => {
|
||||
console.error(e);
|
||||
await prisma.$disconnect();
|
||||
process.exit(1);
|
||||
});
|
||||
18
packages/backend/server/scripts/test-send-local-mail.ts
Normal file
18
packages/backend/server/scripts/test-send-local-mail.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { createTransport } from 'nodemailer';
|
||||
|
||||
const transport = createTransport({
|
||||
host: '0.0.0.0',
|
||||
port: 1025,
|
||||
secure: false,
|
||||
auth: {
|
||||
user: 'himself65',
|
||||
pass: '123456',
|
||||
},
|
||||
});
|
||||
|
||||
await transport.sendMail({
|
||||
from: 'noreply@toeverything.info',
|
||||
to: 'himself65@outlook.com',
|
||||
subject: 'test',
|
||||
html: `<div>hello world</div>`,
|
||||
});
|
||||
Reference in New Issue
Block a user