diff --git a/src/public/assets/custom/css/index.css b/src/public/assets/custom/css/index.css index 93f9bf4..013124a 100644 --- a/src/public/assets/custom/css/index.css +++ b/src/public/assets/custom/css/index.css @@ -120,3 +120,7 @@ .am5-modal-content { color: #000000 !important; } + +.tab-pane > p{ + padding-top: 15px; +} diff --git a/src/public/index.ejs b/src/public/index.ejs index 2f0cb8f..ecb2151 100644 --- a/src/public/index.ejs +++ b/src/public/index.ejs @@ -185,7 +185,7 @@
-import fetch, {fileFrom, FormData} from 'node-fetch';
+ For Node, there is an official SDK that provides access to all of the features of the site.
+ WaifuVault Node API
+
+import Waifuvault from "waifuvault-node-api";
// upload file
-const formData = new FormData();
-const blob = await fileFrom('./src/input.txt');
-formData.set('file', blob);
-const response = await fetch("<%- process.env.BASE_URL; -%>/rest", {
- method: 'PUT',
- body: formData
+const resp = await Waifuvault.uploadFile({
+ file: "./files/aCoolFile.jpg"
});
-const data = await response.json(); // object
+console.log(resp.url); // the file download URL
// upload via URL
-const encodedParams = new URLSearchParams();
-encodedParams.set('url', 'https://victorique.moe/img/slider/Quotes.jpg');
-const response = await fetch("<%- process.env.BASE_URL; -%>/rest", {
- method: 'PUT',
- body: encodedParams
+const resp = await Waifuvault.uploadFile({
+ url: "https://waifuvault.moe/assets/custom/images/08.png"
});
-const data = await response.json(); // object
+console.log(resp.url); // the file download URL
+
+// upload a buffer
+const resp = await Waifuvault.uploadFile({
+ file: Buffer.from("someData"),
+ filename: "aCoolFile.jpg"
+});
+console.log(resp.url); // the file download URL
For Python, there is an official SDK that provides access to all of the features of the site.
+ WaifuVault Python API
-import requests
-from requests_toolbelt import MultipartEncoder
+import waifuvault
+import io
# upload file
-multipart_data = MultipartEncoder(
- fields={
- 'file': ('input.txt', open('./src/input.txt', 'rb'), 'text/plain')
- }
-)
-response = requests.put("<%- process.env.BASE_URL; -%>/rest", data=multipart_data, headers={'Content-Type': multipart_data.content_type})
-data = response.json()
+upload_file = waifuvault.FileUpload("./files/aCoolFile.png")
+upload_res = waifuvault.upload_file(upload_file)
+print(f"{upload_res.url}")
# upload via URL
-response = requests.put(
- "<%- process.env.BASE_URL; -%>/rest",
- data={'url': 'https://victorique.moe/img/slider/Quotes.jpg'}
-)
-data = response.json()
+upload_file = waifuvault.FileUpload("https://waifuvault.moe/assets/custom/images/08.png")
+upload_res = waifuvault.upload_file(upload_file)
+print(f"{upload_res.url}")
+
+# upload a buffer
+with open("./files/aCoolFile.png", "rb") as fh:
+ buf = io.BytesIO(fh.read())
+
+upload_file = waifuvault.FileUpload(buf, "aCoolFile.png")
+upload_res = waifuvault.upload_file(upload_file)
+print(f"{upload_res.url}")