Skip to content

Commit bbb086a

Browse files
committed
2025.9.29.0
1 parent 07b979e commit bbb086a

File tree

87 files changed

+13751
-5235
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+13751
-5235
lines changed

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,18 @@
1717
## SLBr
1818
SLBr is an open-source, lightweight web browser based on Chromium. Built with .NET, WPF, and CefSharp (CEF) to provide a modern browsing experience while remaining lightweight.
1919

20-
## Using CefSharp
21-
CefSharp is a .NET wrapper for the Chromium Embedded Framework (CEF), providing an embedded Chromium browser for WPF and WinForms applications. It supports modern web standards, including HTML5, JavaScript, CSS3, WebGL, and HTML5 audio/video.
22-
2320
## Notable Features
2421
See the full feature list, [here](https://slt-world.github.io/slbr/)
2522
- **Clean, Modern UI:** Simple & refreshed design.
23+
- **Multi Web Engine:** Choose between Chromium engine (CEF), Edge engine (WebView2), Internet Explorer engine (Trident).
2624
- **Ad & Tracker Blocking:** Browse with fewer ads & less tracking.
27-
- **YouTube Ad Skip:** Automatically skips ads on YouTube.
2825
- **Tab Layouts:** Choose vertical or horizontal tab alignment.
2926
- **Tab Unloading:** Save memory by unloading inactive tabs.
3027
- **Smart Address Bar:** Search suggestions directly in the address bar, with quick calculations, weather, and translation.
3128
- **Private Tabs (Incognito Tabs):** Open private browsing sessions that don't store history and cookies.
3229
- **Clipboard & Download Popup:** Attach recent images from the clipboard/downloads, inspired by Opera's Easy Files.
3330
- **Extension Support:** Supports Chrome web store extensions.
34-
- **Google Safe Browsing:** Protects against malicious websites.
31+
- **Web Risk Service:** Protects against malicious websites with Google Safe Browsing, Yandex Safe Browsing & PhishTank.
3532
- **Anti-Tamper Mode:** Keeps browsing unrestricted by allowing text selection, copy/paste, right-click menus, and developer tools on sites that block them.
3633

3734
## Installation

SLBr.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ VisualStudioVersion = 17.10.34916.146
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SLBr", "SLBr\SLBr.csproj", "{F2F8E91C-C30E-438C-B921-18B11CC0A7E2}"
77
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Updater", "Updater\Updater.csproj", "{7DA45EC9-EC17-4F3B-8830-DD7F4072C887}"
9+
EndProject
810
Global
911
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1012
Debug|Any CPU = Debug|Any CPU
@@ -15,6 +17,10 @@ Global
1517
{F2F8E91C-C30E-438C-B921-18B11CC0A7E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
1618
{F2F8E91C-C30E-438C-B921-18B11CC0A7E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
1719
{F2F8E91C-C30E-438C-B921-18B11CC0A7E2}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{7DA45EC9-EC17-4F3B-8830-DD7F4072C887}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{7DA45EC9-EC17-4F3B-8830-DD7F4072C887}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{7DA45EC9-EC17-4F3B-8830-DD7F4072C887}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{7DA45EC9-EC17-4F3B-8830-DD7F4072C887}.Release|Any CPU.Build.0 = Release|Any CPU
1824
EndGlobalSection
1925
GlobalSection(SolutionProperties) = preSolution
2026
HideSolutionNode = FALSE

SLBr/AhoCorasick.cs

Lines changed: 87 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ namespace SLBr
44
{
55
public class Trie : Trie<string>, IEnumerable<string>
66
{
7-
public void Add(string s)
8-
{
7+
public void Add(string s) =>
98
Add(s, s);
10-
}
119
public void Add(IEnumerable<string> strings)
1210
{
1311
foreach (string s in strings)
@@ -25,87 +23,87 @@ public class Trie<T, TValue>
2523
{
2624
public static Trie FromList(IEnumerable<string> patterns)
2725
{
28-
Trie trie = new Trie { patterns };
29-
trie.Build();
30-
return trie;
26+
Trie _Trie = new Trie { patterns };
27+
_Trie.Build();
28+
return _Trie;
3129
}
3230

33-
private readonly Node<T, TValue> root = new Node<T, TValue>();
31+
private readonly Node<T, TValue> _Root = new Node<T, TValue>();
3432

35-
public void Add(IEnumerable<T> word, TValue value)
33+
public void Add(IEnumerable<T> _Word, TValue _Value)
3634
{
37-
var node = root;
38-
foreach (T c in word)
35+
var _Node = _Root;
36+
foreach (T c in _Word)
3937
{
40-
var child = node[c];
41-
if (child == null)
42-
child = node[c] = new Node<T, TValue>(c, node);
43-
node = child;
38+
var Child = _Node[c];
39+
if (Child == null)
40+
Child = _Node[c] = new Node<T, TValue>(c, _Node);
41+
_Node = Child;
4442
}
45-
node.Values.Add(value);
43+
_Node.Values.Add(_Value);
4644
}
4745
public void Build()
4846
{
49-
var queue = new Queue<Node<T, TValue>>();
50-
queue.Enqueue(root);
51-
while (queue.Count > 0)
47+
var Queue = new Queue<Node<T, TValue>>();
48+
Queue.Enqueue(_Root);
49+
while (Queue.Count > 0)
5250
{
53-
var node = queue.Dequeue();
54-
foreach (var child in node)
55-
queue.Enqueue(child);
56-
if (node == root)
51+
var _Node = Queue.Dequeue();
52+
foreach (var Child in _Node)
53+
Queue.Enqueue(Child);
54+
if (_Node == _Root)
5755
{
58-
root.Fail = root;
56+
_Root.Fail = _Root;
5957
continue;
6058
}
61-
var fail = node.Parent.Fail;
62-
while (fail[node.Word] == null && fail != root)
63-
fail = fail.Fail;
64-
node.Fail = fail[node.Word] ?? root;
65-
if (node.Fail == node)
66-
node.Fail = root;
59+
var _Fail = _Node.Parent.Fail;
60+
while (_Fail[_Node.Word] == null && _Fail != _Root)
61+
_Fail = _Fail.Fail;
62+
_Node.Fail = _Fail[_Node.Word] ?? _Root;
63+
if (_Node.Fail == _Node)
64+
_Node.Fail = _Root;
6765
}
6866
}
6967

70-
public IEnumerable<TValue> Find(IEnumerable<T> text)
68+
public IEnumerable<TValue> Find(IEnumerable<T> Text)
7169
{
72-
var node = root;
73-
foreach (T c in text)
70+
var _Node = _Root;
71+
foreach (T c in Text)
7472
{
75-
while (node[c] == null && node != root)
76-
node = node.Fail;
77-
node = node[c] ?? root;
78-
for (var t = node; t != root; t = t.Fail)
73+
while (_Node[c] == null && _Node != _Root)
74+
_Node = _Node.Fail;
75+
_Node = _Node[c] ?? _Root;
76+
for (var t = _Node; t != _Root; t = t.Fail)
7977
{
80-
foreach (TValue value in t.Values)
81-
yield return value;
78+
foreach (TValue _Value in t.Values)
79+
yield return _Value;
8280
}
8381
}
8482
}
8583

8684
private class Node<TNode, TNodeValue> : IEnumerable<Node<TNode, TNodeValue>>
8785
{
88-
private readonly TNode word;
89-
private readonly Node<TNode, TNodeValue> parent;
90-
private readonly Dictionary<TNode, Node<TNode, TNodeValue>> children = new Dictionary<TNode, Node<TNode, TNodeValue>>();
91-
private readonly List<TNodeValue> values = new List<TNodeValue>();
86+
private readonly TNode _Word;
87+
private readonly Node<TNode, TNodeValue> _Parent;
88+
private readonly Dictionary<TNode, Node<TNode, TNodeValue>> _Children = new Dictionary<TNode, Node<TNode, TNodeValue>>();
89+
private readonly List<TNodeValue> _Values = new List<TNodeValue>();
9290

9391
public Node()
9492
{
9593
}
9694

9795
public Node(TNode word, Node<TNode, TNodeValue> parent)
9896
{
99-
this.word = word;
100-
this.parent = parent;
97+
_Word = word;
98+
_Parent = parent;
10199
}
102100
public TNode Word
103101
{
104-
get { return word; }
102+
get { return _Word; }
105103
}
106104
public Node<TNode, TNodeValue> Parent
107105
{
108-
get { return parent; }
106+
get { return _Parent; }
109107
}
110108
public Node<TNode, TNodeValue> Fail
111109
{
@@ -114,28 +112,22 @@ public Node<TNode, TNodeValue> Fail
114112
}
115113
public Node<TNode, TNodeValue> this[TNode c]
116114
{
117-
get { return children.ContainsKey(c) ? children[c] : null; }
118-
set { children[c] = value; }
115+
get { return _Children.ContainsKey(c) ? _Children[c] : null; }
116+
set { _Children[c] = value; }
119117
}
120118
public List<TNodeValue> Values
121119
{
122-
get { return values; }
120+
get { return _Values; }
123121
}
124122

125-
public IEnumerator<Node<TNode, TNodeValue>> GetEnumerator()
126-
{
127-
return children.Values.GetEnumerator();
128-
}
123+
public IEnumerator<Node<TNode, TNodeValue>> GetEnumerator() =>
124+
_Children.Values.GetEnumerator();
129125

130-
IEnumerator IEnumerable.GetEnumerator()
131-
{
132-
return GetEnumerator();
133-
}
126+
IEnumerator IEnumerable.GetEnumerator() =>
127+
GetEnumerator();
134128

135-
public override string ToString()
136-
{
137-
return Word.ToString();
138-
}
129+
public override string ToString() =>
130+
Word.ToString();
139131
}
140132
}
141133
}
@@ -150,15 +142,15 @@ public void Add(string Domain)
150142
if (!AllDomains.Add(Domain)) return;
151143

152144
bool WildCard = Domain.StartsWith("*.", StringComparison.Ordinal);
153-
var Parts = Domain.Trim().TrimStart('*', '.').TrimEnd('.').Split('.').Reverse();
145+
var Parts = Domain.Trim().TrimStart('*', '.').TrimEnd('.').Split('.').AsEnumerable().Reverse();
154146
var _Node = Root;
155147

156-
foreach (var part in Parts)
148+
foreach (var Part in Parts)
157149
{
158-
if (!_Node.Children.TryGetValue(part, out var Child))
150+
if (!_Node.Children.TryGetValue(Part, out var Child))
159151
{
160152
Child = new TrieNode();
161-
_Node.Children[part] = Child;
153+
_Node.Children[Part] = Child;
162154
}
163155
_Node = Child;
164156
}
@@ -169,7 +161,34 @@ public void Add(string Domain)
169161

170162
public bool Has(string Host)
171163
{
172-
var Parts = Host.Trim().TrimEnd('.').Split('.').Reverse();
164+
Host = Host.AsSpan().TrimEnd('.').ToString();
165+
var Span = Host.AsSpan();
166+
TrieNode Node = Root;
167+
168+
int End = Span.Length;
169+
while (End > 0)
170+
{
171+
int Dot = Span.Slice(0, End).LastIndexOf(".", StringComparison.Ordinal);
172+
ReadOnlySpan<char> Label;
173+
if (Dot == -1)
174+
{
175+
Label = Span.Slice(0, End);
176+
End = 0;
177+
}
178+
else
179+
{
180+
Label = Span.Slice(Dot + 1, End - Dot - 1);
181+
End = Dot;
182+
}
183+
if (Node.IsEnd && Node.Wildcard)
184+
return true;
185+
if (!Node.Children.TryGetValue(Label.ToString(), out Node))
186+
return false;
187+
}
188+
189+
return Node.IsEnd;
190+
191+
/*var Parts = Host.Trim().TrimEnd('.').Split('.').Reverse();
173192
var _Node = Root;
174193
175194
foreach (var part in Parts)
@@ -180,14 +199,13 @@ public bool Has(string Host)
180199
return false;
181200
}
182201
183-
return _Node.IsEnd;
202+
return _Node.IsEnd;*/
184203
}
185204

186205
public void Remove(string Domain)
187206
{
188207
if (!AllDomains.Remove(Domain)) return;
189-
190-
RemoveRecursive(Root, Domain.Trim().TrimStart('*', '.').TrimEnd('.').Split('.').Reverse().ToList(), 0, Domain.StartsWith("*.", StringComparison.Ordinal));
208+
RemoveRecursive(Root, Domain.Trim().TrimStart('*', '.').TrimEnd('.').Split('.').AsEnumerable().Reverse().ToList(), 0, Domain.StartsWith("*.", StringComparison.Ordinal));
191209
}
192210

193211
private bool RemoveRecursive(TrieNode _Node, List<string> Parts, int Index, bool Wildcard)

0 commit comments

Comments
 (0)