Initial commit

This commit is contained in:
2026-02-16 10:59:11 -05:00
commit fe40e8b980
6 changed files with 103 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
eol=lf
+36
View File
@@ -0,0 +1,36 @@
# threads-client
A Roblox server-side client for the [Threads](https://github.com/filoxen/threads) service. Handles reuploading clothing assets through your Threads instance.
## Installation
Add to your `wally.toml` dependencies:
```toml
[server-dependencies]
ThreadsClient = "secret-rare/threads-client@0.1.0"
```
Then run:
```bash
wally install
```
## Setup
1. Add your API key to the **Secrets Store** in the Creator Dashboard with the name `THREADS_API_KEY` (or your own custom secret name).
2. Update `BASE_URL` in the module to point to your Threads API instance.
## Usage
```luau
local ThreadsClient = require(path.to.ThreadsClient)
local newAssetId = ThreadsClient.create(assetId)
if newAssetId ~= -1 then
print("Reuploaded to:", newAssetId)
end
```
+6
View File
@@ -0,0 +1,6 @@
{
"name": "threads-client",
"tree": {
"$path": "src"
}
}
+7
View File
@@ -0,0 +1,7 @@
# This file lists tools managed by Rokit, a toolchain manager for Roblox projects.
# For more information, see https://github.com/rojo-rbx/rokit
# New tools can be added by running `rokit add <tool>` in a terminal.
[tools]
wally = "UpliftGames/wally@0.3.2"
+45
View File
@@ -0,0 +1,45 @@
local HttpService = game:GetService("HttpService")
local clothing_upload = {}
-- Change this to your own Threads API instance URL
local BASE_URL = "https://threads.example.com"
-- Name of the secret in the Secrets Store (Creator Dashboard -> Secrets).
local API_KEY_SECRET_NAME = "THREADS_API_KEY"
local API_KEY = HttpService:GetSecret(API_KEY_SECRET_NAME)
-- Sends a reupload request to the Threads API for the given asset ID. Returns the new asset ID, or -1 on failure.
function clothing_upload.create(id: number): number
local create_url = `{BASE_URL}/create/?asset_id={id}`
local request_data = {
Url = create_url,
Method = "POST",
Headers = {
["Content-Type"] = "application/json",
["x-api-key"] = API_KEY
}
}
local success, response = pcall(function()
return HttpService:RequestAsync(request_data)
end)
if success and response.Success then
local response_data = HttpService:JSONDecode(response.Body)
if response_data["uploaded"] then
local newAssetId = tonumber(response_data["uploaded"]["asset_id"]) :: number
print(`[ClothingUploadClient] Successfully reuploaded asset {id} -> {newAssetId}`)
return newAssetId
else
warn(`[ClothingUploadClient] Reupload failed for asset {id}: Response missing 'uploaded' field`)
end
else
local errorMsg = if response then response.StatusMessage else "Unknown Error"
warn(`[ClothingUploadClient] API request failed for asset {id}: {errorMsg}`)
end
return -1
end
return clothing_upload
+8
View File
@@ -0,0 +1,8 @@
[package]
name = "secret-rare/threads-client"
version = "0.1.0"
registry = "https://github.com/UpliftGames/wally-index"
license = "GPL-3.0"
realm = "server"
[dependencies]