Skip to content

Commit

Permalink
2022.8.25.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SLT-World committed Aug 25, 2022
1 parent 6919437 commit 7e241dc
Show file tree
Hide file tree
Showing 144 changed files with 1,585 additions and 23,437 deletions.
16 changes: 9 additions & 7 deletions SLBr/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public partial class App : Application

//private static Mutex SingleInstanceMutex;

static Mutex mutex = new Mutex(true, "{SLBrSLTBrowser-SLT-WORLD-BROWSER-SLBr}");
//static Mutex mutex = new Mutex(true, "{SLBrSLTBrowser-SLT-WORLD-BROWSER-SLBr}");
[STAThread]
private void Application_Startup(object sender, StartupEventArgs e)
{
Expand All @@ -40,7 +40,7 @@ private void Application_Startup(object sender, StartupEventArgs e)
SelfHost.Main(args);
return;
}
if (mutex.WaitOne(TimeSpan.Zero, true))
/*if (mutex.WaitOne(TimeSpan.Zero, true))
mutex.ReleaseMutex();
else
{
Expand All @@ -51,7 +51,9 @@ private void Application_Startup(object sender, StartupEventArgs e)
IntPtr.Zero,
IntPtr.Zero);
Current.Shutdown();
}
}*/


/*bool IsNewInstance = false;
SingleInstanceMutex = new Mutex(true, "SLBrSLTBrowser", out IsNewInstance);
if (!IsNewInstance)
Expand Down Expand Up @@ -94,7 +96,7 @@ private void Application_Startup(object sender, StartupEventArgs e)
JumpTask PrivateOpenTask = new JumpTask
{
Title = "Open in private mode",
Arguments = "Private",
Arguments = "--private",
//Description = "No browsing history will be saved, in memory cache will be used (Incognito)",
CustomCategory = "Actions",
ApplicationPath = ExecutablePath,
Expand All @@ -103,7 +105,7 @@ private void Application_Startup(object sender, StartupEventArgs e)
JumpTask DeveloperOpenTask = new JumpTask
{
Title = "Open in developer mode",
Arguments = "Developer",
Arguments = "--developer",
//Description = "Access to developer features of SLBr and bypass the i5 processor check",
CustomCategory = "Actions",
ApplicationPath = ExecutablePath,
Expand All @@ -112,7 +114,7 @@ private void Application_Startup(object sender, StartupEventArgs e)
JumpTask ChromiumOpenTask = new JumpTask
{
Title = "Open in chromium mode",
Arguments = "Chromium",
Arguments = "--chromium",
//Description = "Access to developer features of SLBr and bypass the i5 processor check",
CustomCategory = "Actions",
ApplicationPath = ExecutablePath,
Expand All @@ -121,7 +123,7 @@ private void Application_Startup(object sender, StartupEventArgs e)
JumpTask IEOpenTask = new JumpTask
{
Title = "Open in Internet Explorer mode",
Arguments = "IE",
Arguments = "--ie",
//Description = "Access to developer features of SLBr and bypass the i5 processor check",
CustomCategory = "Actions",
ApplicationPath = ExecutablePath,
Expand Down
2 changes: 1 addition & 1 deletion SLBr/Components/ChromiumWebBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace SLBr
{
public class ChromiumWebBrowser : CefSharp.Wpf.ChromiumWebBrowser
{
public ChromiumWebBrowser() : base()
public ChromiumWebBrowser() : base()
{
}
public ChromiumWebBrowser(string path) : base(path)
Expand Down
14 changes: 7 additions & 7 deletions SLBr/Handlers/ContextMenuHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public void OnBeforeContextMenu(IWebBrowser chromiumWebBrowser, IBrowser browser
model.AddItem((CefMenuCommand)26505, "Reset Zoom Level");
model.AddSeparator();
model.AddItem((CefMenuCommand)26506, "Screenshot");
model.AddItem((CefMenuCommand)26511, "Translate to English");
model.AddSeparator();
/*IMenuModel _EditSubMenuModel = model.AddSubMenu(CefMenuCommand.NotFound, "Edit");
_EditSubMenuModel.AddItem(CefMenuCommand.Undo, "Undo");
Expand Down Expand Up @@ -201,21 +202,15 @@ public bool RunContextMenu(IWebBrowser chromiumWebBrowser, IBrowser browser, IFr

webBrowser.Dispatcher.Invoke(() =>
{
var menu = new ContextMenu
{
IsOpen = true
};
var menu = new ContextMenu { IsOpen = true };
RoutedEventHandler handler = null;
handler = (s, e) =>
{
menu.Closed -= handler;
if (!callback.IsDisposed)
{
callback.Cancel();
}
};
menu.Closed += handler;
Expand Down Expand Up @@ -365,6 +360,11 @@ public bool RunContextMenu(IWebBrowser chromiumWebBrowser, IBrowser browser, IFr
chromiumWebBrowser.StartDownload(Parameters.SourceUrl);
break;
}
case (CefMenuCommand)26511:
{
MainWindow.Instance.Translate();
break;
}
}
})
});
Expand Down
4 changes: 4 additions & 0 deletions SLBr/Handlers/JSBindingHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ public string SearchProviderPrefix()
return MainWindow.Instance.MainSave.Get("Search_Engine");
//return "Bruh";
}
public int AdsBlocked() =>
MainWindow.Instance.AdsBlocked;
public int TrackersBlocked() =>
MainWindow.Instance.TrackersBlocked;
public string SayHello(string name) { return $"Hello {name}!"; }

public void PromptExample()
Expand Down
8 changes: 5 additions & 3 deletions SLBr/Handlers/RequestHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ public bool GetAuthCredentials(IWebBrowser chromiumWebBrowser, IBrowser browser,

public bool OnBeforeBrowse(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, IRequest request, bool userGesture, bool isRedirect)
{
if (request.Url.Contains("roblox.com"))
return true;
if (request.Url.StartsWith("weblight://") && bool.Parse(MainWindow.Instance.MainSave.Get("WeblightScheme")))
frame.LoadUrl("https://googleweblight.com/?lite_url=" + Utils.CleanUrl(request.Url.Replace("weblight://", "")));
//if (request.Url.Contains("roblox.com"))
// return true;
//if (request.Url != frame.Url)
// return true;
if (Utils.CanCheck(request.TransitionType) && !Utils.IsProtocolNotHttp(request.Url) && !Utils.IsProgramUrl(request.Url))//(isRedirect || userGesture || frame.IsMain)
{
string Response = MainWindow.Instance._SafeBrowsing.Response(request.Url.Replace("https://googleweblight.com/?lite_url=", ""));
string Response = MainWindow.Instance._SafeBrowsing.Response(request.Url.Replace("https://googleweblight.com/?lite_url=", "").Replace("weblight://", ""));
Utils.SafeBrowsing.ThreatType _ThreatType = Utils.CheckForInternetConnection() ? MainWindow.Instance._SafeBrowsing.GetThreatType(Response) : Utils.SafeBrowsing.ThreatType.Unknown;
if (_ThreatType == Utils.SafeBrowsing.ThreatType.Malware || _ThreatType == Utils.SafeBrowsing.ThreatType.Unwanted_Software)
//chromiumWebBrowser.LoadHtml(File.ReadAllText(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Resources", "Malware.html")), request.Url);
Expand Down
16 changes: 11 additions & 5 deletions SLBr/Handlers/ResourceRequestHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public IResponseFilter GetResourceResponseFilter(IWebBrowser chromiumWebBrowser,
"smartadserver.com", "bidswitch.net", "taboola", "amazon-adsystem.com", "survey.min.js", "survey.js", "social-icons.js", "intergrator.js", "cookie.js", "analytics.js", "ads.js",
"ad.js", "tracker.js", "tracker.ga.js", "tracker.min.js", "bugsnag.min.js", "async-ads.js", "displayad.js", "j.ad", "ads-beacon.js", "adframe.js", "ad-provider.js",
"admanager.js", "adserver", "smartadserver", "usync.js", "moneybid.js", "miner.js", "prebid", "youtube.com/ptracking", "fls.doubleclick.net", "google.com/ads",
"advertising.js", "adsense.js"
"advertising.js", "adsense.js", "track", "plusone.js"
};
FastHashSet<string> Miners = new FastHashSet<string> {
"cryptonight.wasm", "deepminer.js", "deepminer.min.js", "coinhive.min.js", "monero-miner.js", "wasmminer.wasm", "wasmminer.js", "cn-asmjs.min.js", "gridcash.js",
Expand Down Expand Up @@ -104,7 +104,9 @@ public IResponseFilter GetResourceResponseFilter(IWebBrowser chromiumWebBrowser,
"ids.ad.gt", "powerad.ai", "hb.brainlyads.com", "pixel.quantserve.com", "ads.anura.io", "static.getclicky.com",
"ad.turn.com", "rtb.mfadsrvr.com", "ad.mrtnsvr.com", "s.ad.smaato.net", "rtb-csync.smartadserver.com", "ssbsync.smartadserver.com",
"adpush.technoratimedia.com", "pixel.tapad.com", "secure.adnxs.com", "data.adsrvr.org", "px.adhigh.net",
"epnt.ebay.com", "mb.moatads.com", "ad.adsrvr.org", "a.ad.gt", "pixels.ad.gt", "z.moatads.com", "px.moatads.com"
"epnt.ebay.com", "mb.moatads.com", "ad.adsrvr.org", "a.ad.gt", "pixels.ad.gt", "z.moatads.com", "px.moatads.com", "s.pubmine.com", "px.ads.linkedin.com", "p.adsymptotic.com",
"btloader.com", "ad-delivery.net", "ad.doubleclick.net",
"services.vlitag.com", "tag.vlitag.com", "assets.vlitag.com"
};
FastHashSet<string> Analytics = new FastHashSet<string> { "google-analytics.com", "ssl.google-analytics.com",
"stats.wp.com",
Expand Down Expand Up @@ -150,7 +152,7 @@ public IResponseFilter GetResourceResponseFilter(IWebBrowser chromiumWebBrowser,
"sync.outbrain.com", "widgets.outbrain.com",
"collect.mopinion.com", "pb-server.ezoic.com",
"demand.trafficroots.com", "sync.srv.stackadapt.com", "sync.ipredictive.com", "analytics.vdo.ai", "tag-api-2-1.ccgateway.net", "sync.search.spotxchange.com",
"reporting.powerad.ai", "monitor.ebay.com", "beacon.walmart.com"
"reporting.powerad.ai", "monitor.ebay.com", "beacon.walmart.com", "capture.condenastdigital.com", "a.pub.network"
};
public CefReturnValue OnBeforeResourceLoad(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, IRequest request, IRequestCallback callback)
{
Expand All @@ -168,6 +170,10 @@ public CefReturnValue OnBeforeResourceLoad(IWebBrowser chromiumWebBrowser, IBrow
//if (Utils.IsDataOffender(request.ResourceType))
//{
//}

//if (request.Url.StartsWith("ipfs://"))
// request.Url = request.Url.Replace("ipfs://", "https://cloudflare-ipfs.com/ipfs/");

if (Utils.IsPossiblyAd(request.ResourceType))
{
if (AdBlock || TrackerBlock)
Expand Down Expand Up @@ -201,15 +207,15 @@ public CefReturnValue OnBeforeResourceLoad(IWebBrowser chromiumWebBrowser, IBrow
if (Analytics.Contains(Host))
{
Continue = false;
MainWindow.Instance.BlockedTrackers++;
MainWindow.Instance.TrackersBlocked++;
}
if (Continue)
{
if (AdBlock)
if (Ads.Contains(Host))
{
Continue = false;
MainWindow.Instance.BlockedAds++;
MainWindow.Instance.AdsBlocked++;
}
}
}
Expand Down
Loading

0 comments on commit 7e241dc

Please sign in to comment.