feat(cleanup): removed built application
This commit is contained in:
parent
157b06ea4b
commit
bdc4616106
23 changed files with 2 additions and 210 deletions
12
src/icons/dist/app.d.ts
vendored
12
src/icons/dist/app.d.ts
vendored
|
|
@ -1,12 +0,0 @@
|
|||
import { AutoloadPluginOptions } from '@fastify/autoload';
|
||||
import { FastifyPluginAsync } from 'fastify';
|
||||
export type AppOptions = {} & Partial<AutoloadPluginOptions>;
|
||||
declare const options: AppOptions;
|
||||
declare module 'fastify' {
|
||||
interface FastifyInstance {
|
||||
image_store: string;
|
||||
}
|
||||
}
|
||||
declare const app: FastifyPluginAsync<AppOptions>;
|
||||
export default app;
|
||||
export { app, options };
|
||||
31
src/icons/dist/app.js
vendored
31
src/icons/dist/app.js
vendored
|
|
@ -1,31 +0,0 @@
|
|||
import * as path from 'node:path';
|
||||
import AutoLoad from '@fastify/autoload';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import fastifyFormBody from '@fastify/formbody';
|
||||
import fastifyMultipart from '@fastify/multipart';
|
||||
import { mkdir } from 'node:fs/promises';
|
||||
import fp from 'fastify-plugin';
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
const options = {};
|
||||
const app = async (fastify, opts) => {
|
||||
void fastify.register(fastifyFormBody, {});
|
||||
void fastify.register(fastifyMultipart, {});
|
||||
void fastify.register(fp(async (fastify) => {
|
||||
const image_store = process.env.USER_ICONS_STORE ?? "/tmp/icons";
|
||||
fastify.decorate('image_store', image_store);
|
||||
await mkdir(fastify.image_store, { recursive: true });
|
||||
}));
|
||||
void fastify.register(AutoLoad, {
|
||||
dir: path.join(__dirname, 'plugins'),
|
||||
options: opts,
|
||||
forceESM: true
|
||||
});
|
||||
void fastify.register(AutoLoad, {
|
||||
dir: path.join(__dirname, 'routes'),
|
||||
options: opts,
|
||||
forceESM: true
|
||||
});
|
||||
};
|
||||
export default app;
|
||||
export { app, options };
|
||||
1
src/icons/dist/app.js.map
vendored
1
src/icons/dist/app.js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,KAAK,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE;QAC/B,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC;QACpC,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;KACd,CAAC,CAAA;IAKF,KAAK,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE;QAC/B,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC;QACnC,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;KACd,CAAC,CAAA;AAEH,CAAC,CAAA;AAED,eAAe,GAAG,CAAA;AAClB,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,CAAA"}
|
||||
3
src/icons/dist/plugins/sensible.d.ts
vendored
3
src/icons/dist/plugins/sensible.d.ts
vendored
|
|
@ -1,3 +0,0 @@
|
|||
import sensible from '@fastify/sensible';
|
||||
declare const _default: import("fastify").FastifyPluginCallback<sensible.FastifySensibleOptions, import("fastify").RawServerDefault, import("fastify").FastifyTypeProviderDefault, import("fastify").FastifyBaseLogger>;
|
||||
export default _default;
|
||||
5
src/icons/dist/plugins/sensible.js
vendored
5
src/icons/dist/plugins/sensible.js
vendored
|
|
@ -1,5 +0,0 @@
|
|||
import fp from 'fastify-plugin';
|
||||
import sensible from '@fastify/sensible';
|
||||
export default fp(async (fastify) => {
|
||||
fastify.register(sensible);
|
||||
});
|
||||
1
src/icons/dist/plugins/sensible.js.map
vendored
1
src/icons/dist/plugins/sensible.js.map
vendored
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"sensible.js","sourceRoot":"","sources":["../../src/plugins/sensible.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAC/B,OAAO,QAAoC,MAAM,mBAAmB,CAAA;AAOpE,eAAe,EAAE,CAAyB,KAAK,EAAE,OAAO,EAAE,EAAE;IAC1D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;AAC5B,CAAC,CAAC,CAAA"}
|
||||
3
src/icons/dist/routes/set/index.d.ts
vendored
3
src/icons/dist/routes/set/index.d.ts
vendored
|
|
@ -1,3 +0,0 @@
|
|||
import { FastifyPluginAsync } from 'fastify';
|
||||
declare const example: FastifyPluginAsync;
|
||||
export default example;
|
||||
33
src/icons/dist/routes/set/index.js
vendored
33
src/icons/dist/routes/set/index.js
vendored
|
|
@ -1,33 +0,0 @@
|
|||
import { join } from 'node:path';
|
||||
import { open } from 'node:fs/promises';
|
||||
import fastifyRawBody from 'fastify-raw-body';
|
||||
import sharp from 'sharp';
|
||||
const example = async (fastify, opts) => {
|
||||
await fastify.register(fastifyRawBody, { encoding: false });
|
||||
fastify.post('/:userid', { config: { rawBody: true, encoding: false } }, async function (request, reply) {
|
||||
const userid = request.params['userid'];
|
||||
if (userid === undefined) {
|
||||
return await reply.code(403);
|
||||
}
|
||||
const image_store = fastify.getDecorator('image_store');
|
||||
const image_path = join(image_store, userid);
|
||||
try {
|
||||
let img = sharp(request.rawBody);
|
||||
img.resize({
|
||||
height: 512,
|
||||
width: 512,
|
||||
fit: 'fill',
|
||||
});
|
||||
const data = await img.png({ compressionLevel: 6 }).toBuffer();
|
||||
let image_file = await open(image_path, "w", 0o666);
|
||||
await image_file.write(data);
|
||||
await image_file.close();
|
||||
}
|
||||
catch (e) {
|
||||
fastify.log.error(`Error: ${e}`);
|
||||
reply.code(400);
|
||||
return { status: "error", message: e.toString() };
|
||||
}
|
||||
});
|
||||
};
|
||||
export default example;
|
||||
1
src/icons/dist/routes/set/index.js.map
vendored
1
src/icons/dist/routes/set/index.js.map
vendored
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/routes/set/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACvC,OAAO,cAAc,MAAM,kBAAkB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C;YACjB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;YACjC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAChB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;QACnD,CAAC;IACF,CAAC,CAAC,CAAA;AACH,CAAC,CAAA;AAED,eAAe,OAAO,CAAA"}
|
||||
1
src/icons/dist/run.d.ts
vendored
1
src/icons/dist/run.d.ts
vendored
|
|
@ -1 +0,0 @@
|
|||
export {};
|
||||
14
src/icons/dist/run.js
vendored
14
src/icons/dist/run.js
vendored
|
|
@ -1,14 +0,0 @@
|
|||
import fastify from "fastify";
|
||||
import app from './app.js';
|
||||
const start = async () => {
|
||||
const f = fastify({ logger: true });
|
||||
try {
|
||||
await f.register(app, {});
|
||||
await f.listen({ port: 80, host: '0.0.0.0' });
|
||||
}
|
||||
catch (err) {
|
||||
f.log.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
start();
|
||||
1
src/icons/dist/run.js.map
vendored
1
src/icons/dist/run.js.map
vendored
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"run.js","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAEA,OAAO,OAA4B,MAAM,SAAS,CAAC;AACnD,OAAO,GAAG,MAAM,UAAU,CAAA;AAE1B,MAAM,KAAK,GAAG,KAAK,IAAI,EAAE;IACxB,MAAM,CAAC,GAAoB,OAAO,CAAC,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAC;IACnD,IAAI,CAAC;QACJ,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QAC1B,MAAM,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA;IAC9C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAChB,CAAC;AACF,CAAC,CAAA;AACD,KAAK,EAAE,CAAA"}
|
||||
Loading…
Add table
Add a link
Reference in a new issue