Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rassets

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rassets - npm Package Compare versions

Comparing version 1.1.3 to 1.2.0

src/interfaces/IAssetUploadRequestHidden.ts

2

package.json
{
"name": "rassets",
"version": "1.1.3",
"version": "1.2.0",
"description": "A simple Typescript wrapper to upload assets.",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -27,5 +27,11 @@ # RAssets

## upload
This function allows you to upload any asset (CURRENTLY BROKEN)
This function allows you to upload any asset (working) using the "hidden" api endpoint - http://data.roblox.com/Data/Upload.ashx. If you specify an assetid that you own, you may even overwrite that asset
```ts
const uploadAsset = await RAssets.upload(cookie, {content: testImage, name: "test", type: "png"}, {mime: "image/png", assetTypeId: "11"})
const uploadAsset = await RAssets.upload(cookie, {content: testModel, name: "test", type: "rbxm"}, {
assetType: "Model",
name: "test",
description: "test",
ispublic: true,
allowcomments: true
})
```

@@ -47,2 +47,3 @@ export enum AssetType {

Video = "62"
}
}

@@ -5,2 +5,3 @@ // Dependencies

import { IAssetUploadFile, IAssetUploadRequest } from "./interfaces/IAssetUploadRequest";
import { IAssetUploadRequestHidden } from "./interfaces/IAssetUploadRequestHidden";
import { IAudioRequest } from "./interfaces/IAudioRequest";

@@ -99,48 +100,30 @@ import { IAudioResponse } from "./interfaces/IAudioResponse";

// Upload an asset - broken have no idea how to fix this
export async function upload(cookie: string, file: IAssetUploadFile, data: IAssetUploadRequest){
// Get verification token
const RequestVerificationToken = await RAssets.getRequestVerificationToken(cookie)
// Upload an asset - using hidden api :flushed: (ACTUALLY WORKS)
export async function upload(cookie: string, file: IAssetUploadFile, data: IAssetUploadRequestHidden){
// Get CSRF
const xcsrf = await RAssets.getCSRF(cookie)
if (!xcsrf){
throw(new Error("Invalid cookie"))
}
// Form Data
const form = new formdata()
form.append("__RequestVerificationToken", RequestVerificationToken)
form.append("assetTypeId", data.assetTypeId)
form.append("isOggUploadEnabled", data.isOggUploadEnabled || "True")
form.append("groupId", data.groupId || "")
form.append("onVerificationPage", data.onVerificationPage || "False")
form.append("captchaEnabled", data.captchaEnabled || "False")
form.append("captchaToken", data.captchaToken || "")
form.append("captchaProvider", data.captchaProvider || "")
form.append("file", file.content, {
filename: `${file.name}.${file.type}`,
contentType: data.mime,
})
form.append("name", file.name)
// Body
const body = form.getBuffer().toString("base64")
// Send request
const response = await got.post("https://roblox.com/build/upload", {
followRedirect: false,
const response = await got.post("http://data.roblox.com/Data/Upload.ashx", {
headers: {
Host: "www.roblox.com",
Cookie: `.ROBLOSECURITY=${cookie}; __RequestVerificationToken=${RequestVerificationToken};`,
"Content-Length": body.length.toString(),
"Content-Type": `multipart/form-data; boundary=${form.getBoundary()}`,
"Content-Transfer-Encoding": "base64"
"User-Agent": "Roblox/WinInet",
Cookie: `.ROBLOSECURITY=${cookie};`,
"x-csrf-token": xcsrf
},
body: body
body: file.content,
searchParams: {
assetid: data.assetid || 0,
type: data.assetType,
name: data.name,
description: data.description,
ispublic: data.ispublic,
allowcomments: data.allowcomments
}
})
// Getting the redirect URL + SoundId
const url = response.body.match(/<a href="(.+?)">here</) || ["Error", "Error"]
const soundId = response.body.match(/uploadedId=(.+?)">here</) || ["Error", "Error"]
console.log(url[1])
console.log(soundId[1])
// Returning SoundId
return soundId[1]
//
return response.body
}

@@ -147,0 +130,0 @@

// Dependencies
import * as fs from "fs"
import { AssetType } from "../src/enum/AssetType"
import RAssets from "../src/index"

@@ -11,2 +10,3 @@

const testImage = fs.readFileSync("./test/test.png")
const testModel = fs.readFileSync("./test/test.rbxm")
const cookie = ""

@@ -24,9 +24,15 @@

// Upload Asset
//const uploadAsset = await RAssets.upload(cookie, {content: testImage, name: "test", type: "png"}, {mime: "image/png", assetTypeId: AssetType.Image})
const uploadAsset = await RAssets.upload(cookie, {content: testModel, name: "test", type: "rbxm"}, {
assetType: "Model",
name: "test",
description: "test",
ispublic: true,
allowcomments: true
})
// Test
const verifyAudio = await RAssets.verifyAudio(cookie, {file: testAudio.toString("base64"), paymentSource: "User"})
//const verifyAudio = await RAssets.verifyAudio(cookie, {file: testAudio.toString("base64"), paymentSource: "User"})
//
console.log(verifyAudio)
console.log(uploadAsset)
})()

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc