From 326c8c9565020bdea751e4f9479aa58658e8e7b6 Mon Sep 17 00:00:00 2001 From: theLMGN Date: Wed, 22 Sep 2021 14:10:35 +0100 Subject: [PATCH] fix nasty bug --- build.sh | 5 ++++- package.json | 2 +- src/index.ts | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 1b6803b..88f9039 100644 --- a/build.sh +++ b/build.sh @@ -28,4 +28,7 @@ cp ../node_modules/node-notifier/vendor/mac.noindex/terminal-notifier.app/Conten cp ../node_modules/systray/traybin/tray_darwin_release mac/notifier cp -r ../rblxRP.app ./ mv mac/* ./rblxRP.app/Contents/MacOS/ -rm -rf mac \ No newline at end of file +rm -rf mac + +zip -9r rblxrp-X.X.X-darwin.zip rblxRP.app +zip -9r rblxrp-X.X.X-win.zip win \ No newline at end of file diff --git a/package.json b/package.json index f5705ef..7cf723b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rblxrp", - "version": "3.1.0", + "version": "3.1.1", "description": " Discord Rich Presence for Roblox", "main": "build/index.js", "bin": "build/index.js", diff --git a/src/index.ts b/src/index.ts index 5eb04b8..34ba49c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,7 +9,7 @@ import {URL} from "url"; import {notify} from "node-notifier"; import {dirname, join} from "path"; import fetch from "node-fetch"; -import { existsSync, fstat, unlinkSync, writeFileSync } from "fs"; +import { existsSync, fstat, mkdirSync, unlinkSync, writeFileSync } from "fs"; import { server } from "./webserver"; import { homedir } from "os"; @@ -27,6 +27,8 @@ function openURL(url) { function updateStudioPlugin() { if (config.studioPresence) { + if (!existsSync(join(homedir(),"Documents","Roblox"))) mkdirSync(join(homedir(),"Documents","Roblox")); + if (!existsSync(join(homedir(),"Documents","Roblox","Plugins"))) mkdirSync(join(homedir(),"Documents","Roblox","Plugins")); writeFileSync(join(homedir(),"Documents","Roblox","Plugins","rblxRPPlugin.lua"), `local a="http://127.0.0.1:5816/"local b=game:GetService("StudioService")local c=game:GetService("ServerStorage")local d=game:GetService("HttpService")local e=game:GetService("Selection")local f=""local g=false;function debugLog(h)if c:FindFirstChild("rblxrpdebug")then print("[rblxRP] "..h)end end;while wait(5)do local i,j=pcall(function()debugLog("pinging..."..a.."pingState")d:PostAsync(a.."pingState","")debugLog("pong")local k=d:UrlEncode(game.GameId or 0)local l=d:UrlEncode(game.Name or"Place1")local m=d:UrlEncode("Working on a game")if b.ActiveScript~=nil then m=d:UrlEncode(b.ActiveScript.Name)end;local n=a.."reportState/"..k.."/"..l.."/"..m;debugLog(n)if n==f and not g then return end;g=true;debugLog("posting..."..n)d:PostAsync(n,"")debugLog("posted state "..n)g=false;f=n end)if not i then debugLog("failed "..j)end end;e.SelectionChanged:Connect(function()if not g then debugLog("forcing next state update")end;g=true end)`) } else { unlinkSync(join(homedir(),"Documents","Roblox","Plugins","rblxRPPlugin.lua"))