Compare commits

...

22 Commits
1.0.0 ... main

Author SHA1 Message Date
RedBigz
84ccd8cbfa Update to netstandard2.1 and add CWOffline support
All checks were successful
Build SpookTubeEX / Build (push) Successful in 1m58s
2024-07-01 10:40:02 +10:00
RedBigz
fd81989b75 Fix manifest
All checks were successful
Build SpookTubeEX / Build (push) Successful in 1m34s
2024-06-20 17:28:48 +10:00
RedBigz
b8cba89f90 Fix README and icons
Some checks failed
Build SpookTubeEX / Build (push) Has been cancelled
2024-06-20 17:27:35 +10:00
RedBigz
a12fcad127 Update changelog to match thunderstore
Some checks failed
Build SpookTubeEX / Build (push) Has been cancelled
2024-06-20 15:50:30 +10:00
RedBigz
98ab0e95a1 Notify users of WS errors (God I wish this stupid library let me see HTTP status codes)
All checks were successful
Build SpookTubeEX / Build (push) Successful in 1m53s
2024-06-16 10:05:38 +10:00
RedBigz
4d6a731124 Fix upload artifact version 2024-06-15 12:05:13 +10:00
RedBigz
2384d07a9d Fix artifact name 2024-06-15 11:51:11 +10:00
RedBigz
8aeab3fd9f Fix .NET version 2024-06-15 11:46:46 +10:00
RedBigz
1857e6b14f Add workflow 2024-06-15 11:44:23 +10:00
RedBigz
920a672bce Remove actions workflow 2024-06-12 18:19:56 +10:00
RedBigz
f4eb4f6a06 Fix permissions 2024-06-12 18:18:23 +10:00
RedBigz
725f7e9fc7 Fix naming typo 2024-06-12 18:17:33 +10:00
RedBigz
6f0fcdf6fc Add workflow 2024-06-12 18:15:58 +10:00
RedBigz
5c590489da Add README Fixer 2024-06-12 18:15:52 +10:00
RedBigz
8952997d2d Add custom builder 2024-06-12 08:29:32 +10:00
RedBigz
79bdba573b Add indicator for uploads 2024-06-11 18:56:41 +10:00
RedBigz
440485d4c3 Change to PolyForm license 2024-06-11 16:53:08 +10:00
RedBigz
89dfc14d4e Remove unused traverses 2024-06-11 16:03:02 +10:00
RedBigz
0cb2ee2c56 Update Branding 2024-06-10 16:19:11 +10:00
RedBigz
972fb40395 Make uploader log-friendly 2024-06-10 15:58:30 +10:00
RedBigz
eaf7c19138 Make Upload Threaded 2024-06-10 08:32:16 +10:00
RedBigz
89f4a7debe Use Application.OpenURL instead of System.Diagnostics.Process.Start 2024-06-09 18:56:44 +10:00
18 changed files with 331 additions and 405 deletions

