Browse Source

WalnutFS

master
Archie 2 weeks ago
parent
commit
9ded0f5b2d
2 changed files with 8 additions and 11 deletions
  1. +3
    -3
      .env.example
  2. +5
    -8
      src/pages/api/avatar.js

+ 3
- 3
.env.example View File

@ -2,9 +2,9 @@ NEXUS_ID=
NEXUS_SECRET=
NEXUS_URI=
ALLESFS_URI=
ALLESFS_ID=
ALLESFS_SECRET=
WALNUTFS_URI=
WALNUTFS_ID=
WALNUTFS_SECRET=
AVATAR_URI=
AVATAR_SECRET=

+ 5
- 8
src/pages/api/avatar.js View File

@ -33,17 +33,14 @@ const api = async (req, res) => {
.png()
.toBuffer();
// Upload to AllesFS
// Upload to WalnutFS
const formData = new FormData();
formData.append("file", img, {
filename: "image",
});
formData.append("public", "true");
formData.append("file", img, { filename: "image" });
const file = (
await axios.post(process.env.ALLESFS_URI, formData.getBuffer(), {
await axios.post(process.env.WALNUTFS_URI, formData.getBuffer(), {
auth: {
username: process.env.ALLESFS_ID,
password: process.env.ALLESFS_SECRET,
username: process.env.WALNUTFS_ID,
password: process.env.WALNUTFS_SECRET,
},
headers: formData.getHeaders(),
})

Loading…
Cancel
Save