Compare commits

..

5 Commits

Author SHA1 Message Date
nune
aacfbeef20
Update app.js 2024-12-19 23:49:02 -05:00
nune
f657f6a470
Update client.js 2024-12-19 23:46:42 -05:00
nune
7df9789695
Update index.html 2024-12-19 23:45:46 -05:00
nune
ef98407318
Update app.js 2024-12-19 23:44:51 -05:00
nune
22bb0aa14f
Create bumbler.txt 2024-12-19 21:18:14 -05:00
4 changed files with 58 additions and 0 deletions

20
app.js
View File

@ -1,6 +1,7 @@
const express = require('express'); const express = require('express');
const fetch = require('node-fetch'); const fetch = require('node-fetch');
const cookieParser = require('cookie-parser'); const cookieParser = require('cookie-parser');
const path = require('path');
const app = express(); const app = express();
const PORT = process.env.PORT || 3000; const PORT = process.env.PORT || 3000;
@ -8,6 +9,25 @@ const PORT = process.env.PORT || 3000;
app.use(express.static('public')); app.use(express.static('public'));
app.use(cookieParser()); app.use(cookieParser());
// Environment variable to toggle ASCII art
const showAsciiArt = process.env.SHOW_ASCII_ART === 'true';
const asciiArtFolder = process.env.ASCII_ART_FOLDER || path.join(__dirname, 'ascii');
// Get ASCII art files
const asciiArtFiles = showAsciiArt ? fs.readdirSync(asciiArtFolder).filter(file => file.endsWith('.txt')) : [];
// Serve a random ASCII art
app.get('/ascii', (req, res) => {
if (!showAsciiArt || asciiArtFiles.length === 0) {
res.json({ enabled: false });
return;
}
const randomFile = asciiArtFiles[Math.floor(Math.random() * asciiArtFiles.length)];
const art = fs.readFileSync(path.join(asciiArtFolder, randomFile), 'utf-8');
res.json({ enabled: true, art });
});
const autoCopyDefault = process.env.AUTO_COPY_DEFAULT === 'true'; const autoCopyDefault = process.env.AUTO_COPY_DEFAULT === 'true';
app.get('/auto-copy-default', (req, res) => { app.get('/auto-copy-default', (req, res) => {

25
ascii/bumbler.txt Normal file
View File

@ -0,0 +1,25 @@
#__<+?
)~~~+8
%<~<~w
t) >><<|
<><n|]<$/><(w
~<>_<<<><|||(|_<>/&
$-|[<>><<>j|||||h0%W $J
+(|<x<<><<||||r@@$@8<u Bw8i>-(|
<||>><<>><(|||(#@$$|((<$ o>~>@pzB||f@
>((X<>><?(Y|nJY@@@t|||||~ @/zzXBk@|(co
>|((><<><><||||W$||||(|||(h ><><>>>?-bcccc8|||B $>>><>)|(Y
>(||x>>>_((z/Y/&$L|||||||#@| $<><>>-|||(<WcY(||$% _>>><(|w|||/
jn|||U><><(|(|t@@/|(||(||@/|a ><>>|||(||(>>i>(B@B >>><[|k$%%B|/
xtnxv|(//c&@8|r||||||/$t|W@@@@$W@@$@$@r(_<>J>||Y|C>>>>(x@@ZZ$j
t|/|/||(||||U(/|||BC|t@@@$@$@@@+>>>>>/$@@@>/8Bh>i>~|8$kmZ8@
#f|||(|||||jp@@BOr/*B$@@@@B<ii>>>xYp@$8-(/||@i>>}|%$omm%&
@$@@u>>i>>{Yvw@@M{((|(L@Q|/pB$$@mm@
$@$J>>>>i>>u$$$%((|(|/@@@$$@$@$@@$B
$W>i>>i>>&@@$%(|((|(@@$@@@@%$@$$@
i>>i>>>j$$$@(()|||@@$$w(|/ $@@$@$
B<>iiii>$@@@[B%%(j@$$j)|(m $@$$@$
&B8%B%%%%%ZO&%%%8@@8|||/M %@@$$@WfjX
WB%%%%%%%8OZB8@@@f||fU %$@@@$ntt
&%%%%8%B%mOo$@$ B@$Y///k

View File

@ -13,6 +13,18 @@ document.addEventListener('DOMContentLoaded', async () => {
setCookie('autoCopyEnabled', autoCopyCheckbox.checked, 365); setCookie('autoCopyEnabled', autoCopyCheckbox.checked, 365);
}); });
// Fetch ASCII art and display it
try {
const response = await fetch('/ascii');
const data = await response.json();
if (data.enabled) {
const asciiArtContainer = document.getElementById('asciiArtContainer');
asciiArtContainer.textContent = data.art;
}
} catch (error) {
console.error('Failed to fetch ASCII art:', error);
}
// Handle "Go to Raw Paste" button click // Handle "Go to Raw Paste" button click
fetchBtn.addEventListener('click', async () => { fetchBtn.addEventListener('click', async () => {
const urlInput = pasteUrlInput.value.trim(); const urlInput = pasteUrlInput.value.trim();

View File

@ -59,6 +59,7 @@
auto-copy paste contents? auto-copy paste contents?
</label> </label>
<script src="client.js" defer></script> <script src="client.js" defer></script>
<div id="asciiArtContainer" aria-hidden="true" style="position: fixed; bottom: 0; right: 0; padding: 10px; font-family: monospace; white-space: pre;"></div>
<p><a href="https://github.com/gigirassy/plaster">source code</a> is licensed under the public domain</p></div> <p><a href="https://github.com/gigirassy/plaster">source code</a> is licensed under the public domain</p></div>
</body> </body>
</html> </html>