27
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,27 @@
name: Build SpookTubeEX
run-name: ${{ github.actor }} started a deployment
on: [push]
jobs:
compile:
name: Build
runs-on: ubuntu-latest
steps:
- name: Clone the repo
uses: actions/checkout@v4
- name: Copy Game Assemblies (Totally Legal)
run: cp -r /cw/* ${{ github.workspace }}/lib
- name: Install .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.203"
- name: Restore Solution
run: dotnet restore
- name: Build Solution
run: dotnet build -c release
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: SpookTubeEX
path: |
${{ github.workspace }}/bin/Release/net472/com.redbigz.SpookTubeEX.dll

3
.gitignore vendored
View File

@ -2,6 +2,9 @@
lib/*
!lib/.gitkeep
.build
SpookTubeEX.zip
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##

481
LICENSE
View File

@ -1,373 +1,164 @@
Mozilla Public License Version 2.0
==================================
# PolyForm Shield License 1.0.0
1. Definitions
--------------
<https://polyformproject.org/licenses/shield/1.0.0>
1.1. "Contributor"
means each individual or legal entity that creates, contributes to
the creation of, or owns Covered Software.
## Acceptance
1.2. "Contributor Version"
means the combination of the Contributions of others (if any) used
by a Contributor and that particular Contributor's Contribution.
In order to get any license under these terms, you must agree
to them as both strict obligations and conditions to all
your licenses.
1.3. "Contribution"
means Covered Software of a particular Contributor.
## Copyright License
1.4. "Covered Software"
means Source Code Form to which the initial Contributor has attached
the notice in Exhibit A, the Executable Form of such Source Code
Form, and Modifications of such Source Code Form, in each case
including portions thereof.
The licensor grants you a copyright license for the
software to do everything you might do with the software
that would otherwise infringe the licensor's copyright
in it for any permitted purpose. However, you may
only distribute the software according to [Distribution
License](#distribution-license) and make changes or new works
based on the software according to [Changes and New Works
License](#changes-and-new-works-license).
1.5. "Incompatible With Secondary Licenses"
means
## Distribution License
(a) that the initial Contributor has attached the notice described
in Exhibit B to the Covered Software; or
The licensor grants you an additional copyright license
to distribute copies of the software. Your license
to distribute covers distributing the software with
changes and new works permitted by [Changes and New Works
License](#changes-and-new-works-license).
(b) that the Covered Software was made available under the terms of
version 1.1 or earlier of the License, but not also under the
terms of a Secondary License.
## Notices
1.6. "Executable Form"
means any form of the work other than Source Code Form.
You must ensure that anyone who gets a copy of any part of
the software from you also gets a copy of these terms or the
URL for them above, as well as copies of any plain-text lines
beginning with `Required Notice:` that the licensor provided
with the software. For example:
1.7. "Larger Work"
means a work that combines Covered Software with other material, in
a separate file or files, that is not Covered Software.
> Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
1.8. "License"
means this document.
## Changes and New Works License
1.9. "Licensable"
means having the right to grant, to the maximum extent possible,
whether at the time of the initial grant or subsequently, any and
all of the rights conveyed by this License.
The licensor grants you an additional copyright license to
make changes and new works based on the software for any
permitted purpose.
1.10. "Modifications"
means any of the following:
## Patent License
(a) any file in Source Code Form that results from an addition to,
deletion from, or modification of the contents of Covered
Software; or
The licensor grants you a patent license for the software that
covers patent claims the licensor can license, or becomes able
to license, that you would infringe by using the software.
(b) any new file in Source Code Form that contains any Covered
Software.
## Noncompete
1.11. "Patent Claims" of a Contributor
means any patent claim(s), including without limitation, method,
process, and apparatus claims, in any patent Licensable by such
Contributor that would be infringed, but for the grant of the
License, by the making, using, selling, offering for sale, having
made, import, or transfer of either its Contributions or its
Contributor Version.
Any purpose is a permitted purpose, except for providing any
product that competes with the software or any product the
licensor or any of its affiliates provides using the software.
1.12. "Secondary License"
means either the GNU General Public License, Version 2.0, the GNU
Lesser General Public License, Version 2.1, the GNU Affero General
Public License, Version 3.0, or any later versions of those
licenses.
## Competition
1.13. "Source Code Form"
means the form of the work preferred for making modifications.
Goods and services compete even when they provide functionality
through different kinds of interfaces or for different technical
platforms. Applications can compete with services, libraries
with plugins, frameworks with development tools, and so on,
even if they're written in different programming languages
or for different computer architectures. Goods and services
compete even when provided free of charge. If you market a
product as a practical substitute for the software or another
product, it definitely competes.
1.14. "You" (or "Your")
means an individual or a legal entity exercising rights under this
License. For legal entities, "You" includes any entity that
controls, is controlled by, or is under common control with You. For
purposes of this definition, "control" means (a) the power, direct
or indirect, to cause the direction or management of such entity,
whether by contract or otherwise, or (b) ownership of more than
fifty percent (50%) of the outstanding shares or beneficial
ownership of such entity.
## New Products
2. License Grants and Conditions
--------------------------------
If you are using the software to provide a product that does
not compete, but the licensor or any of its affiliates brings
your product into competition by providing a new version of
the software or another product using the software, you may
continue using versions of the software available under these
terms beforehand to provide your competing product, but not
any later versions.
2.1. Grants
## Discontinued Products
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license:
You may begin using the software to compete with a product
or service that the licensor or any of its affiliates has
stopped providing, unless the licensor includes a plain-text
line beginning with `Licensor Line of Business:` with the
software that mentions that line of business. For example:
(a) under intellectual property rights (other than patent or trademark)
Licensable by such Contributor to use, reproduce, make available,
modify, display, perform, distribute, and otherwise exploit its
Contributions, either on an unmodified basis, with Modifications, or
as part of a Larger Work; and
> Licensor Line of Business: YoyodyneCMS Content Management
System (http://example.com/cms)
(b) under Patent Claims of such Contributor to make, use, sell, offer
for sale, have made, import, and otherwise transfer either its
Contributions or its Contributor Version.
## Sales of Business
2.2. Effective Date
If the licensor or any of its affiliates sells a line of
business developing the software or using the software
to provide a product, the buyer can also enforce
[Noncompete](#noncompete) for that product.
The licenses granted in Section 2.1 with respect to any Contribution
become effective for each Contribution on the date the Contributor first
distributes such Contribution.
## Fair Use
2.3. Limitations on Grant Scope
You may have "fair use" rights for the software under the
law. These terms do not limit them.
The licenses granted in this Section 2 are the only rights granted under
this License. No additional rights or licenses will be implied from the
distribution or licensing of Covered Software under this License.
Notwithstanding Section 2.1(b) above, no patent license is granted by a
Contributor:
(a) for any code that a Contributor has removed from Covered Software;
or
(b) for infringements caused by: (i) Your and any other third party's
modifications of Covered Software, or (ii) the combination of its
Contributions with other software (except as part of its Contributor
Version); or
(c) under Patent Claims infringed by Covered Software in the absence of
its Contributions.
This License does not grant any rights in the trademarks, service marks,
or logos of any Contributor (except as may be necessary to comply with
the notice requirements in Section 3.4).
2.4. Subsequent Licenses
No Contributor makes additional grants as a result of Your choice to
distribute the Covered Software under a subsequent version of this
License (see Section 10.2) or under the terms of a Secondary License (if
permitted under the terms of Section 3.3).
2.5. Representation
Each Contributor represents that the Contributor believes its
Contributions are its original creation(s) or it has sufficient rights
to grant the rights to its Contributions conveyed by this License.
2.6. Fair Use
This License is not intended to limit any rights You have under
applicable copyright doctrines of fair use, fair dealing, or other
equivalents.
2.7. Conditions
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
in Section 2.1.
3. Responsibilities
-------------------
3.1. Distribution of Source Form
All distribution of Covered Software in Source Code Form, including any
Modifications that You create or to which You contribute, must be under
the terms of this License. You must inform recipients that the Source
Code Form of the Covered Software is governed by the terms of this
License, and how they can obtain a copy of this License. You may not
attempt to alter or restrict the recipients' rights in the Source Code
Form.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then:
(a) such Covered Software must also be made available in Source Code
Form, as described in Section 3.1, and You must inform recipients of
the Executable Form how they can obtain a copy of such Source Code
Form by reasonable means in a timely manner, at a charge no more
than the cost of distribution to the recipient; and
(b) You may distribute such Executable Form under the terms of this
License, or sublicense it under different terms, provided that the
license for the Executable Form does not attempt to limit or alter
the recipients' rights in the Source Code Form under this License.
3.3. Distribution of a Larger Work
You may create and distribute a Larger Work under terms of Your choice,
provided that You also comply with the requirements of this License for
the Covered Software. If the Larger Work is a combination of Covered
Software with a work governed by one or more Secondary Licenses, and the
Covered Software is not Incompatible With Secondary Licenses, this
License permits You to additionally distribute such Covered Software
under the terms of such Secondary License(s), so that the recipient of
the Larger Work may, at their option, further distribute the Covered
Software under the terms of either this License or such Secondary
License(s).
3.4. Notices
You may not remove or alter the substance of any license notices
(including copyright notices, patent notices, disclaimers of warranty,
or limitations of liability) contained within the Source Code Form of
the Covered Software, except that You may alter any license notices to
the extent required to remedy known factual inaccuracies.
3.5. Application of Additional Terms
You may choose to offer, and to charge a fee for, warranty, support,
indemnity or liability obligations to one or more recipients of Covered
Software. However, You may do so only on Your own behalf, and not on
behalf of any Contributor. You must make it absolutely clear that any
such warranty, support, indemnity, or liability obligation is offered by
You alone, and You hereby agree to indemnify every Contributor for any
liability incurred by such Contributor as a result of warranty, support,
indemnity or liability terms You offer. You may include additional
disclaimers of warranty and limitations of liability specific to any
jurisdiction.
4. Inability to Comply Due to Statute or Regulation
---------------------------------------------------
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Software due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description must
be placed in a text file included with all distributions of the Covered
Software under this License. Except to the extent prohibited by statute
or regulation, such description must be sufficiently detailed for a
recipient of ordinary skill to be able to understand it.
5. Termination
--------------
5.1. The rights granted under this License will terminate automatically
if You fail to comply with any of its terms. However, if You become
compliant, then the rights granted under this License from a particular
Contributor are reinstated (a) provisionally, unless and until such
Contributor explicitly and finally terminates Your grants, and (b) on an
ongoing basis, if such Contributor fails to notify You of the
non-compliance by some reasonable means prior to 60 days after You have
come back into compliance. Moreover, Your grants from a particular
Contributor are reinstated on an ongoing basis if such Contributor
notifies You of the non-compliance by some reasonable means, this is the
first time You have received notice of non-compliance with this License
from such Contributor, and You become compliant prior to 30 days after
Your receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions,
counter-claims, and cross-claims) alleging that a Contributor Version
directly or indirectly infringes any patent, then the rights granted to
You by any and all Contributors for the Covered Software under Section
2.1 of this License shall terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
end user license agreements (excluding distributors and resellers) which
have been validly granted by You or Your distributors under this License
prior to termination shall survive termination.
************************************************************************
* *
* 6. Disclaimer of Warranty *
* ------------------------- *
* *
* Covered Software is provided under this License on an "as is" *
* basis, without warranty of any kind, either expressed, implied, or *
* statutory, including, without limitation, warranties that the *
* Covered Software is free of defects, merchantable, fit for a *
* particular purpose or non-infringing. The entire risk as to the *
* quality and performance of the Covered Software is with You. *
* Should any Covered Software prove defective in any respect, You *
* (not any Contributor) assume the cost of any necessary servicing, *
* repair, or correction. This disclaimer of warranty constitutes an *
* essential part of this License. No use of any Covered Software is *
* authorized under this License except under this disclaimer. *
* *
************************************************************************
************************************************************************
* *
* 7. Limitation of Liability *
* -------------------------- *
* *
* Under no circumstances and under no legal theory, whether tort *
* (including negligence), contract, or otherwise, shall any *
* Contributor, or anyone who distributes Covered Software as *
* permitted above, be liable to You for any direct, indirect, *
* special, incidental, or consequential damages of any character *
* including, without limitation, damages for lost profits, loss of *
* goodwill, work stoppage, computer failure or malfunction, or any *
* and all other commercial damages or losses, even if such party *
* shall have been informed of the possibility of such damages. This *
* limitation of liability shall not apply to liability for death or *
* personal injury resulting from such party's negligence to the *
* extent applicable law prohibits such limitation. Some *
* jurisdictions do not allow the exclusion or limitation of *
* incidental or consequential damages, so this exclusion and *
* limitation may not apply to You. *
* *
************************************************************************
8. Litigation
-------------
Any litigation relating to this License may be brought only in the
courts of a jurisdiction where the defendant maintains its principal
place of business and such litigation shall be governed by laws of that
jurisdiction, without reference to its conflict-of-law provisions.
Nothing in this Section shall prevent a party's ability to bring
cross-claims or counter-claims.
9. Miscellaneous
----------------
This License represents the complete agreement concerning the subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. Any law or regulation which provides
that the language of a contract shall be construed against the drafter
shall not be used to construe this License against a Contributor.
10. Versions of the License
---------------------------
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section
10.3, no one other than the license steward has the right to modify or
publish new versions of this License. Each version will be given a
distinguishing version number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version
of the License under which You originally received the Covered Software,
or under the terms of any subsequent version published by the license
steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to
create a new license for such software, you may create and use a
modified version of this License if you rename the license and remove
any references to the name of the license steward (except to note that
such modified license differs from this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary
Licenses
If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the
notice described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
-------------------------------------------
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to look
for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------
This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.
## No Other Rights
These terms do not allow you to sublicense or transfer any of
your licenses to anyone else, or prevent the licensor from
granting licenses to anyone else. These terms do not imply
any other licenses.
## Patent Defense
If you make any written claim that the software infringes or
contributes to infringement of any patent, your patent license
for the software granted under these terms ends immediately. If
your company makes such a claim, your patent license ends
immediately for work on behalf of your company.
## Violations
The first time you are notified in writing that you have
violated any of these terms, or done anything with the software
not covered by your licenses, your licenses can nonetheless
continue if you come into full compliance with these terms,
and take practical steps to correct past violations, within
32 days of receiving notice. Otherwise, all your licenses
end immediately.
## No Liability
***As far as the law allows, the software comes as is, without
any warranty or condition, and the licensor will not be liable
to you for any damages arising out of these terms or the use
or nature of the software, under any kind of legal claim.***
## Definitions
The **licensor** is the individual or entity offering these
terms, and the **software** is the software the licensor makes
available under these terms.
A **product** can be a good or service, or a combination
of them.
**You** refers to the individual or entity agreeing to these
terms.
**Your company** is any legal entity, sole proprietorship,
or other kind of organization that you work for, plus all
its affiliates.
**Affiliates** means the other organizations than an
organization has control over, is under the control of, or is
under common control with.
**Control** means ownership of substantially all the assets of
an entity, or the power to direct its management and policies
by vote, contract, or otherwise. Control can be direct or
indirect.
**Your licenses** are all the licenses granted to you for the
software under these terms.
**Use** means anything you do with the software requiring one
of your licenses.

View File

@ -6,12 +6,16 @@ using UnityEngine.UI;
using TMPro;
using Photon.Pun;
using BepInEx.Logging;
using UnityEngine.Localization.PropertyVariants;
using System;
using CWOffline;
namespace SpookTubeEX;
[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
[BepInIncompatibility("me.loaforc.Flashcard")] // No flashcard support
[ContentWarningPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, true)]
[BepInDependency("CWOffline", BepInDependency.DependencyFlags.HardDependency)]
public class Plugin : BaseUnityPlugin
{
Harmony harmony;
@ -29,10 +33,10 @@ public class Plugin : BaseUnityPlugin
URL = Config.Bind("Networking", "WebsocketURL", "wss://spook.redbigz.com/api/upload", "The ws[s]:// URL.");
// Plugin startup logic
Logger.LogInfo($"Spooktube has loaded.");
Logger.LogInfo($"SpookTubeEX has loaded.");
// Create patches
harmony = new("com.redbigz.SpookedTubePatch");
harmony = new("com.redbigz.SpookTubeEXPatch");
harmony.PatchAll();
}
@ -40,7 +44,7 @@ public class Plugin : BaseUnityPlugin
{
harmony.UnpatchSelf();
Logger.LogInfo($"Spooktube has unloaded."); // Unpatch everything
Logger.LogInfo($"SpookTubeEX has unloaded."); // Unpatch everything
}
}
@ -50,16 +54,19 @@ class ReplayPatch
[HarmonyPrefix]
static bool Prefix(UploadCompleteUI __instance)
{
if (CWOfflineAPI.IsGameOffline())
{
Modal.ShowError("Upload Error", "Your device is offline.");
return false;
}
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 SpookTube.");
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");
@ -71,10 +78,22 @@ class ReplayPatch
SpookedUploader uploader = new();
uploader.Upload(video, views, comments, () =>
TextMeshProUGUI uploadingStatus = Util.FindObject(UploadingState, "Text (TMP) (1)").GetComponent<TextMeshProUGUI>();
uploadingStatus.richText = true;
string uploadingStatusDefaultText = "UPLOADING VIDEO...";
Action<string> setTextViewable = (string text) =>
{
uploadingStatus.SetText($"{uploadingStatusDefaultText}\n{text}");
};
setTextViewable("<color=#C68E17>ESTABLISHING CONNECTION</color>");
uploader.Upload(video, setTextViewable, () =>
{
UploadingState.SetActive(false);
uploadingStatus.SetText(uploadingStatusDefaultText);
// Util.FindObject(Util.FindObject(__instance.m_videoPlayer.transform.parent.parent.parent.parent.parent.gameObject, "SaveVideoToDesktopInteractable"), "CloseInt").GetComponent<CloseVideoInteractable>().Interact(null);
UploadVideoStationStateMachine stateMachine = new Traverse(GameObject.Find("/Tools/UploadMachine2").GetComponent<UploadVideoStation>()).Field("m_stateMachine").GetValue() as UploadVideoStationStateMachine;
stateMachine.SwitchState<UploadVideoState>();
@ -94,7 +113,7 @@ class VideoEndedUIInjection
GameObject text = GameObject.Find("VideoDone/Replay/Text (TMP)");
text.GetComponent<UnityEngine.Localization.PropertyVariants.GameObjectLocalizer>()
.enabled = false; // Disable Localiser
.enabled = false; // Disable Localise
TextMeshProUGUI comp = text.GetComponent<TextMeshProUGUI>();
@ -106,5 +125,15 @@ class VideoEndedUIInjection
GameObject SaveImageElement = Util.FindObject(Util.FindObject(VideoDone, "SaveVideo"), "Image");
GameObject ImageElement = Util.FindObject(Replay, "Image");
ImageElement.GetComponent<Image>().sprite = SaveImageElement.GetComponent<Image>().sprite;
Util.FindObject(
Util.FindObject(
VideoDone.transform.parent.parent.parent.gameObject,
"UploadingState"
),
"Text (TMP) (1)"
)
.GetComponent<UnityEngine.Localization.PropertyVariants.GameObjectLocalizer>()
.enabled = false;
}
}

View File

@ -19,7 +19,7 @@
This mod essentially replaces your replay button with an upload button which allows you to share your videos around the globe.
![Compatibility](img/titles/compatiblity.gif)
![Compatibility](img/titles/compatibility.gif)
This mod **DOES** support:
- Avatar Mods

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<TargetFramework>netstandard2.1</TargetFramework>
<AssemblyName>com.redbigz.SpookTubeEX</AssemblyName>
<Product>SpookTubeEX</Product>
<Description>Upload your videos to a website and watch others' videos!</Description>
@ -75,5 +75,9 @@
<Reference Include="Photon3Unity3D">
<HintPath>./lib/Photon3Unity3D.dll</HintPath>
</Reference>
<Reference Include="CWOffline">
<HintPath>./apis/CWOffline.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

View File

@ -3,9 +3,11 @@ using System.Collections.Generic;
using System.Data.Common;
using System.IO;
using System.Linq;
using System.Threading;
using HarmonyLib;
using Photon.Pun;
using Steamworks;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEngine.UIElements.Collections;
using WebSocketSharp;
@ -15,8 +17,59 @@ namespace SpookTubeEX;
class SpookedUploader
{
void UploadThread(MessageEventArgs evt, WebSocket ws, string path, string uuid, Action<string> setViewableLogText)
{
// Begin Upload
byte[] byteArray = File.ReadAllBytes(path);
int offset = 0;
const int chunkSize = 512000;
var expectedChunks = Math.Ceiling((double)byteArray.Length / chunkSize);
while (byteArray.Length > offset * chunkSize)
{
byte[] buffer = byteArray.Skip(offset * chunkSize).Take(chunkSize).ToArray();
offset += 1;
ShowStatus(setViewableLogText, uuid, "stream", $"{offset}/{expectedChunks}");
Plugin.Logger.LogInfo($"(UPLOAD {uuid}) - {offset}/{expectedChunks} (~{Math.Ceiling((double)buffer.Length / 1000)} KB)");
List<byte> msgList = new List<byte>();
msgList.AddRange(new byte[1] { 36 });
msgList.AddRange(buffer);
ws.Send(msgList.ToArray());
}
}
void ShowStatus(Action<string> setViewableLogText, string uuid, string logType, string message = "")
{
if (uuid.Length == 0) uuid = "...";
string msg = "";
switch (logType) {
case "error":
msg = $"<color=red>{message}</color>\n<color=red><size=50%>CHECK CONSOLE FOR MORE DETAILS</size></color>";
break;
case "stream":
msg = $"STREAMING VIDEO ({message})";
break;
case "complete":
msg = $"<color=#2E8B57>UPLOAD COMPLETE</color>";
break;
default:
msg = message;
break;
}
setViewableLogText($"{msg}\n<mspace=0.13em><size=20%>UUID: {uuid.ToUpper()}</size></mspace>");
}
WebSocket ws;
public void Upload(IPlayableVideo cameraRecording, int views, CommentUI[] comments, Action onUpload)
public void Upload(IPlayableVideo cameraRecording, Action<string> setViewableLogText, Action onUpload)
{
if (cameraRecording.TryGetVideoPath(out string path))
{
@ -26,22 +79,6 @@ 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 = "";
@ -49,52 +86,45 @@ class SpookedUploader
ws.OnMessage += (sender, evt) =>
{
ws.Send(evt.Data);
// Plugin.Logger.LogInfo("WS MESSAGE: " + evt.Data);
if (evt.Data.StartsWith("url:")) viewableUrl = evt.Data.Substring(4);
if (evt.Data.StartsWith("uuid:"))
if (evt.Data.StartsWith("url:")) // Set viewable URL for browser open
{
viewableUrl = evt.Data.Substring(4);
Plugin.Logger.LogInfo($"Server reports origin as {viewableUrl}.");
}
if (evt.Data.StartsWith("uuid:")) // Set UUID
{
uuid = evt.Data.Substring(5);
// Begin Upload
byte[] byteArray = File.ReadAllBytes(path);
ShowStatus(setViewableLogText, uuid, "stream", "0/?");
Plugin.Logger.LogInfo($"Your video has been assigned the UUID {uuid}. Beginning upload...");
int offset = 0;
const int chunkSize = 512000;
while (byteArray.Length > offset * chunkSize)
{
byte[] buffer = byteArray.Skip(offset * chunkSize).Take(chunkSize).ToArray();
offset += 1;
ws.Send($"Bytes: {buffer.Length}");
List<byte> msgList = new List<byte>();
msgList.AddRange(new byte[1] { 36 });
msgList.AddRange(buffer);
ws.Send(msgList.ToArray());
}
// Start upload thread
new Thread(new ThreadStart(() => UploadThread(evt, ws, path, uuid, setViewableLogText))).Start();
}
if (evt.Data.StartsWith("fin"))
if (evt.Data.StartsWith("fin")) // On upload complete
{
ws.Close();
// Plugin.ModalProxy("Upload Complete", $"Video uploaded to {viewableUrl}! ({uuid})");
System.Diagnostics.Process.Start($"{viewableUrl}/#{uuid}");
onUpload();
ShowStatus(setViewableLogText, uuid, "complete");
Plugin.Logger.LogInfo($"Upload Complete. Redirecting to {viewableUrl}...");
Application.OpenURL($"{viewableUrl}/#{uuid}");
}
if (evt.Data.StartsWith("us"))
if (evt.Data.StartsWith("us")) // On heuristics error
{
Plugin.Logger.LogError("SpookTubeEX has experienced a heuristics error. Please contact ModMail at https://discord.gg/Gw2f86B2vC with this UUID in your ticket request: " + uuid + "\nThis is an automated service, so trolling will get your IP blocked from accessing anything with SpookTubeEX and your Discord account banned from the server. DO NOT SHARE THIS UUID WITH ANYONE!");
ShowStatus(setViewableLogText, uuid, "error", "HEUR ERROR");
Plugin.Logger.LogError($"SpookTubeEX has experienced a heuristics error. Please contact ModMail at https://discord.gg/Gw2f86B2vC with this UUID in your ticket request: {uuid}\nThis is an automated service, so trolling will get your IP blocked from accessing anything with SpookTubeEX and your Discord account banned from the server. DO NOT SHARE THIS UUID WITH ANYONE!");
}
};
ws.OnError += (sender, evt) =>
{
UnityEngine.Debug.LogError(evt.Message);
ShowStatus(setViewableLogText, uuid, "error", "WS ERROR");
Plugin.Logger.LogError(evt.Message);
};
ws.OnOpen += (sender, evt) =>
@ -103,7 +133,13 @@ class SpookedUploader
ws.Send(SteamUser.GetSteamID().m_SteamID.ToString());
};
ws.Connect();
ws.OnClose += (sender, evt) => {
onUpload();
};
Plugin.Logger.LogInfo($"Connecting to {ws.Url}...");
ws.ConnectAsync();
}
}
}

BIN
apis/CWOffline.dll Normal file

Binary file not shown.

7
build.sh Normal file
View File

@ -0,0 +1,7 @@
mkdir -p .build/BepInEx/plugins
cp buildResources/* .build
cp README.md .build
sed -i -e "s/img\//https\:\/\/git.redbigz.com\/SpookTube\/SpookTubeEX\/media\/branch\/main\/img\//g" .build/README.md
dotnet build -c release
cp -r bin/Release/netstandard2.1/com.redbigz.SpookTubeEX.dll .build/BepInEx/plugins
jar -cf SpookTubeEX.zip -C .build/ .

View File

@ -0,0 +1,20 @@
### 1.1.2
- Minor README changes
### 1.1.1
- Show more errors on the TV screen
### 1.1.0
- Add indicators during upload
### 1.0.3
- Made logs more readable
### 1.0.2
- Fixed RCE vulnerability in browser opener
### 1.0.1
- Fix file structure
### 1.0.0
- First release

BIN
buildResources/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -0,0 +1,9 @@
{
"name": "SpookTubeEX",
"description": "Submit your home videos of monsters to THE DEEP DARK WEB and share them, completely for free!*",
"version_number": "1.1.2",
"website_url": "https://spook.redbigz.com/",
"dependencies": [
"BepInEx-BepInExPack-5.4.2100"
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 773 KiB

After

Width:  |  Height:  |  Size: 2.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 441 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 525 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 616 KiB

After

Width:  |  Height:  |  Size: 354 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 KiB

After

Width:  |  Height:  |  Size: 58 KiB