Compare commits
No commits in common. "ca51e5810866f885f802cedece88aabfe4cc4269" and "c5421e76f2c32bb6e7edd9ff0dad6d460b64e815" have entirely different histories.
ca51e58108
...
c5421e76f2
15
index.js
15
index.js
|
@ -6,11 +6,6 @@ const port = process.env.SERVER_PORT || 3000;
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
app.set("trust proxy", 1);
|
app.set("trust proxy", 1);
|
||||||
|
|
||||||
app.use((req, res, next) => {
|
|
||||||
console.log(`[${new Date().toLocaleString()}] ${req.ip} ${req.method} ${req.url}`);
|
|
||||||
next();
|
|
||||||
})
|
|
||||||
|
|
||||||
var rateLimits = {};
|
var rateLimits = {};
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,7 +14,6 @@ app.get("/", (req, res) => {
|
||||||
res.sendFile(__dirname + "/static/index.html")
|
res.sendFile(__dirname + "/static/index.html")
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
app.post("/", async (req, res) => {
|
app.post("/", async (req, res) => {
|
||||||
// Impliment a rate limit of 25 requests per minute
|
// Impliment a rate limit of 25 requests per minute
|
||||||
const ip = req.ip;
|
const ip = req.ip;
|
||||||
|
@ -114,7 +108,6 @@ app.post("/", async (req, res) => {
|
||||||
try {
|
try {
|
||||||
let response = await fetch("https://assetdelivery.roblox.com/v1/assets/batch", options);
|
let response = await fetch("https://assetdelivery.roblox.com/v1/assets/batch", options);
|
||||||
let json = await response.json();
|
let json = await response.json();
|
||||||
//console.log(JSON.stringify(json, null, 2));
|
|
||||||
// Build the response object
|
// Build the response object
|
||||||
const responses = req.body.data.reduce((acc, item, index) => {
|
const responses = req.body.data.reduce((acc, item, index) => {
|
||||||
const assetId = item;
|
const assetId = item;
|
||||||
|
@ -126,14 +119,6 @@ app.post("/", async (req, res) => {
|
||||||
message: codes[errorCode].message,
|
message: codes[errorCode].message,
|
||||||
additional: codes[errorCode].description
|
additional: codes[errorCode].description
|
||||||
};
|
};
|
||||||
} else if (json[index].assetTypeId !== 3) {
|
|
||||||
// Return 415, the asset isnt audio
|
|
||||||
acc[assetId] = {
|
|
||||||
status: "failure",
|
|
||||||
code: 415,
|
|
||||||
message: codes[415].message,
|
|
||||||
additional: codes[415].description
|
|
||||||
};
|
|
||||||
} else {
|
} else {
|
||||||
acc[assetId] = {
|
acc[assetId] = {
|
||||||
status: "success",
|
status: "success",
|
||||||
|
|
|
@ -45,8 +45,12 @@
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
<h1>Roblox Audio Asset API Documentation</h1>
|
<h1>Roblox Audio Asset API Documentation</h1>
|
||||||
|
|
||||||
|
<h2>Endpoint</h2>
|
||||||
|
<p><strong>URL:</strong> <code>POST /</code></p>
|
||||||
|
|
||||||
<h2>Request Format</h2>
|
<h2>Request Format</h2>
|
||||||
<p>The request must be sent as JSON with the following format:</p>
|
<p>The request must be sent as JSON with the following format:</p>
|
||||||
<pre>
|
<pre>
|
||||||
|
|
Loading…
Reference in a new issue