Add identification

This commit is contained in:
RedBigz 2024-06-04 17:11:41 +10:00
parent d8c2617c66
commit 52a40f2fb0
3 changed files with 40 additions and 5 deletions

View File

@ -16,10 +16,12 @@ public class Plugin : BaseUnityPlugin
public static ConfigEntry<string> URL;
// public static void ModalProxy(string title, string message) => Modal.ShowError(title, message);
private void Awake()
{
// Config
URL = Config.Bind("Networking", "WebsocketURL", "ws://127.0.0.1:3000/", "The ws[s]:// URL.");
URL = Config.Bind("Networking", "WebsocketURL", "ws://spook.redbigz.com/api/upload", "The ws[s]:// URL.");
// Plugin startup logic
Logger.LogInfo($"Spooktube has loaded.");
@ -45,14 +47,14 @@ class ReplayPatch
{
if (!PhotonNetwork.IsMasterClient)
{
Modal.ShowError("Upload Error", "Only the host can upload videos to SpookedTube.");
// Modal.ShowError("Upload Error", "Only the host can upload videos to SpookedTube.");
return false;
}
IPlayableVideo video = new Traverse(__instance).Field("m_replayVideo").GetValue() as IPlayableVideo;
int views = new Traverse(__instance).Field("m_replayViews").GetValue<int>();
CommentUI[] comments = new Traverse(__instance).Field("m_replayComments").GetValue() as CommentUI[];
GameObject States = __instance.m_videoPlayer.transform.parent.parent.parent.gameObject;
GameObject ShowVideoState = Util.FindObject(States, "ShowVideoState");

View File

@ -60,6 +60,10 @@
<HintPath>./lib/PhotonUnityNetworking.dll</HintPath>
</Reference>
<Reference Include="PhotonRealtime">
<HintPath>./lib/PhotonRealtime.dll</HintPath>
</Reference>
<Reference Include="com.rlabrecque.steamworks.net">
<HintPath>./lib/com.rlabrecque.steamworks.net.dll</HintPath>
</Reference>
@ -67,5 +71,9 @@
<Reference Include="websocket-sharp">
<HintPath>./lib/websocket-sharp.dll</HintPath>
</Reference>
<Reference Include="Photon3Unity3D">
<HintPath>./lib/Photon3Unity3D.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

View File

@ -1,9 +1,13 @@
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.IO;
using System.Linq;
using HarmonyLib;
using Photon.Pun;
using Steamworks;
using UnityEngine.UIElements;
using UnityEngine.UIElements.Collections;
using WebSocketSharp;
namespace SpookedTube;
@ -22,6 +26,22 @@ class SpookedUploader
return;
}
// Get co-conspirators lmao
// string[] coconspirators = new string[PhotonNetwork.CurrentRoom.PlayerCount];
// foreach (KeyValuePair<int, Photon.Realtime.Player> player in PhotonNetwork.CurrentRoom.Players)
// {
// // if (player.Value.IsMasterClient) continue;
// coconspirators.AddItem(player.Value.NickName);
// // if (player.Value.CustomProperties.ContainsKey("SteamID"))
// // {
// // player.Value.CustomProperties["SteamID"]
// // }
// }
// string[] coconspirators = PhotonNetwork.CurrentRoom.Players.Select((player) => player.Value.NickName) as string[];
ws = new WebSocket(Plugin.URL.Value);
string viewableUrl = "";
@ -61,10 +81,15 @@ class SpookedUploader
if (evt.Data.StartsWith("fin"))
{
ws.Close();
// Plugin.ModalProxy("Upload Complete", $"Video uploaded to {viewableUrl}! ({uuid})");
System.Diagnostics.Process.Start($"https://{viewableUrl}/#{uuid}");
// Modal.ShowError("Upload Complete", $"Video uploaded to {viewableUrl}! ({uuid})");
onUpload();
}
if (evt.Data.StartsWith("us"))
{
// Modal.ShowError("Unsafe Upload", "The server responded with an HEUR error. Your file has not been uploaded due to security reasons. If you believe this was an error, contact st.appeals.vid@redbigz.com with this ID:\n4cedcd69-b5e4-4cda-9142-104009841695\n\nYour appeal will be rejected if:\n- Your video uses mods such as Flashcard\n\nYour IP address will be banned if:\n- Your video contains illicit content\n- Your video contains sexual imagery\n\nYour email address WILL be blocked if you troll the email address above. It is an automated service and your address will be blacklisted, along with your IP address if it has connections to your email.");
}
};
ws.OnError += (sender, evt) =>
@ -74,7 +99,7 @@ class SpookedUploader
ws.OnOpen += (sender, evt) =>
{
UnityEngine.Debug.Log(SteamUser.GetSteamID().m_SteamID.ToString());
ws.Send("persona:" + SteamFriends.GetPersonaName());
ws.Send(SteamUser.GetSteamID().m_SteamID.ToString());
};