flitrx commited on
Commit
6cdeb0a
·
verified ·
1 Parent(s): 3844768

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +14 -27
index.html CHANGED
@@ -90,16 +90,6 @@
90
  @keyframes spin {
91
  to { transform: rotate(360deg); }
92
  }
93
-
94
- .truncate {
95
- white-space: nowrap;
96
- overflow: hidden;
97
- text-overflow: ellipsis;
98
- }
99
-
100
- .hidden {
101
- display: none;
102
- }
103
  </style>
104
  </head>
105
  <body class="min-h-screen">
@@ -184,12 +174,12 @@
184
 
185
  // Function to check Tor connection
186
  function checkTorConnection() {
187
- // First method: Check if we can access a Tor-only resource
188
- fetch('http://check.torproject.org/', {
189
  method: 'GET',
190
  mode: 'no-cors'
191
  })
192
- .then(response => {
193
  // If we get here, we're probably not using Tor (since the request would fail otherwise)
194
  showTorStatus(false);
195
  })
@@ -212,7 +202,7 @@
212
  // If the image fails to load, we're not using Tor
213
  showTorStatus(false);
214
  };
215
- img.src = 'https://duckduckgogg42xjoc72x3sjasowoarfbgcmvfimaftt6twagswzczad.onion/static-assets/favicons/DDG-icon_256x256.png'
216
  }
217
 
218
  // Update UI based on Tor status
@@ -252,12 +242,11 @@
252
  loadingIndicator.classList.remove('hidden');
253
  noResults.classList.add('hidden');
254
 
255
- // Use a proxy to bypass CORS since ahmia.fi doesn't allow direct access
256
- // Note: In a real Tor environment, you would directly query the .onion version of ahmia
257
  const proxyUrl = 'https://cors-anywhere.herokuapp.com/';
258
- const searchUrl = `http://juhanurmihxlp77nkq76byazcldy2hlmovfu2epvl5ankdibsot4csyd.onion/search/?q=${encodeURIComponent(query)}`;
259
 
260
- fetch(searchUrl, {
261
  headers: {
262
  'X-Requested-With': 'XMLHttpRequest'
263
  }
@@ -267,20 +256,18 @@
267
  return response.text();
268
  })
269
  .then(html => {
270
- // Create a temporary DOM parser to extract results
271
  const parser = new DOMParser();
272
  const doc = parser.parseFromString(html, 'text/html');
273
 
274
- // Extract results - using different selectors since ahmia.fi structure may have changed
275
- const resultElements = doc.querySelectorAll('.search-result');
276
 
277
  if (resultElements.length > 0) {
278
  resultElements.forEach(result => {
279
- const titleElement = result.querySelector('h4 a') || result.querySelector('h3 a') || result.querySelector('a');
280
- const title = titleElement ? titleElement.textContent : 'No title';
281
- const url = titleElement ? titleElement.href : '#';
282
- const descriptionElement = result.querySelector('p') || result.querySelector('.description');
283
- const description = descriptionElement ? descriptionElement.textContent : 'No description available';
284
 
285
  // Create result card
286
  const resultCard = document.createElement('div');
@@ -311,5 +298,5 @@
311
  setInterval(checkTorConnection, 30000);
312
  });
313
  </script>
314
- </body>
315
  </html>
 
90
  @keyframes spin {
91
  to { transform: rotate(360deg); }
92
  }
 
 
 
 
 
 
 
 
 
 
93
  </style>
94
  </head>
95
  <body class="min-h-screen">
 
174
 
175
  // Function to check Tor connection
176
  function checkTorConnection() {
177
+ // We'll attempt to fetch a known Tor-only resource
178
+ fetch('https://check.torproject.org/api/ip', {
179
  method: 'GET',
180
  mode: 'no-cors'
181
  })
182
+ .then(() => {
183
  // If we get here, we're probably not using Tor (since the request would fail otherwise)
184
  showTorStatus(false);
185
  })
 
202
  // If the image fails to load, we're not using Tor
203
  showTorStatus(false);
204
  };
205
+ img.src = 'https://duckduckgogg42xjoc72x3sjasowoarfbgcmvfimaftt6twagswzczad.onion/static-assets/favicons/DDG-icon_256x256.png';
206
  }
207
 
208
  // Update UI based on Tor status
 
242
  loadingIndicator.classList.remove('hidden');
243
  noResults.classList.add('hidden');
244
 
245
+ // We need to use a proxy to bypass CORS since ahmia.fi doesn't allow direct access
 
246
  const proxyUrl = 'https://cors-anywhere.herokuapp.com/';
247
+ const searchUrl = `https://ahmia.fi/search/?q=${encodeURIComponent(query)}`;
248
 
249
+ fetch(proxyUrl + searchUrl, {
250
  headers: {
251
  'X-Requested-With': 'XMLHttpRequest'
252
  }
 
256
  return response.text();
257
  })
258
  .then(html => {
259
+ // Parse the HTML response
260
  const parser = new DOMParser();
261
  const doc = parser.parseFromString(html, 'text/html');
262
 
263
+ // Extract results
264
+ const resultElements = doc.querySelectorAll('.result');
265
 
266
  if (resultElements.length > 0) {
267
  resultElements.forEach(result => {
268
+ const title = result.querySelector('h4 a')?.textContent || 'No title';
269
+ const url = result.querySelector('h4 a')?.href || '#';
270
+ const description = result.querySelector('p')?.textContent || 'No description available';
 
 
271
 
272
  // Create result card
273
  const resultCard = document.createElement('div');
 
298
  setInterval(checkTorConnection, 30000);
299
  });
300
  </script>
301
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=flitrx/dws3" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
302
  </html>