mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 14:29:25 +00:00
[FuckCohtmlResourceHandler] fucking annoying
stop
This commit is contained in:
parent
b5b7ccfe20
commit
b1d8c5b81a
6 changed files with 170 additions and 0 deletions
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk"/>
|
53
FuckCohtmlResourceHandler/HarmonyPatches.cs
Normal file
53
FuckCohtmlResourceHandler/HarmonyPatches.cs
Normal file
|
@ -0,0 +1,53 @@
|
|||
using cohtml;
|
||||
using cohtml.Net;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace NAK.FuckCohtmlResourceHandler.HarmonyPatches;
|
||||
|
||||
class DefaultResourceHandlerPatches
|
||||
{
|
||||
private const string BadgesUrl = "https://files.abidata.io/static_web/Badges/";
|
||||
private const string UserImagesUrl = "https://files.abidata.io/user_images/";
|
||||
private const string WorldImagesUrl = "https://files.abidata.io/user_content/";
|
||||
private const string AllUrl = "https://files.abidata.io/";
|
||||
|
||||
private static Dictionary<string, bool> blockedUrls = new Dictionary<string, bool>();
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
UpdateBlockedUrls();
|
||||
|
||||
FuckCohtmlResourceHandler.EntryBlockBadgesUrl.OnValueChanged += (_, __) => UpdateBlockedUrls();
|
||||
FuckCohtmlResourceHandler.EntryBlockUserImagesUrl.OnValueChanged += (_, __) => UpdateBlockedUrls();
|
||||
FuckCohtmlResourceHandler.EntryBlockWorldImagesUrl.OnValueChanged += (_, __) => UpdateBlockedUrls();
|
||||
FuckCohtmlResourceHandler.EntryBlockAllUrl.OnValueChanged += (_, __) => UpdateBlockedUrls();
|
||||
}
|
||||
|
||||
private static void UpdateBlockedUrls()
|
||||
{
|
||||
blockedUrls[BadgesUrl] = FuckCohtmlResourceHandler.EntryBlockBadgesUrl.Value;
|
||||
blockedUrls[UserImagesUrl] = FuckCohtmlResourceHandler.EntryBlockUserImagesUrl.Value;
|
||||
blockedUrls[WorldImagesUrl] = FuckCohtmlResourceHandler.EntryBlockWorldImagesUrl.Value;
|
||||
blockedUrls[AllUrl] = FuckCohtmlResourceHandler.EntryBlockAllUrl.Value;
|
||||
FuckCohtmlResourceHandler.Logger.Msg("Updated Blocked Urls!");
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(DefaultResourceHandler), nameof(DefaultResourceHandler.OnResourceRequest))]
|
||||
static bool Prefix_DefaultResourceHandler_OnResourceRequest(ref IAsyncResourceRequest request, ref IAsyncResourceResponse response)
|
||||
{
|
||||
if (FuckCohtmlResourceHandler.EntryEnabled.Value)
|
||||
{
|
||||
foreach (var url in blockedUrls)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(url.Key) && request.GetURL().Contains(url.Key) && url.Value)
|
||||
{
|
||||
response.Finish(IAsyncResourceResponse.Status.Failure);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
46
FuckCohtmlResourceHandler/Main.cs
Normal file
46
FuckCohtmlResourceHandler/Main.cs
Normal file
|
@ -0,0 +1,46 @@
|
|||
using MelonLoader;
|
||||
|
||||
namespace NAK.FuckCohtmlResourceHandler;
|
||||
|
||||
public class FuckCohtmlResourceHandler : MelonMod
|
||||
{
|
||||
internal static MelonLogger.Instance Logger;
|
||||
|
||||
public static readonly MelonPreferences_Category Category =
|
||||
MelonPreferences.CreateCategory(nameof(FuckCohtmlResourceHandler));
|
||||
|
||||
public static readonly MelonPreferences_Entry<bool> EntryEnabled =
|
||||
Category.CreateEntry("Enabled", true, description: "Toggle FuckCohtmlResourceHandler entirely.");
|
||||
|
||||
public static readonly MelonPreferences_Entry<bool> EntryBlockBadgesUrl =
|
||||
Category.CreateEntry("BlockBadgesUrl", true, description: "Toggle whether to block Badges URL.");
|
||||
|
||||
public static readonly MelonPreferences_Entry<bool> EntryBlockUserImagesUrl =
|
||||
Category.CreateEntry("BlockUserImagesUrl", false, description: "Toggle whether to block User Images URL.");
|
||||
|
||||
public static readonly MelonPreferences_Entry<bool> EntryBlockWorldImagesUrl =
|
||||
Category.CreateEntry("BlockWorldImagesUrl", false, description: "Toggle whether to block World Images URL.");
|
||||
|
||||
public static readonly MelonPreferences_Entry<bool> EntryBlockAllUrl =
|
||||
Category.CreateEntry("BlockAllUrl", false, description: "Toggle whether to block All content URL.");
|
||||
|
||||
public override void OnInitializeMelon()
|
||||
{
|
||||
Logger = LoggerInstance;
|
||||
HarmonyPatches.DefaultResourceHandlerPatches.Initialize();
|
||||
ApplyPatches(typeof(HarmonyPatches.DefaultResourceHandlerPatches));
|
||||
}
|
||||
|
||||
void ApplyPatches(Type type)
|
||||
{
|
||||
try
|
||||
{
|
||||
HarmonyInstance.PatchAll(type);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LoggerInstance.Msg($"Failed while patching {type.Name}!");
|
||||
LoggerInstance.Error(e);
|
||||
}
|
||||
}
|
||||
}
|
30
FuckCohtmlResourceHandler/Properties/AssemblyInfo.cs
Normal file
30
FuckCohtmlResourceHandler/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using MelonLoader;
|
||||
using NAK.FuckCohtmlResourceHandler.Properties;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyVersion(AssemblyInfoParams.Version)]
|
||||
[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)]
|
||||
[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)]
|
||||
[assembly: AssemblyTitle(nameof(NAK.FuckCohtmlResourceHandler))]
|
||||
[assembly: AssemblyCompany(AssemblyInfoParams.Author)]
|
||||
[assembly: AssemblyProduct(nameof(NAK.FuckCohtmlResourceHandler))]
|
||||
|
||||
[assembly: MelonInfo(
|
||||
typeof(NAK.FuckCohtmlResourceHandler.FuckCohtmlResourceHandler),
|
||||
nameof(NAK.FuckCohtmlResourceHandler),
|
||||
AssemblyInfoParams.Version,
|
||||
AssemblyInfoParams.Author,
|
||||
downloadLink: "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/FuckCohtmlResourceHandler"
|
||||
)]
|
||||
|
||||
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
|
||||
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
||||
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
|
||||
[assembly: HarmonyDontPatchAll]
|
||||
|
||||
namespace NAK.FuckCohtmlResourceHandler.Properties;
|
||||
internal static class AssemblyInfoParams
|
||||
{
|
||||
public const string Version = "1.0.0";
|
||||
public const string Author = "NotAKidoS";
|
||||
}
|
16
FuckCohtmlResourceHandler/README.md
Normal file
16
FuckCohtmlResourceHandler/README.md
Normal file
|
@ -0,0 +1,16 @@
|
|||
# FuckCohtmlResourceHandler
|
||||
|
||||
Dirty AF fix for a super fucking annoying Cohtml bug.
|
||||
|
||||
Thank you bono for the patch.
|
||||
|
||||
---
|
||||
|
||||
Here is the block of text where I tell you this mod is not affiliated or endorsed by ABI.
|
||||
https://documentation.abinteractive.net/official/legal/tos/#7-modding-our-games
|
||||
|
||||
> This mod is an independent creation and is not affiliated with, supported by or approved by Alpha Blend Interactive.
|
||||
|
||||
> Use of this mod is done so at the user's own risk and the creator cannot be held responsible for any issues arising from its use.
|
||||
|
||||
> To the best of my knowledge, I have adhered to the Modding Guidelines established by Alpha Blend Interactive.
|
23
FuckCohtmlResourceHandler/format.json
Normal file
23
FuckCohtmlResourceHandler/format.json
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"_id": -1,
|
||||
"name": "FuckCohtmlResourceHandler",
|
||||
"modversion": "1.0.0",
|
||||
"gameversion": "2022r170p1",
|
||||
"loaderversion": "0.6.1",
|
||||
"modtype": "Mod",
|
||||
"author": "NotAKidoS",
|
||||
"description": "Allows your controllers to track while the SteamVR overlay is open. This also fixes Quest/Touch controllers feeling slow during fast movements.",
|
||||
"searchtags": [
|
||||
"vr",
|
||||
"quest",
|
||||
"controller",
|
||||
"tracking"
|
||||
],
|
||||
"requirements": [
|
||||
"None"
|
||||
],
|
||||
"downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r3/FuckCohtmlResourceHandler.dll",
|
||||
"sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/FuckCohtmlResourceHandler/",
|
||||
"changelog": "Initial Release",
|
||||
"embedcolor": "3498db"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue