mirror of
https://github.com/gigirassy/plaster.git
synced 2024-12-24 10:49:07 +00:00
Compare commits
No commits in common. "aacfbeef203f89c95f72aeea9ea0803433134f50" and "68e701dd2186043881ee0be735e28992cb30da17" have entirely different histories.
aacfbeef20
...
68e701dd21
20
app.js
20
app.js
@ -1,7 +1,6 @@
|
|||||||
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;
|
||||||
@ -9,25 +8,6 @@ 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) => {
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
|
|
||||||
#__<+?
|
|
||||||
)~~~+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
|
|
@ -13,18 +13,6 @@ 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();
|
||||||
|
@ -59,7 +59,6 @@
|
|||||||
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>
|
||||||
|
Loading…
Reference in New Issue
Block a user