Change name to AlpineFind & some enhancements

This commit is contained in:
Victor Bodinaud
2025-03-19 13:45:57 +01:00
parent dd78fcafd9
commit ca0fa5b815
8 changed files with 111 additions and 28 deletions

35
Dockerfile Normal file
View File

@@ -0,0 +1,35 @@
FROM arm64v8/php:8.1-apache
# Installation des dépendances PHP nécessaires
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
git \
unzip \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) gd
# Activer le module rewrite pour Apache
RUN a2enmod rewrite
# Installer Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Définir le répertoire de travail
WORKDIR /var/www/html
# Copier le code source
COPY . /var/www/html/
# Installer les dépendances via Composer
RUN composer install --no-interaction --optimize-autoloader
# Ajuster les permissions
RUN chown -R www-data:www-data /var/www/html
# Exposer le port 80
EXPOSE 80
# Démarrer Apache
CMD ["apache2-foreground"]

View File

@@ -1,4 +1,4 @@
# FrogFind
Source for the FrogFind search engine for vintage computers
# AlpineFind
Source for the AlpineFind search engine for vintage computers
Love the frog. Be the frog.
Love the Alpine. Be the Alpine.

View File

@@ -5,7 +5,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<head>
<title>FrogFind!</title>
<title>AlpineFind!</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<style type="text/css">
a {
@@ -23,24 +23,26 @@
<form action="/" method="get">
<a href="/">
<font size=6 color="#008000">Frog</font>
<font size=6 color="#008000">Alpine</font>
<font size=6 color="#000000">Find!</font>
</a> Leap again: <input type="text" size="30" name="q" value="<?php echo urldecode($query) ?>">
</a>
<p>Leap again:</p>
<input type="text" size="30" name="q" value="<?php echo urldecode($query) ?>">
<input type="submit" value="Ribbbit!">
</form>
<hr>
<br>
<center>
<h1>What in the world is FrogFind?</h1>
<h1>What in the world is AlpineFind?</h1>
<small>A quick FAQ on an unconventional search engine</small>
</center>
<br>
<h3>Who made FrogFind?</h3>
<h3>Who made AlpineFind?</h3>
Hi, I'm Sean, A.K.A. <a href="https://youtube.com/ActionRetro">Action Retro</a> on YouTube. I work on a lot of 80's and 90's Macs (and other vintage machines), and I really like to try and get them online. However, the modern internet is not kind to old machines, which generally cannot handle the complicated javascript, CSS, and encryption that modern sites have. However, they can browse basic websites just fine. So I decided to see how much of the internet I could turn into basic websites, so that old machines can browse the modern internet once again!
<h3>How does FrogFind work?</h3>
The search functionality of FrogFind is basically a custom wrapper for DuckDuckGo search, converting the results to extremely basic HTML that old browsers can read. When clicking through to pages from search results, those pages are processed through a <a href="https://github.com/fivefilters/readability.php" target="_blank">PHP port of Mozilla's Readability</a>, which is what powers Firefox's reader mode. I then further strip down the results to be as basic HTML as possible.
<h3>What machines do you test FrogFind on?</h3>
I designed FrogFind with classic Macs in mind, so I've been testing on my SE/30 to make sure it looks good in 1 bit color with a 512x384 resolution. Most of my testing has been on Netscape 1.1N and 2.0.2, as well as a few 68k Mac versions of iCab. FrogFind should also work great on any text-based web browser!
<h3>How does AlpineFind work?</h3>
The search functionality of AlpineFind is basically a custom wrapper for DuckDuckGo search, converting the results to extremely basic HTML that old browsers can read. When clicking through to pages from search results, those pages are processed through a <a href="https://github.com/fivefilters/readability.php" target="_blank">PHP port of Mozilla's Readability</a>, which is what powers Firefox's reader mode. I then further strip down the results to be as basic HTML as possible.
<h3>What machines do you test AlpineFind on?</h3>
I designed AlpineFind with classic Macs in mind, so I've been testing on my SE/30 to make sure it looks good in 1 bit color with a 512x384 resolution. Most of my testing has been on Netscape 1.1N and 2.0.2, as well as a few 68k Mac versions of iCab. AlpineFind should also work great on any text-based web browser!
<h3>How can I get in touch with you?</h3>
Send me an email! <a href="mailto:actionretro@pm.me">actionretro@pm.me</a>
</body>

10
docker-compose.yml Normal file
View File

@@ -0,0 +1,10 @@
version: '3'
services:
alpinefind:
build: .
ports:
- "7000:80"
volumes:
- ./:/var/www/html
restart: unless-stopped

View File

@@ -30,7 +30,7 @@ if (substr($url, 0, 4) != "http") {
<html>
<head>
<title>FrogFind Image Viewer</title>
<title>AlpineFind Image Viewer</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
</head>

View File

@@ -44,7 +44,9 @@ imagecopyresampled($dest_image, $raw_image, 0, 0, 0, 0, $dest_imagex, $dest_imag
header('Content-type: image/' . $filetype);
if ($filetype = "jpg") {
imagejpeg($dest_image, NULL, 80); //80% quality
// Compression augmentée de 80% à 65%
imagejpeg($dest_image, NULL, 65);
} elseif ($filetype = "png") {
imagepng($dest_image, NULL, 8); //80% compression
// Compression augmentée de 8 à 9 (plus compressé)
imagepng($dest_image, NULL, 9);
}

View File

@@ -9,6 +9,12 @@ if (isset($_GET['q'])) { // if there's a search query, show the results for it
$query = urlencode($_GET["q"]);
$show_results = TRUE;
$search_url = "https://html.duckduckgo.com/html?q=" . $query;
// Configuration de la pagination
$results_per_page = 5; // Nombre de résultats par page
$current_page = isset($_GET['p']) ? intval($_GET['p']) : 1;
if ($current_page < 1) $current_page = 1;
$context = stream_context_create([
'http' => [
'header' => "Cache-Control: no-cache\r\n" .
@@ -26,9 +32,17 @@ if (isset($_GET['q'])) { // if there's a search query, show the results for it
$result_blocks = explode('<h2 class="result__title">', $simple_results);
$total_results = count($result_blocks) - 1;
// Calcul des paramètres de pagination
$total_pages = ceil($total_results / $results_per_page);
if ($total_pages == 0) $total_pages = 1; // Éviter la division par zéro
$start_result = ($current_page - 1) * $results_per_page + 1;
$end_result = min($start_result + $results_per_page - 1, $total_results);
for ($x = 1; $x <= $total_results; $x++) {
if (strpos($result_blocks[$x], '<a class="badge--ad">') === false) { //only return non ads
// Affichage des résultats pour la page actuelle seulement
for ($x = $start_result; $x <= $end_result; $x++) {
if ($x <= $total_results && strpos($result_blocks[$x], '<a class="badge--ad">') === false) { //only return non ads
// result link, redirected through our proxy
$result_link = explode('class="result__a" href="', $result_blocks[$x])[1];
$result_topline = explode('">', $result_link);
@@ -47,6 +61,17 @@ if (isset($_GET['q'])) { // if there's a search query, show the results for it
. $result_display_url . "</font></a><br>" . $result_snippet . "<br><br><hr>";
}
}
// Ajout des liens de pagination
$final_result_html .= "<br><center>";
if ($current_page > 1) {
$final_result_html .= "<a href='/?q=" . $query . "&p=" . ($current_page - 1) . "'>&lt; Previous</a> ";
}
$final_result_html .= "Page " . $current_page . " of " . $total_pages;
if ($current_page < $total_pages) {
$final_result_html .= " <a href='/?q=" . $query . "&p=" . ($current_page + 1) . "'>Next &gt;</a>";
}
$final_result_html .= "</center>";
}
//replace chars that old machines probably can't handle
@@ -69,7 +94,7 @@ function clean_str($str)
<html>
<head>
<title>FrogFind!</title>
<title>AlpineFind!</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<style type="text/css">
a {
@@ -98,6 +123,12 @@ function clean_str($str)
margin: 10px 0;
}
</style>
<script type="text/javascript">
function showLoading() {
document.getElementById('loading').style.display = 'inline';
return true;
}
</script>
</head>
<body style="margin: 5px; padding: 0;">
@@ -105,14 +136,19 @@ function clean_str($str)
<?php if ($show_results) { // there's a search query in q, so show search results
?>
<form action="/" method="get" class="search-form">
<form action="/" method="get" onsubmit="return showLoading();" class="search-form">
<a href="/">
<font size=6 color="#008000">Frog</font>
<font size=6 color="#008000">Alpine</font>
<font size=6 color="#000000">Find!</font>
</a>
<div style="margin: 8px 0;">Leap again: <br>
<div style="margin: 8px 0;">
<p>Leap again:</p>
<input type="text" size="30" name="q" value="<?php echo urldecode($query) ?>">
<?php if (isset($_GET['p'])) { ?>
<input type="hidden" name="p" value="1">
<?php } ?>
</div>
<span id="loading" style="display: none;">Loading...</span>
<input type="submit" value="Ribbbit!">
</form>
<hr>
@@ -127,7 +163,7 @@ function clean_str($str)
<center>
<h1>
<font size=7>
<font color="#008000">Frog</font>Find!
<font color="#008000">Alpine</font>Find!
</font>
</h1>
</center>
@@ -136,9 +172,10 @@ function clean_str($str)
</center>
<br><br>
<center>
<form action="/" method="get">
Leap to: <br>
<form action="/" method="get" onsubmit="return showLoading();">
<p>Leap to:</p>
<input type="text" size="30" name="q"><br>
<span id="loading" style="display: none;">Loading...</span>
<input type="submit" value="Ribbbit!" style="margin: 10px auto;">
</form>
</center>
@@ -150,9 +187,6 @@ function clean_str($str)
</small>
</form>
</form>
<?php } ?>
</body>
</html>

View File

@@ -147,7 +147,7 @@ function clean_str($str)
<p>
<form action="/read.php" method="get">
<a href="/">Back to <b>
<font color="#008000">Frog</font>
<font color="#008000">Alpine</font>
<font color="000000">Find!</font></a></b> | Browsing URL: <input type="text" size="38" name="a" value="<?php echo $article_url ?>">
<input type="submit" value="Go!">
</form>