From 48b21a9b3a4268d477312f81ff3cbc846338d65f Mon Sep 17 00:00:00 2001 From: Max Richter Date: Mon, 6 Nov 2023 02:36:23 +0100 Subject: [PATCH] fix: some stuff --- package.json | 6 +- pnpm-lock.yaml | 364 ---------------------- src/lib/helpers/{s3.ts => minio.ts} | 6 +- src/routes/api/ai/image/[name]/+server.ts | 4 +- src/routes/api/ai/image/[name]/GET.ts | 25 -- src/routes/api/s3/+server.ts | 8 - 6 files changed, 6 insertions(+), 407 deletions(-) rename src/lib/helpers/{s3.ts => minio.ts} (78%) delete mode 100644 src/routes/api/ai/image/[name]/GET.ts delete mode 100644 src/routes/api/s3/+server.ts diff --git a/package.json b/package.json index 35d7ee3..cf652ff 100644 --- a/package.json +++ b/package.json @@ -32,10 +32,6 @@ "@aws-sdk/client-s3": "^3.441.0", "@sveltejs/adapter-node": "^1.3.1", "minio": "^7.1.3", - "openai": "^4.15.4", - "svelte-particles": "^2.12.0", - "tsparticles": "^2.12.0", - "tsparticles-confetti": "^2.12.0", - "tsparticles-slim": "^2.12.0" + "openai": "^4.15.4" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bdeeeae..e5530ae 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,18 +17,6 @@ dependencies: openai: specifier: ^4.15.4 version: 4.15.4 - svelte-particles: - specifier: ^2.12.0 - version: 2.12.0(svelte@4.2.1) - tsparticles: - specifier: ^2.12.0 - version: 2.12.0 - tsparticles-confetti: - specifier: ^2.12.0 - version: 2.12.0 - tsparticles-slim: - specifier: ^2.12.0 - version: 2.12.0 devDependencies: '@sveltejs/adapter-auto': @@ -3240,15 +3228,6 @@ packages: dependencies: svelte: 4.2.1 - /svelte-particles@2.12.0(svelte@4.2.1): - resolution: {integrity: sha512-DISZn5RNIt7hP9SORogWmXyIA/MCha6kkcwRCa7fl3leD1+GFHeNMSjdmyhqlfgip82g17WUFxwyA8n/8EM5KQ==} - peerDependencies: - svelte: '>=3' - dependencies: - svelte: 4.2.1 - tsparticles-engine: 2.12.0 - dev: false - /svelte-preprocess@5.0.4(postcss@8.4.31)(svelte@4.2.1)(typescript@5.2.2): resolution: {integrity: sha512-ABia2QegosxOGsVlsSBJvoWeXy1wUKSfF7SWJdTjLAbx/Y3SrVevvvbFNQqrSJw89+lNSsM58SipmZJ5SRi5iw==} engines: {node: '>= 14.10.0'} @@ -3362,349 +3341,6 @@ packages: /tslib@2.6.2: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} - /tsparticles-basic@2.12.0: - resolution: {integrity: sha512-pN6FBpL0UsIUXjYbiui5+IVsbIItbQGOlwyGV55g6IYJBgdTNXgFX0HRYZGE9ZZ9psEXqzqwLM37zvWnb5AG9g==} - dependencies: - tsparticles-engine: 2.12.0 - tsparticles-move-base: 2.12.0 - tsparticles-shape-circle: 2.12.0 - tsparticles-updater-color: 2.12.0 - tsparticles-updater-opacity: 2.12.0 - tsparticles-updater-out-modes: 2.12.0 - tsparticles-updater-size: 2.12.0 - dev: false - - /tsparticles-confetti@2.12.0: - resolution: {integrity: sha512-PsxBL1DjYNNZecFFcymivnPypuxHKh0ePz2/9CctKl6zwS+Z8cHBCoszg8jBx6PJDJkAxIa76taezd54caISYg==} - dependencies: - tsparticles-basic: 2.12.0 - tsparticles-engine: 2.12.0 - tsparticles-plugin-emitters: 2.12.0 - tsparticles-plugin-motion: 2.12.0 - tsparticles-shape-cards: 2.12.0 - tsparticles-shape-heart: 2.12.0 - tsparticles-shape-image: 2.12.0 - tsparticles-shape-polygon: 2.12.0 - tsparticles-shape-square: 2.12.0 - tsparticles-shape-star: 2.12.0 - tsparticles-shape-text: 2.12.0 - tsparticles-updater-life: 2.12.0 - tsparticles-updater-roll: 2.12.0 - tsparticles-updater-rotate: 2.12.0 - tsparticles-updater-tilt: 2.12.0 - tsparticles-updater-wobble: 2.12.0 - dev: false - - /tsparticles-engine@2.12.0: - resolution: {integrity: sha512-ZjDIYex6jBJ4iMc9+z0uPe7SgBnmb6l+EJm83MPIsOny9lPpetMsnw/8YJ3xdxn8hV+S3myTpTN1CkOVmFv0QQ==} - requiresBuild: true - dev: false - - /tsparticles-interaction-external-attract@2.12.0: - resolution: {integrity: sha512-0roC6D1QkFqMVomcMlTaBrNVjVOpyNzxIUsjMfshk2wUZDAvTNTuWQdUpmsLS4EeSTDN3rzlGNnIuuUQqyBU5w==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-interaction-external-bounce@2.12.0: - resolution: {integrity: sha512-MMcqKLnQMJ30hubORtdq+4QMldQ3+gJu0bBYsQr9BsThsh8/V0xHc1iokZobqHYVP5tV77mbFBD8Z7iSCf0TMQ==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-interaction-external-bubble@2.12.0: - resolution: {integrity: sha512-5kImCSCZlLNccXOHPIi2Yn+rQWTX3sEa/xCHwXW19uHxtILVJlnAweayc8+Zgmb7mo0DscBtWVFXHPxrVPFDUA==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-interaction-external-connect@2.12.0: - resolution: {integrity: sha512-ymzmFPXz6AaA1LAOL5Ihuy7YSQEW8MzuSJzbd0ES13U8XjiU3HlFqlH6WGT1KvXNw6WYoqrZt0T3fKxBW3/C3A==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-interaction-external-grab@2.12.0: - resolution: {integrity: sha512-iQF/A947hSfDNqAjr49PRjyQaeRkYgTYpfNmAf+EfME8RsbapeP/BSyF6mTy0UAFC0hK2A2Hwgw72eT78yhXeQ==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-interaction-external-pause@2.12.0: - resolution: {integrity: sha512-4SUikNpsFROHnRqniL+uX2E388YTtfRWqqqZxRhY0BrijH4z04Aii3YqaGhJxfrwDKkTQlIoM2GbFT552QZWjw==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-interaction-external-push@2.12.0: - resolution: {integrity: sha512-kqs3V0dgDKgMoeqbdg+cKH2F+DTrvfCMrPF1MCCUpBCqBiH+TRQpJNNC86EZYHfNUeeLuIM3ttWwIkk2hllR/Q==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-interaction-external-remove@2.12.0: - resolution: {integrity: sha512-2eNIrv4m1WB2VfSVj46V2L/J9hNEZnMgFc+A+qmy66C8KzDN1G8aJUAf1inW8JVc0lmo5+WKhzex4X0ZSMghBg==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-interaction-external-repulse@2.12.0: - resolution: {integrity: sha512-rSzdnmgljeBCj5FPp4AtGxOG9TmTsK3AjQW0vlyd1aG2O5kSqFjR+FuT7rfdSk9LEJGH5SjPFE6cwbuy51uEWA==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-interaction-external-slow@2.12.0: - resolution: {integrity: sha512-2IKdMC3om7DttqyroMtO//xNdF0NvJL/Lx7LDo08VpfTgJJozxU+JAUT8XVT7urxhaDzbxSSIROc79epESROtA==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-interaction-external-trail@2.12.0: - resolution: {integrity: sha512-LKSapU5sPTaZqYx+y5VJClj0prlV7bswplSFQaIW1raXkvsk45qir2AVcpP5JUhZSFSG+SwsHr+qCgXhNeN1KA==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-interaction-particles-attract@2.12.0: - resolution: {integrity: sha512-Hl8qwuwF9aLq3FOkAW+Zomu7Gb8IKs6Y3tFQUQScDmrrSCaeRt2EGklAiwgxwgntmqzL7hbMWNx06CHHcUQKdQ==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-interaction-particles-collisions@2.12.0: - resolution: {integrity: sha512-Se9nPWlyPxdsnHgR6ap4YUImAu3W5MeGKJaQMiQpm1vW8lSMOUejI1n1ioIaQth9weKGKnD9rvcNn76sFlzGBA==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-interaction-particles-links@2.12.0: - resolution: {integrity: sha512-e7I8gRs4rmKfcsHONXMkJnymRWpxHmeaJIo4g2NaDRjIgeb2AcJSWKWZvrsoLnm7zvaf/cMQlbN6vQwCixYq3A==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-move-base@2.12.0: - resolution: {integrity: sha512-oSogCDougIImq+iRtIFJD0YFArlorSi8IW3HD2gO3USkH+aNn3ZqZNTqp321uB08K34HpS263DTbhLHa/D6BWw==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-move-parallax@2.12.0: - resolution: {integrity: sha512-58CYXaX8Ih5rNtYhpnH0YwU4Ks7gVZMREGUJtmjhuYN+OFr9FVdF3oDIJ9N6gY5a5AnAKz8f5j5qpucoPRcYrQ==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-particles.js@2.12.0: - resolution: {integrity: sha512-LyOuvYdhbUScmA4iDgV3LxA0HzY1DnOwQUy3NrPYO393S2YwdDjdwMod6Btq7EBUjg9FVIh+sZRizgV5elV2dg==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-plugin-absorbers@2.12.0: - resolution: {integrity: sha512-2CkPreaXHrE5VzFlxUKLeRB5t66ff+3jwLJoDFgQcp+R4HOEITo0bBZv2DagGP0QZdYN4grpnQzRBVdB4d1rWA==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-plugin-easing-quad@2.12.0: - resolution: {integrity: sha512-2mNqez5pydDewMIUWaUhY5cNQ80IUOYiujwG6qx9spTq1D6EEPLbRNAEL8/ecPdn2j1Um3iWSx6lo340rPkv4Q==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-plugin-emitters@2.12.0: - resolution: {integrity: sha512-fbskYnaXWXivBh9KFReVCfqHdhbNQSK2T+fq2qcGEWpwtDdgujcaS1k2Q/xjZnWNMfVesik4IrqspcL51gNdSA==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-plugin-motion@2.12.0: - resolution: {integrity: sha512-VeS0VDV5wc9a4t0xkPi3lkHqOvKRlELq4mEEvaIk8WwgOcx05TUZcJIIbhftnNabqgpHrZ4iUP5Nb2wZ3DBwWQ==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-shape-cards@2.12.0: - resolution: {integrity: sha512-4mSV1C7c/7SsSbS4A5HJEZE5tB2fOAEUXm52uagzBVMbL/YI+XkjOpi7L6JtCNcBKrWnZ/IgnnLMyyFGhNc4pA==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-shape-circle@2.12.0: - resolution: {integrity: sha512-L6OngbAlbadG7b783x16ns3+SZ7i0SSB66M8xGa5/k+YcY7zm8zG0uPt1Hd+xQDR2aNA3RngVM10O23/Lwk65Q==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-shape-heart@2.12.0: - resolution: {integrity: sha512-OK8CJrCY0Z6YAedyfTQh52u7KsurkP8eLNWDW11BhqcvDQkfwJC5g25Y3VrcW9Rwc88hrbNwFQlsKbY6tOn7qA==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-shape-image@2.12.0: - resolution: {integrity: sha512-iCkSdUVa40DxhkkYjYuYHr9MJGVw+QnQuN5UC+e/yBgJQY+1tQL8UH0+YU/h0GHTzh5Sm+y+g51gOFxHt1dj7Q==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-shape-line@2.12.0: - resolution: {integrity: sha512-RcpKmmpKlk+R8mM5wA2v64Lv1jvXtU4SrBDv3vbdRodKbKaWGGzymzav1Q0hYyDyUZgplEK/a5ZwrfrOwmgYGA==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-shape-polygon@2.12.0: - resolution: {integrity: sha512-5YEy7HVMt1Obxd/jnlsjajchAlYMr9eRZWN+lSjcFSH6Ibra7h59YuJVnwxOxAobpijGxsNiBX0PuGQnB47pmA==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-shape-square@2.12.0: - resolution: {integrity: sha512-33vfajHqmlODKaUzyPI/aVhnAOT09V7nfEPNl8DD0cfiNikEuPkbFqgJezJuE55ebtVo7BZPDA9o7GYbWxQNuw==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-shape-star@2.12.0: - resolution: {integrity: sha512-4sfG/BBqm2qBnPLASl2L5aBfCx86cmZLXeh49Un+TIR1F5Qh4XUFsahgVOG0vkZQa+rOsZPEH04xY5feWmj90g==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-shape-text@2.12.0: - resolution: {integrity: sha512-v2/FCA+hyTbDqp2ymFOe97h/NFb2eezECMrdirHWew3E3qlvj9S/xBibjbpZva2gnXcasBwxn0+LxKbgGdP0rA==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-slim@2.12.0: - resolution: {integrity: sha512-27w9aGAAAPKHvP4LHzWFpyqu7wKyulayyaZ/L6Tuuejy4KP4BBEB4rY5GG91yvAPsLtr6rwWAn3yS+uxnBDpkA==} - dependencies: - tsparticles-basic: 2.12.0 - tsparticles-engine: 2.12.0 - tsparticles-interaction-external-attract: 2.12.0 - tsparticles-interaction-external-bounce: 2.12.0 - tsparticles-interaction-external-bubble: 2.12.0 - tsparticles-interaction-external-connect: 2.12.0 - tsparticles-interaction-external-grab: 2.12.0 - tsparticles-interaction-external-pause: 2.12.0 - tsparticles-interaction-external-push: 2.12.0 - tsparticles-interaction-external-remove: 2.12.0 - tsparticles-interaction-external-repulse: 2.12.0 - tsparticles-interaction-external-slow: 2.12.0 - tsparticles-interaction-particles-attract: 2.12.0 - tsparticles-interaction-particles-collisions: 2.12.0 - tsparticles-interaction-particles-links: 2.12.0 - tsparticles-move-base: 2.12.0 - tsparticles-move-parallax: 2.12.0 - tsparticles-particles.js: 2.12.0 - tsparticles-plugin-easing-quad: 2.12.0 - tsparticles-shape-circle: 2.12.0 - tsparticles-shape-image: 2.12.0 - tsparticles-shape-line: 2.12.0 - tsparticles-shape-polygon: 2.12.0 - tsparticles-shape-square: 2.12.0 - tsparticles-shape-star: 2.12.0 - tsparticles-shape-text: 2.12.0 - tsparticles-updater-color: 2.12.0 - tsparticles-updater-life: 2.12.0 - tsparticles-updater-opacity: 2.12.0 - tsparticles-updater-out-modes: 2.12.0 - tsparticles-updater-rotate: 2.12.0 - tsparticles-updater-size: 2.12.0 - tsparticles-updater-stroke-color: 2.12.0 - dev: false - - /tsparticles-updater-color@2.12.0: - resolution: {integrity: sha512-KcG3a8zd0f8CTiOrylXGChBrjhKcchvDJjx9sp5qpwQK61JlNojNCU35xoaSk2eEHeOvFjh0o3CXWUmYPUcBTQ==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-updater-destroy@2.12.0: - resolution: {integrity: sha512-6NN3dJhxACvzbIGL4dADbYQSZJmdHfwjujj1uvnxdMbb2x8C/AZzGxiN33smo4jkrZ5VLEWZWCJPJ8aOKjQ2Sg==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-updater-life@2.12.0: - resolution: {integrity: sha512-J7RWGHAZkowBHpcLpmjKsxwnZZJ94oGEL2w+wvW1/+ZLmAiFFF6UgU0rHMC5CbHJT4IPx9cbkYMEHsBkcRJ0Bw==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-updater-opacity@2.12.0: - resolution: {integrity: sha512-YUjMsgHdaYi4HN89LLogboYcCi1o9VGo21upoqxq19yRy0hRCtx2NhH22iHF/i5WrX6jqshN0iuiiNefC53CsA==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-updater-out-modes@2.12.0: - resolution: {integrity: sha512-owBp4Gk0JNlSrmp12XVEeBroDhLZU+Uq3szbWlHGSfcR88W4c/0bt0FiH5bHUqORIkw+m8O56hCjbqwj69kpOQ==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-updater-roll@2.12.0: - resolution: {integrity: sha512-dxoxY5jP4C9x15BxlUv5/Q8OjUPBiE09ToXRyBxea9aEJ7/iMw6odvi1HuT0H1vTIfV7o1MYawjeCbMycvODKQ==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-updater-rotate@2.12.0: - resolution: {integrity: sha512-waOFlGFmEZOzsQg4C4VSejNVXGf4dMf3fsnQrEROASGf1FCd8B6WcZau7JtXSTFw0OUGuk8UGz36ETWN72DkCw==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-updater-size@2.12.0: - resolution: {integrity: sha512-B0yRdEDd/qZXCGDL/ussHfx5YJ9UhTqNvmS5X2rR2hiZhBAE2fmsXLeWkdtF2QusjPeEqFDxrkGiLOsh6poqRA==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-updater-stroke-color@2.12.0: - resolution: {integrity: sha512-MPou1ZDxsuVq6SN1fbX+aI5yrs6FyP2iPCqqttpNbWyL+R6fik1rL0ab/x02B57liDXqGKYomIbBQVP3zUTW1A==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-updater-tilt@2.12.0: - resolution: {integrity: sha512-HDEFLXazE+Zw+kkKKAiv0Fs9D9sRP61DoCR6jZ36ipea6OBgY7V1Tifz2TSR1zoQkk57ER9+EOQbkSQO+YIPGQ==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-updater-twinkle@2.12.0: - resolution: {integrity: sha512-JhK/DO4kTx7IFwMBP2EQY9hBaVVvFnGBvX21SQWcjkymmN1hZ+NdcgUtR9jr4jUiiSNdSl7INaBuGloVjWvOgA==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles-updater-wobble@2.12.0: - resolution: {integrity: sha512-85FIRl95ipD3jfIsQdDzcUC5PRMWIrCYqBq69nIy9P8rsNzygn+JK2n+P1VQZowWsZvk0mYjqb9OVQB21Lhf6Q==} - dependencies: - tsparticles-engine: 2.12.0 - dev: false - - /tsparticles@2.12.0: - resolution: {integrity: sha512-aw77llkaEhcKYUHuRlggA6SB1Dpa814/nrStp9USGiDo5QwE1Ckq30QAgdXU6GRvnblUFsiO750ZuLQs5Y0tVw==} - dependencies: - tsparticles-engine: 2.12.0 - tsparticles-interaction-external-trail: 2.12.0 - tsparticles-plugin-absorbers: 2.12.0 - tsparticles-plugin-emitters: 2.12.0 - tsparticles-slim: 2.12.0 - tsparticles-updater-destroy: 2.12.0 - tsparticles-updater-roll: 2.12.0 - tsparticles-updater-tilt: 2.12.0 - tsparticles-updater-twinkle: 2.12.0 - tsparticles-updater-wobble: 2.12.0 - dev: false - /type-check@0.4.0: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} diff --git a/src/lib/helpers/s3.ts b/src/lib/helpers/minio.ts similarity index 78% rename from src/lib/helpers/s3.ts rename to src/lib/helpers/minio.ts index f44c10a..f10c952 100644 --- a/src/lib/helpers/s3.ts +++ b/src/lib/helpers/minio.ts @@ -1,8 +1,8 @@ -import Minio from 'minio' +import { Client, type ItemBucketMetadata } from 'minio' import { S3_ENDPOINT_URL, S3_SECRET_ACCESS_KEY, S3_BUCKET_NAME, S3_ACCESS_KEY } from "$env/static/private" -const minioClient = new Minio.Client({ +const minioClient = new Client({ endPoint: S3_ENDPOINT_URL, port: 80, useSSL: false, @@ -10,7 +10,7 @@ const minioClient = new Minio.Client({ secretKey: S3_SECRET_ACCESS_KEY, }) -export function putObject(fileName: string, content: Buffer, metadata: Minio.ItemBucketMetadata = {}) { +export function putObject(fileName: string, content: Buffer, metadata: ItemBucketMetadata = {}) { return minioClient.putObject(S3_BUCKET_NAME, fileName, content, metadata); } diff --git a/src/routes/api/ai/image/[name]/+server.ts b/src/routes/api/ai/image/[name]/+server.ts index 91583d7..e62d5ca 100644 --- a/src/routes/api/ai/image/[name]/+server.ts +++ b/src/routes/api/ai/image/[name]/+server.ts @@ -1,15 +1,15 @@ import { json } from "@sveltejs/kit"; import type { RequestHandler } from "./$types"; -import { putObject } from "$lib/helpers/s3"; +import { putObject } from "$lib/helpers/minio"; import { generateImage } from "$lib/helpers/stability"; - export const GET: RequestHandler = async ({ params }) => { const inputName = params.name; const prompt = `realistic profile portrait oil painting of a masked ${inputName}, baroque, Charles Vess, masked ball attire, Charles Vess, opulence, mystery, elegance, medium-length blond hair, darker skin`; const negativePrompt = "blurry, multiple persons, picture frame" + const a = performance.now() const image = await generateImage(prompt, negativePrompt); const duration = performance.now() - a; diff --git a/src/routes/api/ai/image/[name]/GET.ts b/src/routes/api/ai/image/[name]/GET.ts deleted file mode 100644 index e5a8eeb..0000000 --- a/src/routes/api/ai/image/[name]/GET.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { json } from "@sveltejs/kit"; -import type { RequestHandler } from "./$types"; -import { putObject } from "$lib/helpers/s3"; - - - -export const GET: RequestHandler = async ({ params }) => { - - const inputName = params.name; - - const prompt = `upper body realistic portrait oil painting of a masked ${inputName}, Baroque, Charles Vess, masked ball attire, Charles Vess, opulence, mystery, elegance, dark long hair`; - const negativePrompt = "blurry, multiple persons, picture frame"; - - const image = generateImage(prompt, negativePrompt); - - const imageName = `txt2img_${image.seed}.png`; - - const res = await putObject(imageName, Buffer.from(image.base64, 'base64'), { contentType: "image/png" }); - - return json({ - ...res, - url: `https://s3.app.max-richter.dev/silvester23/${imageName}` - }); -}; - diff --git a/src/routes/api/s3/+server.ts b/src/routes/api/s3/+server.ts deleted file mode 100644 index ec67d8e..0000000 --- a/src/routes/api/s3/+server.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { getBuckets } from "$lib/helpers/s3"; -import { json } from "@sveltejs/kit"; -import type { RequestHandler } from "./$types"; - -export const GET: RequestHandler = async () => { - const buckets = await getBuckets() - return json(buckets) -}