neon_arch commited on
Commit
b00f766
2 Parent(s): c595965 2b41fb9

Merge branch 'rolling' into FEAT/424_reduce-animations-effects-support-for-the-themes

Browse files
Cargo.lock CHANGED
@@ -4066,7 +4066,7 @@ checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10"
4066
 
4067
  [[package]]
4068
  name = "websurfx"
4069
- version = "1.5.4"
4070
  dependencies = [
4071
  "actix-cors",
4072
  "actix-files",
 
4066
 
4067
  [[package]]
4068
  name = "websurfx"
4069
+ version = "1.6.0"
4070
  dependencies = [
4071
  "actix-cors",
4072
  "actix-files",
Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
  [package]
2
  name = "websurfx"
3
- version = "1.5.4"
4
  edition = "2021"
5
  description = "An open-source alternative to Searx that provides clean, ad-free, and organic results with incredible speed while keeping privacy and security in mind."
6
  repository = "https://github.com/neon-mmd/websurfx"
 
1
  [package]
2
  name = "websurfx"
3
+ version = "1.6.0"
4
  edition = "2021"
5
  description = "An open-source alternative to Searx that provides clean, ad-free, and organic results with incredible speed while keeping privacy and security in mind."
6
  repository = "https://github.com/neon-mmd/websurfx"
images/websurfx_logo.png CHANGED
public/images/websurfx_logo.png DELETED
Binary file (8.5 kB)
 
public/images/websurfx_logo.svg DELETED
public/static/colorschemes/catppuccin-mocha.css CHANGED
@@ -1,6 +1,7 @@
1
  :root {
2
  --background-color: #1e1e2e;
3
  --foreground-color: #cdd6f4;
 
4
  --color-one: #45475a;
5
  --color-two: #f38ba8;
6
  --color-three: #a6e3a1;
 
1
  :root {
2
  --background-color: #1e1e2e;
3
  --foreground-color: #cdd6f4;
4
+ --logo-color: #f5c2e7;
5
  --color-one: #45475a;
6
  --color-two: #f38ba8;
7
  --color-three: #a6e3a1;
public/static/colorschemes/dark-chocolate.css CHANGED
@@ -1,6 +1,7 @@
1
  :root {
2
  --background-color: #000;
3
  --foreground-color: #fff;
 
4
  --color-one: #121212;
5
  --color-two: #808080;
6
  --color-three: #999;
 
1
  :root {
2
  --background-color: #000;
3
  --foreground-color: #fff;
4
+ --logo-color: #e0e0e0;
5
  --color-one: #121212;
6
  --color-two: #808080;
7
  --color-three: #999;
public/static/colorschemes/dracula.css CHANGED
@@ -1,6 +1,7 @@
1
  :root {
2
  --background-color: #44475a;
3
  --foreground-color: #8be9fd;
 
4
  --color-one: #f55;
5
  --color-two: #50fa7b;
6
  --color-three: #ffb86c;
 
1
  :root {
2
  --background-color: #44475a;
3
  --foreground-color: #8be9fd;
4
+ --logo-color: #ffb86c;
5
  --color-one: #f55;
6
  --color-two: #50fa7b;
7
  --color-three: #ffb86c;
public/static/colorschemes/gruvbox-dark.css CHANGED
@@ -1,6 +1,7 @@
1
  :root {
2
  --background-color: #1d2021;
3
  --foreground-color: #ebdbb2;
 
4
  --color-one: #282828;
5
  --color-two: #98971a;
6
  --color-three: #d79921;
 
1
  :root {
2
  --background-color: #1d2021;
3
  --foreground-color: #ebdbb2;
4
+ --logo-color: #ebdbb2;
5
  --color-one: #282828;
6
  --color-two: #98971a;
7
  --color-three: #d79921;
public/static/colorschemes/monokai.css CHANGED
@@ -1,6 +1,7 @@
1
  :root {
2
  --background-color: #49483Eff;
3
  --foreground-color: #FFB269;
 
4
  --color-one: #272822ff;
5
  --color-two: #61AFEF;
6
  --color-three: #ffd866;
 
1
  :root {
2
  --background-color: #49483Eff;
3
  --foreground-color: #FFB269;
4
+ --logo-color: #ffd866;
5
  --color-one: #272822ff;
6
  --color-two: #61AFEF;
7
  --color-three: #ffd866;
public/static/colorschemes/nord.css CHANGED
@@ -1,6 +1,7 @@
1
  :root {
2
  --background-color: #122736ff;
3
  --foreground-color: #a2e2a9;
 
4
  --color-one: #121B2Cff;
5
  --color-two: #f08282;
6
  --color-three: #ABC5AAff;
 
1
  :root {
2
  --background-color: #122736ff;
3
  --foreground-color: #a2e2a9;
4
+ --logo-color: #e2ecd6;
5
  --color-one: #121B2Cff;
6
  --color-two: #f08282;
7
  --color-three: #ABC5AAff;
public/static/colorschemes/oceanic-next.css CHANGED
@@ -1,6 +1,7 @@
1
  :root {
2
  --background-color: #1b2b34;
3
  --foreground-color: #d8dee9;
 
4
  --color-one: #343d46;
5
  --color-two: #5FB3B3ff;
6
  --color-three: #69Cf;
 
1
  :root {
2
  --background-color: #1b2b34;
3
  --foreground-color: #d8dee9;
4
+ --logo-color: #d8dee9;
5
  --color-one: #343d46;
6
  --color-two: #5FB3B3ff;
7
  --color-three: #69Cf;
public/static/colorschemes/one-dark.css CHANGED
@@ -1,6 +1,7 @@
1
  :root {
2
  --background-color: #282c34;
3
  --foreground-color: #abb2bf;
 
4
  --color-one: #3b4048;
5
  --color-two: #a3be8c;
6
  --color-three: #b48ead;
 
1
  :root {
2
  --background-color: #282c34;
3
  --foreground-color: #abb2bf;
4
+ --logo-color: #c8ccd4;
5
  --color-one: #3b4048;
6
  --color-two: #a3be8c;
7
  --color-three: #b48ead;
public/static/colorschemes/solarized-dark.css CHANGED
@@ -1,6 +1,7 @@
1
  :root {
2
  --background-color: #002b36;
3
  --foreground-color: #c9e0e6;
 
4
  --color-one: #073642;
5
  --color-two: #2AA198ff;
6
  --color-three: #2AA198ff;
 
1
  :root {
2
  --background-color: #002b36;
3
  --foreground-color: #c9e0e6;
4
+ --logo-color: #EEE8D5ff;
5
  --color-one: #073642;
6
  --color-two: #2AA198ff;
7
  --color-three: #2AA198ff;
public/static/colorschemes/solarized-light.css CHANGED
@@ -1,6 +1,7 @@
1
  :root {
2
  --background-color: #EEE8D5ff;
3
  --foreground-color: #b1ab97;
 
4
  --color-one: #fdf6e3;
5
  --color-two: #DC322Fff;
6
  --color-three: #586E75ff;
 
1
  :root {
2
  --background-color: #EEE8D5ff;
3
  --foreground-color: #b1ab97;
4
+ --logo-color: #586E75;
5
  --color-one: #fdf6e3;
6
  --color-two: #DC322Fff;
7
  --color-three: #586E75ff;
public/static/colorschemes/tokyo-night.css CHANGED
@@ -1,6 +1,7 @@
1
  :root {
2
  --background-color: #1a1b26;
3
  --foreground-color: #c0caf5;
 
4
  --color-one: #32364a;
5
  --color-two: #a9b1d6;
6
  --color-three: #5a5bb8;
 
1
  :root {
2
  --background-color: #1a1b26;
3
  --foreground-color: #c0caf5;
4
+ --logo-color: #e2afff;
5
  --color-one: #32364a;
6
  --color-two: #a9b1d6;
7
  --color-three: #5a5bb8;
public/static/colorschemes/tomorrow-night.css CHANGED
@@ -1,6 +1,7 @@
1
  :root {
2
  --background-color: #35383Cff;
3
  --foreground-color: #D7DAD8ff;
 
4
  --color-one: #1d1f21;
5
  --color-two: #D77C79ff;
6
  --color-three: #f0c674;
 
1
  :root {
2
  --background-color: #35383Cff;
3
  --foreground-color: #D7DAD8ff;
4
+ --logo-color: #D7DAD8ff;
5
  --color-one: #1d1f21;
6
  --color-two: #D77C79ff;
7
  --color-three: #f0c674;
public/static/themes/simple.css CHANGED
@@ -1,4 +1,9 @@
1
  /* @import url('./catppuccin-mocha.css'); */
 
 
 
 
 
2
 
3
  * {
4
  padding: 0;
@@ -16,7 +21,13 @@ body {
16
  justify-content: space-between;
17
  align-items: center;
18
  height: 100vh;
19
- background: var(--color-one);
 
 
 
 
 
 
20
  }
21
 
22
  /* styles for the index page */
@@ -29,46 +40,67 @@ body {
29
  align-items: center;
30
  }
31
 
32
- .search-container div {
33
- display: flex;
34
  }
35
 
36
- .websurfx-logo {
37
- width: clamp(12rem, 40rem, 48rem);
38
  }
39
 
40
  /* styles for the search box and search button */
41
 
42
  .search_bar {
43
  display: flex;
 
 
44
  }
45
 
46
  .search_bar input {
47
- padding: 1rem;
 
48
  width: 50rem;
49
  height: 3rem;
50
  outline: none;
51
  border: none;
52
  box-shadow: rgb(0 0 0 / 1);
53
- background: var(--foreground-color);
 
 
 
 
 
 
 
 
 
 
 
 
54
  }
55
 
56
  .search_bar button {
57
- padding: 1rem;
58
- border-radius: 0;
59
  height: 3rem;
60
  display: flex;
61
  justify-content: center;
62
  align-items: center;
63
- outline: none;
 
64
  border: none;
 
65
  gap: 0;
66
- background: var(--background-color);
67
- color: var(--color-three);
68
  font-weight: 600;
69
  letter-spacing: 0.1rem;
70
  }
71
 
 
 
 
 
72
  .search_bar button:active,
73
  .search_bar button:hover {
74
  filter: brightness(1.2);
@@ -85,13 +117,19 @@ body {
85
  width: 20rem;
86
  background-color: var(--color-one);
87
  color: var(--foreground-color);
88
- padding: 1rem 2rem;
89
  border-radius: 0.5rem;
90
- outline: none;
 
91
  border: none;
92
  text-transform: capitalize;
93
  }
94
 
 
 
 
 
 
95
  .search_area .search_options option:hover {
96
  background-color: var(--color-one);
97
  }
@@ -199,17 +237,25 @@ body {
199
 
200
  /* styles for the footer and header */
201
 
202
- header,
203
- footer {
204
  width: 100%;
205
  background: var(--background-color);
206
  display: flex;
207
- padding: 1rem;
208
  align-items: center;
 
 
209
  }
210
 
211
- header {
212
- justify-content: space-between;
 
 
 
 
 
 
 
213
  }
214
 
215
  header h1 a {
@@ -217,7 +263,6 @@ header h1 a {
217
  text-decoration: none;
218
  color: var(--foreground-color);
219
  letter-spacing: 0.1rem;
220
- margin-left: 1rem;
221
  }
222
 
223
  header ul,
@@ -259,11 +304,6 @@ footer div {
259
  gap: 1rem;
260
  }
261
 
262
- footer {
263
- flex-direction: column;
264
- justify-content: center;
265
- }
266
-
267
  /* Styles for the search page */
268
 
269
  .results {
@@ -271,6 +311,11 @@ footer {
271
  display: flex;
272
  flex-direction: column;
273
  justify-content: space-around;
 
 
 
 
 
274
  }
275
 
276
  .results .search_bar {
@@ -280,7 +325,7 @@ footer {
280
  .results_aggregated {
281
  display: flex;
282
  flex-direction: column;
283
- justify-content: space-between;
284
  margin: 2rem 0;
285
  content-visibility: auto;
286
  }
@@ -292,10 +337,10 @@ footer {
292
  }
293
 
294
  .results_aggregated .result h1 a {
295
- font-size: 1.5rem;
 
296
  color: var(--color-two);
297
  text-decoration: none;
298
- letter-spacing: 0.1rem;
299
  }
300
 
301
  .results_aggregated .result h1 a:hover {
@@ -308,14 +353,15 @@ footer {
308
 
309
  .results_aggregated .result small {
310
  color: var(--color-three);
311
- font-size: 1.1rem;
312
  word-wrap: break-word;
313
  line-break: anywhere;
314
  }
315
 
316
  .results_aggregated .result p {
317
  color: var(--foreground-color);
318
- font-size: 1.2rem;
 
319
  margin-top: 0.3rem;
320
  word-wrap: break-word;
321
  line-break: anywhere;
@@ -445,6 +491,7 @@ footer {
445
  display: flex;
446
  justify-content: space-around;
447
  width: 80dvw;
 
448
  }
449
 
450
  .settings h1 {
@@ -452,11 +499,20 @@ footer {
452
  font-size: 2.5rem;
453
  }
454
 
 
 
 
 
 
455
  .settings hr {
456
  border-color: var(--color-three);
457
  margin: 0.3rem 0 1rem;
458
  }
459
 
 
 
 
 
460
  .settings_container .sidebar {
461
  width: 30%;
462
  cursor: pointer;
@@ -467,7 +523,6 @@ footer {
467
  margin-left: -0.7rem;
468
  padding: 0.7rem;
469
  border-radius: 5px;
470
- font-weight: bold;
471
  margin-bottom: 0.5rem;
472
  color: var(--foreground-color);
473
  text-transform: capitalize;
@@ -475,18 +530,30 @@ footer {
475
  }
476
 
477
  .settings_container .sidebar .btn {
478
- padding: 0.5rem;
479
  border-radius: 0.5rem;
 
 
 
 
 
 
 
 
 
 
480
  }
481
 
482
  .settings_container .sidebar .btn.active {
483
  background-color: var(--color-two);
 
484
  }
485
 
486
  .settings_container .main_container {
487
  width: 70%;
488
  border-left: 1.5px solid var(--color-three);
489
  padding-left: 3rem;
 
490
  }
491
 
492
  .settings_container .tab {
@@ -495,6 +562,7 @@ footer {
495
 
496
  .settings_container .tab.active {
497
  display: flex;
 
498
  flex-direction: column;
499
  justify-content: space-around;
500
  }
@@ -542,7 +610,7 @@ footer {
542
  .settings_container .general select {
543
  margin: 0.7rem 0;
544
  width: 20rem;
545
- background-color: var(--background-color);
546
  color: var(--foreground-color);
547
  padding: 1rem 2rem;
548
  border-radius: 0.5rem;
@@ -560,16 +628,19 @@ footer {
560
  display: flex;
561
  flex-direction: column;
562
  justify-content: center;
563
- gap: 1rem;
564
  padding: 1rem 0;
 
 
565
  }
566
 
567
  .settings_container .engines .toggle_btn {
568
  color: var(--foreground-color);
569
  font-size: 1.5rem;
570
  display: flex;
571
- gap: 0.5rem;
572
  align-items: center;
 
 
 
573
  }
574
 
575
  .settings_container .engines hr {
@@ -602,8 +673,14 @@ footer {
602
  position: absolute;
603
  cursor: pointer;
604
  inset: 0;
605
- background-color: var(--background-color);
606
- transition: 0.4s;
 
 
 
 
 
 
607
  }
608
 
609
  .slider::before {
@@ -613,8 +690,8 @@ footer {
613
  width: 2.6rem;
614
  left: 0.4rem;
615
  bottom: 0.4rem;
616
- background-color: var(--foreground-color);
617
- transition: 0.4s;
618
  }
619
 
620
  input:checked + .slider {
 
1
  /* @import url('./catppuccin-mocha.css'); */
2
+ @font-face {
3
+ font-family: Rubik;
4
+ src: url('https://fonts.googleapis.com/css2?family=Rubik:wght@400;500;600;700;800&display=swap');
5
+ fallback: sans-serif;
6
+ }
7
 
8
  * {
9
  padding: 0;
 
21
  justify-content: space-between;
22
  align-items: center;
23
  height: 100vh;
24
+ font-family: Rubik, sans-serif;
25
+ background-color: var(--background-color);
26
+ }
27
+
28
+ /* enforce font for buttons */
29
+ button {
30
+ font-family: Rubik, sans-serif;
31
  }
32
 
33
  /* styles for the index page */
 
40
  align-items: center;
41
  }
42
 
43
+ .search-container svg {
44
+ color: var(--logo-color);
45
  }
46
 
47
+ .search-container div {
48
+ display: flex;
49
  }
50
 
51
  /* styles for the search box and search button */
52
 
53
  .search_bar {
54
  display: flex;
55
+ gap: 10px;
56
+ align-items: center;
57
  }
58
 
59
  .search_bar input {
60
+ border-radius: 6px;
61
+ padding: 2.6rem 2.2rem;
62
  width: 50rem;
63
  height: 3rem;
64
  outline: none;
65
  border: none;
66
  box-shadow: rgb(0 0 0 / 1);
67
+ background-color: var(--color-one);
68
+ color: var(--foreground-color);
69
+ outline-offset: 3px;
70
+ font-size: 1.6rem;
71
+ }
72
+
73
+ .search_bar input:focus {
74
+ outline: 2px solid var(--foreground-color);
75
+ }
76
+
77
+ .search_bar input::placeholder {
78
+ color: var(--foreground-color);
79
+ opacity: 1;
80
  }
81
 
82
  .search_bar button {
83
+ padding: 2.6rem 3.2rem;
84
+ border-radius: 6px;
85
  height: 3rem;
86
  display: flex;
87
  justify-content: center;
88
  align-items: center;
89
+ outline-offset: 3px;
90
+ outline: 2px solid transparent;
91
  border: none;
92
+ transition: .1s;
93
  gap: 0;
94
+ background-color: var(--color-six);
95
+ color: var(--background-color);
96
  font-weight: 600;
97
  letter-spacing: 0.1rem;
98
  }
99
 
100
+ .search_bar button:active {
101
+ outline: 2px solid var(--color-three);
102
+ }
103
+
104
  .search_bar button:active,
105
  .search_bar button:hover {
106
  filter: brightness(1.2);
 
117
  width: 20rem;
118
  background-color: var(--color-one);
119
  color: var(--foreground-color);
120
+ padding: 1.2rem 2rem;
121
  border-radius: 0.5rem;
122
+ outline-offset: 3px;
123
+ outline: 2px solid transparent;
124
  border: none;
125
  text-transform: capitalize;
126
  }
127
 
128
+ .search_area .search_options select:active,
129
+ .search_area .search_options select:hover {
130
+ outline: 2px solid var(--color-three);
131
+ }
132
+
133
  .search_area .search_options option:hover {
134
  background-color: var(--color-one);
135
  }
 
237
 
238
  /* styles for the footer and header */
239
 
240
+
241
+ header {
242
  width: 100%;
243
  background: var(--background-color);
244
  display: flex;
 
245
  align-items: center;
246
+ justify-content: space-between;
247
+ padding: 2rem 3rem;
248
  }
249
 
250
+ footer {
251
+ width: 100%;
252
+ background: var(--background-color);
253
+ display: flex;
254
+ align-items: center;
255
+ padding: 1.7rem 1.7rem 4rem;
256
+ gap: 1.8rem;
257
+ flex-direction: column;
258
+ justify-content: center;
259
  }
260
 
261
  header h1 a {
 
263
  text-decoration: none;
264
  color: var(--foreground-color);
265
  letter-spacing: 0.1rem;
 
266
  }
267
 
268
  header ul,
 
304
  gap: 1rem;
305
  }
306
 
 
 
 
 
 
307
  /* Styles for the search page */
308
 
309
  .results {
 
311
  display: flex;
312
  flex-direction: column;
313
  justify-content: space-around;
314
+ gap: 1rem;
315
+ }
316
+
317
+ .result {
318
+ gap: 1rem;
319
  }
320
 
321
  .results .search_bar {
 
325
  .results_aggregated {
326
  display: flex;
327
  flex-direction: column;
328
+ justify-content: space-between;
329
  margin: 2rem 0;
330
  content-visibility: auto;
331
  }
 
337
  }
338
 
339
  .results_aggregated .result h1 a {
340
+ font-size: 1.7rem;
341
+ font-weight: normal;
342
  color: var(--color-two);
343
  text-decoration: none;
 
344
  }
345
 
346
  .results_aggregated .result h1 a:hover {
 
353
 
354
  .results_aggregated .result small {
355
  color: var(--color-three);
356
+ font-size: 1.3rem;
357
  word-wrap: break-word;
358
  line-break: anywhere;
359
  }
360
 
361
  .results_aggregated .result p {
362
  color: var(--foreground-color);
363
+ font-size: 1.4rem;
364
+ line-height: 2.4rem;
365
  margin-top: 0.3rem;
366
  word-wrap: break-word;
367
  line-break: anywhere;
 
491
  display: flex;
492
  justify-content: space-around;
493
  width: 80dvw;
494
+ margin: 5rem 0;
495
  }
496
 
497
  .settings h1 {
 
499
  font-size: 2.5rem;
500
  }
501
 
502
+ .settings > h1 {
503
+ margin-bottom: 4rem;
504
+ margin-left: 2rem;
505
+ }
506
+
507
  .settings hr {
508
  border-color: var(--color-three);
509
  margin: 0.3rem 0 1rem;
510
  }
511
 
512
+ .settings > hr {
513
+ margin-left: 2rem;
514
+ }
515
+
516
  .settings_container .sidebar {
517
  width: 30%;
518
  cursor: pointer;
 
523
  margin-left: -0.7rem;
524
  padding: 0.7rem;
525
  border-radius: 5px;
 
526
  margin-bottom: 0.5rem;
527
  color: var(--foreground-color);
528
  text-transform: capitalize;
 
530
  }
531
 
532
  .settings_container .sidebar .btn {
533
+ padding: 2rem;
534
  border-radius: 0.5rem;
535
+ outline-offset: 3px;
536
+ outline: 2px solid transparent;
537
+ }
538
+
539
+ .settings_container .sidebar .btn:active {
540
+ outline: 2px solid var(--color-two);
541
+ }
542
+
543
+ .settings_container .sidebar .btn:not(.active):hover {
544
+ color: var(--color-two);
545
  }
546
 
547
  .settings_container .sidebar .btn.active {
548
  background-color: var(--color-two);
549
+ color: var(--background-color);
550
  }
551
 
552
  .settings_container .main_container {
553
  width: 70%;
554
  border-left: 1.5px solid var(--color-three);
555
  padding-left: 3rem;
556
+ border: none;
557
  }
558
 
559
  .settings_container .tab {
 
562
 
563
  .settings_container .tab.active {
564
  display: flex;
565
+ gap: 1.2rem;
566
  flex-direction: column;
567
  justify-content: space-around;
568
  }
 
610
  .settings_container .general select {
611
  margin: 0.7rem 0;
612
  width: 20rem;
613
+ background-color: var(--color-one);
614
  color: var(--foreground-color);
615
  padding: 1rem 2rem;
616
  border-radius: 0.5rem;
 
628
  display: flex;
629
  flex-direction: column;
630
  justify-content: center;
 
631
  padding: 1rem 0;
632
+ margin-bottom: 2rem;
633
+ gap: 2rem;
634
  }
635
 
636
  .settings_container .engines .toggle_btn {
637
  color: var(--foreground-color);
638
  font-size: 1.5rem;
639
  display: flex;
 
640
  align-items: center;
641
+ border-radius: 100px;
642
+ gap: 1.5rem;
643
+ letter-spacing: 1px;
644
  }
645
 
646
  .settings_container .engines hr {
 
673
  position: absolute;
674
  cursor: pointer;
675
  inset: 0;
676
+ background-color: var(--foreground-color);
677
+ transition: 0.2s;
678
+ outline-offset: 3px;
679
+ outline: 2px solid transparent;
680
+ }
681
+
682
+ .slider:active {
683
+ outline: 2px solid var(--foreground-color);
684
  }
685
 
686
  .slider::before {
 
690
  width: 2.6rem;
691
  left: 0.4rem;
692
  bottom: 0.4rem;
693
+ background-color: var(--background-color);
694
+ transition: .2s;
695
  }
696
 
697
  input:checked + .slider {
src/engines/librex.rs ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //! The `librex` module contains the implementation of a search engine for LibreX using the reqwest and scraper libraries.
2
+ //! It includes a `SearchEngine` trait implementation for interacting with the search engine and retrieving search results.
3
+
4
+ use std::collections::HashMap;
5
+
6
+ use reqwest::header::HeaderMap;
7
+ use reqwest::Client;
8
+ use scraper::Html;
9
+
10
+ use crate::models::aggregation_models::SearchResult;
11
+ use crate::models::engine_models::{EngineError, SearchEngine};
12
+
13
+ use error_stack::{Report, Result, ResultExt};
14
+
15
+ use super::search_result_parser::SearchResultParser;
16
+
17
+ /// Represents the LibreX search engine.
18
+ pub struct LibreX {
19
+ /// The parser used to extract search results from HTML documents.
20
+ parser: SearchResultParser,
21
+ }
22
+
23
+ impl LibreX {
24
+ /// Creates a new instance of LibreX with a default configuration.
25
+ ///
26
+ /// # Returns
27
+ ///
28
+ /// Returns a `Result` containing `LibreX` if successful, otherwise an `EngineError`.
29
+ pub fn new() -> Result<Self, EngineError> {
30
+ Ok(Self {
31
+ parser: SearchResultParser::new(
32
+ ".text-result-container>p",
33
+ ".text-result-container",
34
+ ".text-result-wrapper>a>h2",
35
+ ".text-result-wrapper>a",
36
+ ".text-result-wrapper>span",
37
+ )?,
38
+ })
39
+ }
40
+ }
41
+
42
+ #[async_trait::async_trait]
43
+ impl SearchEngine for LibreX {
44
+ /// Retrieves search results from LibreX based on the provided query, page, user agent, and client.
45
+ ///
46
+ /// # Arguments
47
+ ///
48
+ /// * `query` - The search query.
49
+ /// * `page` - The page number for pagination.
50
+ /// * `user_agent` - The user agent string.
51
+ /// * `client` - The reqwest client for making HTTP requests.
52
+ /// * `_safe_search` - A parameter for safe search (not currently used).
53
+ ///
54
+ /// # Returns
55
+ ///
56
+ /// Returns a `Result` containing a `HashMap` of search results if successful, otherwise an `EngineError`.
57
+ /// The `Err` variant is explicit for better documentation.
58
+ async fn results(
59
+ &self,
60
+ query: &str,
61
+ page: u32,
62
+ user_agent: &str,
63
+ client: &Client,
64
+ _safe_search: u8,
65
+ ) -> Result<HashMap<String, SearchResult>, EngineError> {
66
+ // Page number can be missing or empty string and so appropriate handling is required
67
+ // so that upstream server recieves valid page number.
68
+ let url: String = match page {
69
+ 1 | 0 => {
70
+ format!("https://search.ahwx.org/search.php?q={query}&p=0&t=10")
71
+ }
72
+ _ => {
73
+ format!(
74
+ "https://search.ahwx.org/search.php?q={query}&p={}&t=10",
75
+ page * 10,
76
+ )
77
+ }
78
+ };
79
+
80
+ // initializing HeaderMap and adding appropriate headers.
81
+ let header_map = HeaderMap::try_from(&HashMap::from([
82
+ ("USER_AGENT".to_string(), user_agent.to_string()),
83
+ ("REFERER".to_string(), "https://google.com/".to_string()),
84
+ ("CONTENT_TYPE".to_string(), "application/x-www-form-urlencoded".to_string()),
85
+ (
86
+ "COOKIE".to_string(),
87
+ "theme=amoled; disable_special=on; disable_frontends=on; language=en; number_of_results=10; safe_search=on; save=1".to_string(),
88
+ ),
89
+ ]))
90
+ .change_context(EngineError::UnexpectedError)?;
91
+
92
+ let document: Html = Html::parse_document(
93
+ &LibreX::fetch_html_from_upstream(self, &url, header_map, client).await?,
94
+ );
95
+
96
+ if self.parser.parse_for_no_results(&document).next().is_some() {
97
+ return Err(Report::new(EngineError::EmptyResultSet));
98
+ }
99
+
100
+ // scrape all the results from the html
101
+ self.parser
102
+ .parse_for_results(&document, |title, url, desc| {
103
+ Some(SearchResult::new(
104
+ title.inner_html().trim(),
105
+ url.inner_html().trim(),
106
+ desc.inner_html().trim(),
107
+ &["librex"],
108
+ ))
109
+ })
110
+ }
111
+ }
src/engines/mod.rs CHANGED
@@ -5,6 +5,7 @@
5
 
6
  pub mod brave;
7
  pub mod duckduckgo;
 
8
  pub mod search_result_parser;
9
  pub mod searx;
10
  pub mod startpage;
 
5
 
6
  pub mod brave;
7
  pub mod duckduckgo;
8
+ pub mod librex;
9
  pub mod search_result_parser;
10
  pub mod searx;
11
  pub mod startpage;
src/engines/searx.rs CHANGED
@@ -52,11 +52,11 @@ impl SearchEngine for Searx {
52
 
53
  let url: String = match page {
54
  0 | 1 => {
55
- format!("https://searx.work/search?q={query}&pageno=1&safesearch={safe_search}")
 
 
 
56
  }
57
- _ => format!(
58
- "https://searx.work/search?q={query}&pageno={page}&safesearch={safe_search}"
59
- ),
60
  };
61
 
62
  // initializing headers and adding appropriate headers.
 
52
 
53
  let url: String = match page {
54
  0 | 1 => {
55
+ format!("https://searx.be/search?q={query}&pageno=1&safesearch={safe_search}")
56
+ }
57
+ _ => {
58
+ format!("https://searx.be/search?q={query}&pageno={page}&safesearch={safe_search}")
59
  }
 
 
 
60
  };
61
 
62
  // initializing headers and adding appropriate headers.
src/engines/startpage.rs CHANGED
@@ -1,5 +1,5 @@
1
- //! The `duckduckgo` module handles the scraping of results from the duckduckgo search engine
2
- //! by querying the upstream duckduckgo search engine with user provided query and with a page
3
  //! number if provided.
4
 
5
  use std::collections::HashMap;
@@ -87,7 +87,7 @@ impl SearchEngine for Startpage {
87
  .parse_for_results(&document, |title, url, desc| {
88
  Some(SearchResult::new(
89
  title.inner_html().trim(),
90
- &format!("{}", url.inner_html().trim()),
91
  desc.inner_html().trim(),
92
  &["startpage"],
93
  ))
 
1
+ //! The `startpage` module handles the scraping of results from the startpage search engine
2
+ //! by querying the upstream startpage search engine with user provided query and with a page
3
  //! number if provided.
4
 
5
  use std::collections::HashMap;
 
87
  .parse_for_results(&document, |title, url, desc| {
88
  Some(SearchResult::new(
89
  title.inner_html().trim(),
90
+ url.inner_html().trim(),
91
  desc.inner_html().trim(),
92
  &["startpage"],
93
  ))
src/models/engine_models.rs CHANGED
@@ -158,6 +158,10 @@ impl EngineHandler {
158
  let engine = crate::engines::startpage::Startpage::new()?;
159
  ("startpage", Box::new(engine))
160
  }
 
 
 
 
161
  _ => {
162
  return Err(Report::from(EngineError::NoSuchEngineFound(
163
  engine_name.to_string(),
 
158
  let engine = crate::engines::startpage::Startpage::new()?;
159
  ("startpage", Box::new(engine))
160
  }
161
+ "librex" => {
162
+ let engine = crate::engines::librex::LibreX::new()?;
163
+ ("librex", Box::new(engine))
164
+ }
165
  _ => {
166
  return Err(Report::from(EngineError::NoSuchEngineFound(
167
  engine_name.to_string(),
src/templates/views/index.rs CHANGED
@@ -15,10 +15,20 @@ use crate::templates::partials::{bar::bar, footer::footer, header::header};
15
  ///
16
  /// It returns the compiled html markup code as a result.
17
  pub fn index(colorscheme: &str, theme: &str, animation: &Option<String>) -> Markup {
 
 
 
 
 
 
 
 
 
 
18
  html!(
19
  (header(colorscheme, theme, animation))
20
  main class="search-container"{
21
- img class="websurfx-logo" src="../images/websurfx_logo.svg" alt="Websurfx meta-search engine logo";
22
  (bar(&String::default()))
23
  (PreEscaped("</div>"))
24
  }
 
15
  ///
16
  /// It returns the compiled html markup code as a result.
17
  pub fn index(colorscheme: &str, theme: &str, animation: &Option<String>) -> Markup {
18
+ let logo_svg = r#"
19
+ <svg viewBox="0 0 173 57" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
20
+ <path d="M77.8201 21.4277L73.4513 35.5049H70.3855L67.5496 25.1067L64.7137 35.5049H61.6479L57.2536 21.4277H60.2172L63.1553 32.7457L66.1444 21.4277H69.1847L72.0461 32.6946L74.9586 21.4277H77.8201ZM92.8986 28.1214C92.8986 28.6494 92.8645 29.1263 92.7964 29.5521H82.0405C82.1257 30.6762 82.543 31.5789 83.2924 32.2602C84.0418 32.9415 84.9616 33.2822 86.0516 33.2822C87.6186 33.2822 88.7257 32.6264 89.3729 31.3149H92.5154C92.0896 32.6094 91.3146 33.6739 90.1905 34.5085C89.0834 35.326 87.7038 35.7348 86.0516 35.7348C84.7061 35.7348 83.4968 35.4368 82.4238 34.8406C81.3678 34.2275 80.5332 33.3758 79.92 32.2858C79.3239 31.1787 79.0258 29.9013 79.0258 28.4535C79.0258 27.0058 79.3154 25.7369 79.8945 24.6468C80.4906 23.5397 81.3167 22.6881 82.3727 22.092C83.4457 21.4958 84.672 21.1978 86.0516 21.1978C87.3801 21.1978 88.5639 21.4873 89.6029 22.0664C90.6418 22.6455 91.4509 23.4631 92.03 24.5191C92.6091 25.558 92.8986 26.7588 92.8986 28.1214ZM89.8583 27.2016C89.8413 26.1286 89.4581 25.2685 88.7087 24.6213C87.9592 23.974 87.031 23.6504 85.9239 23.6504C84.919 23.6504 84.0589 23.974 83.3435 24.6213C82.6281 25.2515 82.2023 26.1116 82.0661 27.2016H89.8583ZM98.6773 23.5227C99.1713 22.8414 99.844 22.2878 100.696 21.862C101.564 21.4192 102.527 21.1978 103.583 21.1978C104.826 21.1978 105.95 21.4958 106.955 22.092C107.96 22.6881 108.752 23.5397 109.331 24.6468C109.91 25.7369 110.2 26.9887 110.2 28.4024C110.2 29.8161 109.91 31.085 109.331 32.2091C108.752 33.3162 107.951 34.1849 106.929 34.8151C105.925 35.4282 104.809 35.7348 103.583 35.7348C102.493 35.7348 101.522 35.5219 100.67 35.0961C99.8355 34.6703 99.1713 34.1253 98.6773 33.461V35.5049H95.7648V16.5991H98.6773V23.5227ZM107.236 28.4024C107.236 27.4316 107.032 26.597 106.623 25.8987C106.231 25.1833 105.703 24.6468 105.039 24.2891C104.392 23.9144 103.693 23.7271 102.944 23.7271C102.212 23.7271 101.513 23.9144 100.849 24.2891C100.202 24.6638 99.6737 25.2089 99.265 25.9242C98.8732 26.6396 98.6773 27.4827 98.6773 28.4535C98.6773 29.4244 98.8732 30.276 99.265 31.0084C99.6737 31.7237 100.202 32.2688 100.849 32.6435C101.513 33.0182 102.212 33.2055 102.944 33.2055C103.693 33.2055 104.392 33.0182 105.039 32.6435C105.703 32.2517 106.231 31.6897 106.623 30.9573C107.032 30.2249 107.236 29.3733 107.236 28.4024ZM118.19 35.7348C117.082 35.7348 116.086 35.5389 115.2 35.1472C114.332 34.7384 113.642 34.1934 113.131 33.5121C112.62 32.8138 112.347 32.0388 112.313 31.1872H115.328C115.379 31.7833 115.66 32.2858 116.171 32.6946C116.699 33.0863 117.355 33.2822 118.138 33.2822C118.956 33.2822 119.586 33.1289 120.029 32.8223C120.489 32.4987 120.719 32.0899 120.719 31.596C120.719 31.068 120.463 30.6762 119.952 30.4207C119.458 30.1653 118.666 29.8842 117.576 29.5777C116.52 29.2881 115.66 29.0071 114.996 28.7346C114.332 28.462 113.753 28.0447 113.259 27.4827C112.782 26.9206 112.543 26.1797 112.543 25.26C112.543 24.5105 112.765 23.8293 113.208 23.2161C113.65 22.5859 114.281 22.092 115.098 21.7343C115.933 21.3766 116.887 21.1978 117.96 21.1978C119.561 21.1978 120.847 21.6065 121.817 22.4241C122.805 23.2246 123.333 24.3232 123.401 25.7198H120.489C120.438 25.0896 120.182 24.5872 119.722 24.2125C119.263 23.8378 118.641 23.6504 117.857 23.6504C117.091 23.6504 116.503 23.7952 116.095 24.0847C115.686 24.3743 115.481 24.7575 115.481 25.2344C115.481 25.6091 115.618 25.9242 115.89 26.1797C116.163 26.4352 116.495 26.6396 116.887 26.7929C117.278 26.9291 117.857 27.108 118.624 27.3294C119.646 27.6019 120.48 27.8829 121.128 28.1725C121.792 28.445 122.362 28.8538 122.839 29.3988C123.316 29.9438 123.563 30.6677 123.58 31.5704C123.58 32.3709 123.359 33.0863 122.916 33.7165C122.473 34.3467 121.843 34.8406 121.025 35.1983C120.225 35.556 119.28 35.7348 118.19 35.7348ZM139.476 21.4277V35.5049H136.563V33.8442C136.104 34.4233 135.499 34.8832 134.75 35.2239C134.017 35.5475 133.234 35.7093 132.399 35.7093C131.292 35.7093 130.296 35.4793 129.41 35.0195C128.541 34.5596 127.851 33.8783 127.34 32.9756C126.847 32.0729 126.6 30.9828 126.6 29.7054V21.4277H129.487V29.2711C129.487 30.5315 129.802 31.5023 130.432 32.1836C131.062 32.8478 131.922 33.18 133.012 33.18C134.102 33.18 134.962 32.8478 135.593 32.1836C136.24 31.5023 136.563 30.5315 136.563 29.2711V21.4277H139.476ZM146.231 23.4716C146.657 22.7562 147.219 22.2027 147.918 21.8109C148.633 21.4022 149.476 21.1978 150.447 21.1978V24.2125H149.706C148.565 24.2125 147.696 24.502 147.1 25.0811C146.521 25.6602 146.231 26.6651 146.231 28.0958V35.5049H143.319V21.4277H146.231V23.4716ZM159.026 23.8037H156.42V35.5049H153.482V23.8037H151.821V21.4277H153.482V20.4313C153.482 18.8133 153.907 17.638 154.759 16.9056C155.628 16.1562 156.982 15.7815 158.821 15.7815V18.2086C157.936 18.2086 157.314 18.3789 156.956 18.7196C156.599 19.0432 156.42 19.6138 156.42 20.4313V21.4277H159.026V23.8037ZM167.636 28.3769L172.184 35.5049H168.888L165.848 30.7273L162.986 35.5049H159.946L164.494 28.5813L159.946 21.4277H163.242L166.282 26.2053L169.144 21.4277H172.184L167.636 28.3769Z" fill="currentColor"/>
21
+ <path d="M2.21486 42.7894C1.15271 43.0507 0.550463 44.1151 1.00616 45.1192C4.17619 52.1035 11.5005 54.9673 23.3646 52.0493C35.2399 49.1285 47.5128 41.4358 47.2254 33.7293C47.1854 32.6562 46.0226 32.0146 44.9605 32.2759L2.21486 42.7894Z" fill="currentColor"/>
22
+ <path d="M20.1227 10.0027C21.9192 10.8048 23.7313 11.7606 25.4259 12.8819C28.7827 15.1031 31.9178 18.1341 33.329 22.1366C34.1626 24.5009 34.0742 26.7513 33.2144 28.7679C32.4048 30.6666 30.9903 32.178 29.4212 33.3664C37.6699 31.0439 47.0335 26.0679 44.0686 17.608C40.9417 8.68557 29.3768 3.38405 21.266 1.04683C19.3981 0.508566 17.8191 2.37853 18.4252 4.22557C18.9773 5.90835 19.5596 7.85665 20.1227 10.0027Z" fill="currentColor"/>
23
+ <path d="M8.27125 34.3558C8.02834 30.0503 7.01551 25.8501 5.987 22.6653C5.38101 20.7888 6.95924 18.8318 8.8458 19.4057C13.6444 20.8655 19.4581 23.6235 21.1736 27.928C23.1268 32.8287 16.4467 35.584 11.1405 36.7375C9.66674 37.0579 8.35621 35.8616 8.27125 34.3558Z" fill="currentColor"/>
24
+ <path d="M12.5601 18.017C14.2332 18.6725 15.9372 19.4786 17.5019 20.4515C19.9805 21.9927 22.38 24.1208 23.5241 26.9914C24.2516 28.8168 24.2152 30.6223 23.4834 32.2482C23.1213 33.0529 22.6157 33.7553 22.0354 34.3669C27.6731 32.3348 32.9532 28.6804 30.9428 22.9781C28.6334 16.428 20.4047 12.4027 14.1807 10.4674C12.3234 9.88988 10.7357 11.7563 11.3182 13.6121C11.7303 14.9248 12.1549 16.4076 12.5601 18.017Z" fill="currentColor" fill-opacity="0.89"/>
25
+ </svg>
26
+ "#;
27
+
28
  html!(
29
  (header(colorscheme, theme, animation))
30
  main class="search-container"{
31
+ (PreEscaped(logo_svg))
32
  (bar(&String::default()))
33
  (PreEscaped("</div>"))
34
  }
websurfx/config.lua CHANGED
@@ -59,8 +59,9 @@ redis_url = "redis://127.0.0.1:8082" -- redis connection url address on which th
59
  cache_expiry_time = 600 -- This option takes the expiry time of the search results (value in seconds and the value should be greater than or equal to 60 seconds).
60
  -- ### Search Engines ###
61
  upstream_search_engines = {
62
- DuckDuckGo = true,
63
- Searx = false,
64
- Brave = false,
65
- Startpage = false,
 
66
  } -- select the upstream search engines from which the results should be fetched.
 
59
  cache_expiry_time = 600 -- This option takes the expiry time of the search results (value in seconds and the value should be greater than or equal to 60 seconds).
60
  -- ### Search Engines ###
61
  upstream_search_engines = {
62
+ DuckDuckGo = true,
63
+ Searx = false,
64
+ Brave = false,
65
+ Startpage = false,
66
+ LibreX = false,
67
  } -- select the upstream search engines from which the results should be fetched.