commit acb54d3b539d8efb90f9615aad7ad2f2488c525e Author: rbckman <rbckman@devuan> Date: Wed, 29 Jul 2026 01:50:26 +0300 first Diffstat:
336 files changed, 7239 insertions(+), 0 deletions(-)
diff --git a/html/almost.html b/html/almost.html @@ -0,0 +1,80 @@ +$def with (products,bag,sessionkey,productname,inbag,db,getprice,getrate,category,markdown,visitors, total, unique, show) + +$ siteconfig = db.select('propaganda', what='id, name, description, description2')[0] + +<HEAD> + <meta charset="utf-8"> + $#<title>$siteconfig.name | $siteconfig.description</title> + <title>Robin Bäckman | maker & baker</title> + <link rel="stylesheet" href="/static/splash.css?v=108" type="text/css" rel="stylesheet"/> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta http-equiv="cache-control" content="no-cache"> +</HEAD> + +<BODY> +<div class="introtext"> +$if show == 'all': + $ goodies = db.query("SELECT * FROM propagandapics ORDER BY ID DESC LIMIT 1000;") + $#<a href="?show=">show less 📃</a> top 999!<br> +$else: + $ goodies = db.query("SELECT * FROM propagandapics ORDER BY ID DESC LIMIT 3;") + $#<a href="?show=all">show more 📃</a> here latest<br> +$for g in goodies: + <a href="/#$g.name">$g.name</a><br> +<div id="visitors"> +last VISITS by COUNTRIES<br> +$for i in visitors: + <img src="/static/flags/${i}.png"> +<br> +$unique UNICORNS 🦄 PEACE! ☮️ +<br> +</div> +$#<h1>$siteconfig.name</h1> +$#$:markdown.markdown(siteconfig.description) +$:markdown.markdown(siteconfig.description) +$:markdown.markdown(siteconfig.description2) +~ +<br> +<br> +$ backlink = '' +$ goodies = db.query("SELECT * FROM propagandapics;") +$for g in goodies: + $if g.soundname[-5:] == '.jpeg' or g.soundname[-4:] == '.png': + <div id="$g.name"> + ~*~ + <br> + $if backlink != '': + <a href="/#">upp tibaks</a><br> + ~ + <br> + <img src="/static/img/web/$g.soundname"> + <br> + <br> + <br> + <br> + $:markdown.markdown(g.description) + <br> + <br> + $:markdown.markdown(g.description2) + <br> + ~ + <br> + </div> + $ backlink = g.name +<br> +<br> +robinbackman.com +<br> +Just Do Good +<br> +<a href="/#">back up?</a><br> +</div> +<br> +<br> +<br> +<br> +<br> +<br> +<br> + +</BODY> diff --git a/html/base.html b/html/base.html @@ -0,0 +1,15 @@ +$def with (content) +<!doctype html> +<HEAD> + <meta charset="utf-8"> + <title>Robin Bäckman | maker & baker</title> + <link rel="stylesheet" href="/static/robstyle.css?v=359" type="text/css" rel="stylesheet"/> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta http-equiv="cache-control" content="no-cache"> +</HEAD> + +<BODY> +<br> +$:content +<br> +</BODY> diff --git a/html/bigpic.html b/html/bigpic.html @@ -0,0 +1,5 @@ +$def with (p,name,goodies) + +$for i in goodies: + <a href="/static/upload/$i.soundlink/$i.soundname""><img class="imgprod" width="100%" src="/static/img/web/$i.soundname"></a><br> + <a href="/shop#$p"><-- back</a><br> diff --git a/html/bitcoin.html b/html/bitcoin.html @@ -0,0 +1,6 @@ +$def with (wallet) + +$for i in wallet: + $i + $wallet[i] + diff --git a/html/categories.html b/html/categories.html @@ -0,0 +1,13 @@ +$def with (listcategories, addcategory) +<div id="container"> +<div id="default"> +<br> +$for i in listcategories: + <a href='/categories?delete=$i.id'>$i.category</a> +<div id="addevent"> +<form method="POST"> +$:addcategory.render() +</form> +</div> +</div> +</div> diff --git a/html/checkout.html b/html/checkout.html @@ -0,0 +1,49 @@ +$def with (checkoutform,bag,productname,errormsg,db,getprice) +$ totsats = 0 +$ toteuro = 0 +<div id="container"> +<div id="default"> +<br> +~*~<br> +<h2>Checkout</h2> +in your order:<br> +$for i in bag: + $ goodies = db.query("SELECT * FROM soundlink WHERE id='" +i.product+"';") + $code: + price = getprice(i.product) + quantity = i.quantity + p_totsats=i.quantity*price[0] + p_toteuro=i.quantity*price[1] + $i.quantity x $productname(i.product) + <a href="/dropitem/$i.product">X</a> $p_toteuro€<br> + $for g in goodies: + $if g.soundname[-5:] == '.jpeg' or g.soundname[-4:] == '.png': + <br> + <img src="/static/img/thumb/$g.soundname" style="width:120px"><br> + <br> + $code: + totsats += p_totsats + toteuro += p_toteuro +$if totsats > 0: + <br> + total: $toteuro € +<br> +<br> + ~*~<br> +<br> +Order is only reserved once paid. +<br> +<br> +<h2>$errormsg</h2> +<div id="addevent"> +<form method="POST"> +$:checkoutform.render() +</form> +</div> +<br> +~*~<br> +<br> +<a href="/shop"><<<<<< back shoppin for more!!</a> +</div> +</div> +</div> diff --git a/html/config.html b/html/config.html @@ -0,0 +1,21 @@ +$def with (configform) +<div id="container"> +<div id="default"> +<br> +<form method="POST"> +$:configform.render() +</form> +<br> +<b>Logo</b> +<br> +<img src="/static/img/thumb/logo.png"> +<form method="POST" enctype="multipart/form-data" action=""> +<input type="file" name="imgfile"/> <br> +<br/> +<input name="upload", type="submit" value="upload" /> +</form> +</div> + +</div> +</div> +</div> diff --git a/html/cv.html b/html/cv.html @@ -0,0 +1,10 @@ +<div id="container"> + <div id="default"> + <br> + <h2>Robin Bäckman CV</h2> + <a href="/static/RobinBackmanCV.pdf">PDF</a><br> + <a href="/static/RobinBackmanCV.sla">Scribus source file</a><br> + <a href="javascript:history.back()">back</a><br> + </div> + </div> +</div> diff --git a/html/editor.html b/html/editor.html @@ -0,0 +1,486 @@ +$def with (storage, text, text2, markdown, safe_filename, soundlink, public, logged, user, combine, remix) + +<link rel="stylesheet" href="/static/splash.css?v=116" type="text/css" rel="stylesheet"/> +<meta name="viewport" content="width=device-width, initial-scale=1"> +<meta http-equiv="cache-control" content="no-cache"> +<html> +<head> + <title>HEART RANKED EDITOR</title> + <style> + #editor { width: 100%; height: 100px; } + #editor2 { width: 100%; height: 300px; } + #status { margin-top: 10px; font-style: italic; } + #drop-zone { + width: 450px; + height: auto; + border: 1px dashed #ccc; + border-radius: 12px; + text-align: center; + cursor: pointer; + transition: all 0.3s; + } + #drop-zone.dragover { + border-color: #007bff; + background: #e6f3ff; + } + #drop-zone p { + margin: 20px 0; + font-size: 18px; + color: #666; + } + #file-list { + margin-top: 20px; + max-height: 300px; + overflow-y: auto; + } + .file-item { + padding: 12px; + margin: 8px 0; + border-radius: 6px; + border: 1px solid #ddd; + display: flex; + align-items: center; + gap: 12px; + + } + .file-info { + flex: 1; + } + .progress-container { + height: 10px; + background: #eee; + border-radius: 4px; + overflow: hidden; + margin-top: 6px; + } + .progress-bar { + height: 100%; + background: linear-gradient(90deg, #007bff, #00c6ff); + width: 0%; + transition: width 0.3s ease; + } + .status { + font-size: 14px; + min-width: 90px; + text-align: right; + } + .success { color: green; } + .error { color: red; } + + .page-wrapper { + min-height: 100vh; /* Optional: full height */ + display: flex; + justify-content: center; /* Centers horizontally */ + padding: 20px 10px; + } + + .wrapper { + display: flex; + flex-wrap: wrap; + gap: 24px; + width: 100%; + max-width: 1200px; /* Adjust this to control total width */ + align-items: stretch; /* Both columns same height */ + } + + .main { + flex: 1 1 50%; /* Takes most of the space */ + min-width: 400px; /* Prevents it from becoming too narrow */ + max-width: 450px; /* Prevents it from becoming too narrow */ + padding:10px; + } + + #rendered { + flex: 0 0 50%px; /* Fixed width when there's room */ + min-width: 400px; /* Prevents it from becoming too narrow */ + max-width: 450px; /* Minimum width before it wraps */ + padding:10px; + } + + /* Optional: Make it full-width on very small screens */ + @media (max-width: 800px) { + .rendered { + flex: 1 1 100%; /* Takes full width on mobile */ + } + } + + </style> +</head> +<body> + +<div class="page-wrapper"> +<div class="wrapper"> +<div class="main"> +<div id="drop-zone"> + <p>Drag & drop images jpg, gif, png <br>or documents pdf, md, txt, readme <br>files here or click to browse</p> + <input type="file" id="file-input" multiple style="display:none;"> +</div> + +<div id="file-list"></div> + +<script> +/** + * Convert a filename into a web-safe version. + * + * @param {string} name + * @param {number} max_length + * @param {string} replacement + * @returns {string} + */ +function safeFilename(name, maxLength = 100, replacement = "-") { + if (!name || typeof name !== "string") { + return "file"; + } + + // Normalize unicode (é → e, etc.) + let normalized = name.normalize("NFKD"); + + // Remove non-ASCII characters (equivalent to Python's encode('ascii', 'ignore')) + normalized = normalized.replace(/[^\x00-\x7F]/g, ""); + + // Replace spaces and underscores with replacement char + normalized = normalized.replace(/[\s_]+/g, replacement); + + // Keep only alphanumeric, hyphen, underscore, and dot + normalized = normalized.replace(/[^a-zA-Z0-9.\-_]/g, ""); + + // Replace multiple replacement chars with single one + const esc = replacement.replace(/[.*+?^$${}()|[\]\\]/g, "\\$&"); + normalized = normalized.replace(new RegExp(esc + "+", "g"), replacement); + + // Remove leading/trailing replacement chars and dots + normalized = normalized.replace(new RegExp(`^[$${esc}.]+|[$${esc}.]+$$`, "g"), ""); + + // Prevent empty or hidden files + if (!normalized || normalized.startsWith(".")) { + normalized = "file" + normalized; + } + + // Enforce max length (leave room for extension) + if (normalized.length > maxLength) { + normalized = normalized.substring(0, maxLength); + } + + return normalized.toLowerCase(); +} + + +const dropZone = document.getElementById('drop-zone'); +const fileInput = document.getElementById('file-input'); +const fileListEl = document.getElementById('file-list'); + +dropZone.addEventListener('click', () => fileInput.click()); + +dropZone.addEventListener('dragover', e => { e.preventDefault(); dropZone.classList.add('dragover'); }); +dropZone.addEventListener('dragleave', () => dropZone.classList.remove('dragover')); +dropZone.addEventListener('drop', e => { + e.preventDefault(); + dropZone.classList.remove('dragover'); + handleFiles(e.dataTransfer.files); +}); + +fileInput.addEventListener('change', e => handleFiles(e.target.files)); + +function handleFiles(files) { + fileListEl.innerHTML = '<code>Files to upload:</code>'; + + Array.from(files).forEach((file, index) => { + const id = 'file-' + index; + const item = document.createElement('div'); + const filenamez = safeFilename(file.name); + item.className = 'file-item'; + item.id = id; + item.innerHTML = ` + <div class="file-info"> + <strong>$${filenamez}</strong> + <small>($${(file.size / 1024 / 1024).toFixed(2)} MB)</small><br> + <a style="color: white;" class="insert-link" onclick="insertAtCursor('$${filenamez}')">insert</a> + <a style="color: white;" class="insert-link" onclick="rotateright('$${filenamez}')">↻</a> + <a style="color: white;" class="insert-link" onclick="rotateleft('$${filenamez}')">↺</a> + <div class="progress-container"> + <div class="progress-bar" id="prog-$${id}"></div> + </div> + </div> + <span class="status" id="status-$${id}">Waiting...</span> + `; + fileListEl.appendChild(item); + }); + + uploadSequentially(Array.from(files)); // One by one with individual progress +} + +async function uploadSequentially(files) { + for (let i = 0; i < files.length; i++) { + const file = files[i]; + const id = 'file-' + i; + const progressBar = document.getElementById(`prog-$${id}`); + const statusEl = document.getElementById(`status-$${id}`); + + statusEl.textContent = 'Uploading...'; + + await uploadSingleFile(file, progressBar, statusEl); + } +} + +function uploadSingleFile(file, progressBar, statusEl) { + return new Promise((resolve) => { + const formData = new FormData(); + formData.append('files', file); // same key as backend + + const xhr = new XMLHttpRequest(); + xhr.open('POST', '/upload', true); + + xhr.upload.onprogress = (e) => { + if (e.lengthComputable) { + const percent = Math.round((e.loaded / e.total) * 100); + progressBar.style.width = percent + '%'; + statusEl.textContent = percent + '%'; + } + }; + + xhr.onload = () => { + if (xhr.status === 200) { + progressBar.style.width = '100%'; + statusEl.textContent = '✅ Done'; + statusEl.classList.add('success'); + } else { + statusEl.textContent = '❌ Failed'; + statusEl.classList.add('error'); + } + resolve(); + }; + + xhr.onerror = () => { + statusEl.textContent = '❌ Error'; + statusEl.classList.add('error'); + resolve(); + }; + + xhr.send(formData); + }); +}</script> + + +<small><span style="color: yellow">#Heading1 ##Heading2 ###Heading3</span><span style="color: green"> **bold text**</span> <span style="color: magenta"> *italicized text*</span><span style="color: red"> > blockquote</span><span style="color: lime"> 1. First item 2. Second item 3. Third item</span><span style="color: purple"> - First item - Second item - Third item</span><span style="color: cyan"> `code`</span><span style="color: orange"> line break --- </span><span style="color: silver"> link [title](https://robinbackman.com)</span></small><br> +<br> +<textarea id="editor">$text</textarea> +<small id="count">255 characters remaining</small> +<textarea id="editor2">$text2</textarea> +$if soundlink: + <a href="https://robinbackman.com/editor?edit=$soundlink"><code>https://robinbackman.com/editor?edit=$soundlink</code></a></br> +<div id="status"></div> +<a id='back' href='/heartranked'>go back</a> +$if logged: + or <a id='publish' href='/editor?publish=yes'>publish</a> + or <a id='new' href='/editor?new=yes'>new</a> + <small>logged in as $user + $if combine: + this is a <a href="/heartranked?show=$combine">combined post</a> + $if remix: + this is a <a href="/heartranked?show=$remix">remix post</a></small> +</div> +<div style="text-align: left; width: 455px;" id="rendered"> +</div> +<small>made with LOVE by King Robin. sorry only registered users can publish for now.</small> +</div> + +<script> +$if public == 'yes': + const link = document.getElementById('publish'); + link.style.visibility = 'hidden'; + +let lastSaved = document.getElementById("editor").value; + +// Wait until the page is fully loaded +document.addEventListener('DOMContentLoaded', () => { + + const texteditor = document.getElementById('editor'); + const count = document.getElementById('count'); + + // Safety check + if (!texteditor || !count) { + console.error('Element not found! Check your IDs.'); + return; + } + + texteditor.addEventListener('input', () => { + const remaining = 255 - texteditor.value.length; + if (remaining < 0) { + count.textContent = `$${remaining} TOO MANY CHARACTERS. CAN'T PUBLISH! KEEP IT SHORTER.`; + const link = document.getElementById('publish'); + link.style.visibility = 'hidden';} + else { + count.textContent = `$${remaining} characters remaining`; + const link = document.getElementById('publish'); + link.style.visibility = 'visible';} + + // Optional: Change color when getting low + if (remaining < 30) { + count.style.color = 'red'; + } else if (remaining < 80) { + count.style.color = 'orange'; + } else { + count.style.color = 'gray'; + } + }); + + // Initial count + count.textContent = '255 characters remaining'; +}); + +lastSaved = ''; +lastSaved2 = ''; + +// Auto-save every 60 seconds +async function autoSave() { + const textarea = document.getElementById("editor"); + const currentText = textarea.value; + const textarea2 = document.getElementById("editor2"); + const currentText2 = textarea2.value; + if (currentText === lastSaved && currentText2 === lastSaved2) return; + + try { + const res = await fetch('/save', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ text: currentText , text2: currentText2 }) + }); + + if (res.ok) { + lastSaved = currentText; + lastSaved2 = currentText2; + const link = document.getElementById('publish'); + link.style.visibility = 'visible'; + document.getElementById("status").innerHTML = + `Saved at $${new Date().toLocaleTimeString()}`; + } + } catch (e) { + document.getElementById("status").innerHTML = "Save failed"; + } + + if (currentText === lastSaved2 && currentText2 === lastSaved2) return; + +} + +// Fetch rendered content from server +async function updateRendered() { + const textarea = document.getElementById("editor"); + const currentText = textarea.value; + const textarea2 = document.getElementById("editor2"); + const currentText2 = textarea2.value; + if (currentText === lastSaved && currentText2 === lastSaved2) return; + try { + const res = await fetch('/rendered'); + const text = await res.text(); + if (text != 'None') { + document.getElementById("rendered").innerHTML = text;} + } catch (e) { + console.error("Failed to fetch rendered content"); + } +} + +// Set up intervals +setInterval(autoSave, 5000); // Auto-save every 60s +setInterval(updateRendered, 5000); // Update rendered every 5s + +// Manual save triggers +document.getElementById("editor").addEventListener("blur", autoSave); +document.addEventListener("keydown", e => { + if (e.ctrlKey && e.key === "s") { + e.preventDefault(); + autoSave(); + } +}); + +async function rotateright(text) { + try { + const res = await fetch('/imageapi', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ image: text , action: 'rotateright'}) + }); + } catch (e) { + console.error(e); + status.innerHTML = '<span style="color:red">❌ Failed to send</span>'; + } +} + +async function rotateleft(text) { + try { + const res = await fetch('/imageapi', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ image: text , action: 'rotateleft'}) + }); + } catch (e) { + console.error(e); + status.innerHTML = '<span style="color:red">❌ Failed to send</span>'; + } +} + +let lastActiveTextarea = null; + +// Track which textarea was last focused +function trackActive() { + const text1 = document.getElementById('editor'); + const text2 = document.getElementById('editor2'); + + text1.addEventListener('focus', () => lastActiveTextarea = text1); + text2.addEventListener('focus', () => lastActiveTextarea = text2); +} + +function isdocs(filename) { + const lower = filename.toLowerCase(); + return lower.endsWith('.txt') || + lower.endsWith('.pdf') || + lower.endsWith('.md') || + lower.endsWith('.readme'); +} + +function isfilm(filename) { + const lower = filename.toLowerCase(); + return lower.endsWith('.mpeg') || + lower.endsWith('.mp4'); +} + +function insertAtCursor(text) { + if (!lastActiveTextarea) { + alert("Please click inside one of the textareas first!"); + return; + } + const start = lastActiveTextarea.selectionStart; + const end = lastActiveTextarea.selectionEnd; + if (isdocs(text)) { + const insertlen = "["+text+"](/static/users/$user/docs/"+text+" '"+text+"')\n"; + lastActiveTextarea.value = lastActiveTextarea.value.substring(0, start) + + insertlen + + lastActiveTextarea.value.substring(end); + } + if (isfilm(text)) { + const insertlen = "<video controls='controls'><source src=/static/users/$user/films/"+text+"></video>\n"; + lastActiveTextarea.value = lastActiveTextarea.value.substring(0, start) + + insertlen + + lastActiveTextarea.value.substring(end); + } else { + const insertlen = "\n"; + lastActiveTextarea.value = lastActiveTextarea.value.substring(0, start) + + insertlen + + lastActiveTextarea.value.substring(end); + } + // Move cursor after inserted text + lastActiveTextarea.selectionStart = lastActiveTextarea.selectionEnd = start + insertlen.length; + + // Focus it again so you can keep typing + lastActiveTextarea.focus(); +} +// Initialize tracking +window.onload = trackActive; + +// Initial load +updateRendered(); +</script> +</body> +</html> + + + diff --git a/html/feed.html b/html/feed.html @@ -0,0 +1,41 @@ +$def with (configform, picform, goodies, nocache, story) +<div id="container"> +<div id="default"> +<br> +$code: + +$for i in goodies: + <a href="/propaganda?soundname=$i.soundlink">$i.soundlink</a> | +<br> +<form method="POST"> +$:configform.render() +</form> +<br> +<b>upload images</b> +<br> +$if goodies != None: + $for i in story: + $if i.soundname[-5:] == '.jpeg' or i.soundname[-4:] == '.png': + <img src="/static/img/thumb/$i.soundname?nocache=$nocache"> + $else: + <p>$i.soundname</p> + <br> + <a href='/propaganda?cmd=flipleft&soundname=$i.soundname'>flip to left</a> | + <a href='/propaganda?cmd=remove&soundname=$i.soundname'>remove</a> | + <a href='/propaganda?cmd=flipright&soundname=$i.soundname'>flip to right</a> + <br> + $picform.fill(name=i.name, description=i.description, description2=i.description2, id=i.soundlink) + <form method="POST"> + $:picform.render() + </form> + <hr> +<form method="POST" enctype="multipart/form-data" action=""> +<input type="file" name="imgfile"/> <br> +<br/> +<input name="upload", type="submit" value="upload" /> +</form> +</div> + +</div> +</div> +</div> diff --git a/html/forgotpass.html b/html/forgotpass.html @@ -0,0 +1,14 @@ +$def with (forgotpassform, fejl) +<div id="container"> + <div id="default"> + <br> + <h2>Skicka nytt lösenord</h2> + <div id="addevent"> + <form method="POST"> + $:forgotpassform.render() + </form> + <h4>$fejl</h4> + </div> + <a href="/login"><---tibaks</a> + </div> +</div> diff --git a/html/goodies-old.html b/html/goodies-old.html @@ -0,0 +1,53 @@ +$def with (key,keys,productname,db,getprice) +<div id="container"> +<div id="default"> +<a href="/">go back</a> +<br> +<h2>All Your Goodies!</h2> +<br> + +$ totsats = 0 +$ toteuro = 0 +$if keys != []: + $for k in keys: + $ bags = db.query("SELECT * FROM paidbags WHERE sessionkey='"+k.invoice_key+"' ORDER BY timeadded DESC;") + $for i in bags: + $ invoice = db.select('invoices', where="invoice_key='"+i.sessionkey+"'")[0] + <div class="orders" id="$invoice.id"> + $code: + price = getprice(i.product) + quantity = i.quantity + p_totsats=i.quantity*price[0] + p_toteuro=i.quantity*price[1] + $i.timeadded + <br> + $productname(i.product)<br> + status: $invoice.status<br> + $if invoice.status=='shipped': + $invoice.dateshipped + <br> + $ goodies = db.query("SELECT * FROM soundlink WHERE id='"+i.product+"';") + $for g in goodies: + $if g.soundname[-5:] == '.jpeg' or g.soundname[-4:] == '.png': + <img src="/static/img/thumb/$g.soundname" style="width:120px"><br> + $else: + <a href="/static/upload/$g.soundlink/$g.soundname">$g.soundname</a> <- Download file + <br> + $code: + totsats += p_totsats + toteuro += p_toteuro + </div> + <br> +<br> +total: $totsats Satoshi or $toteuro €<br> +<br> +Order is only reserved once paid. +If you choose NO-SHIPPING you will have to pick up the order yourself. +Contact this guy rob@tarina.org ☮ +<br> +<br> +</div> +<a href="/"><<<<<< back shoppin for more!!</a> +</div> +</div> +</div> diff --git a/html/goodies.html b/html/goodies.html @@ -0,0 +1,53 @@ +$def with (key,keys,productname,db,getprice) +<div id="container"> +<div id="default"> +<a href="/">go back</a> +<br> +<h2>All Your Goodies!</h2> +<br> + +$ totsats = 0 +$ toteuro = 0 +$if keys != []: + $for k in keys: + $ bags = db.query("SELECT * FROM paidbags WHERE sessionkey='"+k.invoice_key+"' ORDER BY timeadded DESC;") + $for i in bags: + $ invoice = db.select('invoices', where="invoice_key='"+i.sessionkey+"'")[0] + <div class="orders" id="$invoice.id"> + $code: + price = getprice(i.product) + quantity = i.quantity + p_totsats=i.quantity*price[0] + p_toteuro=i.quantity*price[1] + $i.timeadded + <br> + $productname(i.product)<br> + status: $invoice.status<br> + $if invoice.status=='shipped': + $invoice.dateshipped + <br> + $ goodies = db.query("SELECT * FROM soundlink WHERE id='"+i.product+"';") + $for g in goodies: + $if g.soundname[-5:] == '.jpeg' or g.soundname[-4:] == '.png': + <img src="/static/img/thumb/$g.soundname" style="width:120px"><br> + $else: + <a href="/static/upload/$g.soundlink/$g.soundname">$g.soundname</a> <- Download file + <br> + $code: + totsats += p_totsats + toteuro += p_toteuro + </div> + <br> +<br> +total: $toteuro €<br> +<br> +Order is only reserved once paid. +If you choose NO-SHIPPING you will have to pick up the order yourself. +Contact this guy rob@tarina.org ☮ +<br> +<br> +</div> +<a href="/"><<<<<< back shoppin for more!!</a> +</div> +</div> +</div> diff --git a/html/heartranked.html b/html/heartranked.html @@ -0,0 +1,228 @@ +$def with (db,markdown,visitors, total, unique, show, logged, rights, namn, getlikes, formattime, feedbase, totbilder, limit, offset, bildpersida, search, bilder, searchform, getcombines, timebase, getfeed, getcombofeed, userimage, postexist) + +<HEAD> + <meta charset="utf-8"> + $#<title>$siteconfig.name | $siteconfig.description</title> + <title>HEART RANKED | this is to do be the NEXT LEVEL SOCIAL NETWORK </title> + <link rel="stylesheet" href="/static/splash.css?v=139" type="text/css" rel="stylesheet"/> + <meta name="viewport" content="width=device-width, initial-scale=1"> +</HEAD> + +<BODY> +<div class="introtext"> +<a href="/">go back</a> +$if rights=='mod' or rights=='admin': + or <a href="/logout">log out</a> +<div id="visitors"> +last VISITS by COUNTRIES<br> +$for i in visitors: + <img src="/static/flags/${i}.png"> +<br> +$unique UNICORNS 🦄 PEACE! ☮️ +<br> +<div id="mod"> +$if rights=='mod' or rights=='admin': + $ displayname = db.query("SELECT displayname FROM rymdadmin WHERE name='"+namn+"';")[0] + hey <b><a href="/tuning">$displayname.displayname</a></b>, <a href="/invites">invite</a> or <a href="/editor?new=yes">write</a> + <br> +$else: + <a href="/login">login</a> +</div> +$if rights=='mod' or rights=='admin': + <form method="POST"> + $:searchform.render() + </form> +</div> +$if show == 'all': + $ goodies = db.query("SELECT * FROM published ORDER BY ID DESC LIMIT 1000;") + $#<a href="?show=">show less 📃</a> top 999!<br> +$else: + $ goodies = db.query("SELECT * FROM published ORDER BY ID DESC LIMIT 1000;") + $#<a href="?show=all">show more 📃</a> here latest<br> + <br> +$if search != '': + $#if offset > bildpersida: + $# <a href="/s?page=back"><--- go back</a> + $#if offset < totbilder: + $# <a href="/s?page=next">next --></a> + <p>posts with search word $search: $totbilder</p> + <p><a href="/heartranked?search=">remove search</a></p> + $for b in bilder: + $for g in b: + <div class="post" id="$g.soundname"> + <br> + <br> + <div class="heartpost"> + $:markdown.markdown(g.description) + </div> + <div class="postmenu"> + <small>by $g.creator $formattime(g.timeadded)</small><br> + $getcombines(g.soundlink) + $if g.combine: + $ combined = db.select('published', where="soundlink='"+g.combine+"'")[0] + <small>combo with <a href="/heartranked?show=$combined.soundlink">$combined.soundname</a></small><br> + $if g.remix: + $ remixed = db.select('published', where="soundlink='"+g.remix+"'")[0] + <small>remixed <a href="/heartranked?show=$remixed.soundlink">$remixed.soundname</a></small><br> + $if g.description2 != '': + $if len(g.description2) > 255: + <a href="/heartranked?show=$g.soundlink">read plenty more</a> + $else: + <a href="/heartranked?show=$g.soundlink">read more</a> + $else: + <a href="/editor?combine=$g.soundlink">combo</a> + or <a href="/heartranked?show=$g.soundlink">more</a> + or <div class="megalike" id="megalike$g.soundlink" onclick="like('$g.soundlink')">$getlikes(g.soundlink,namn)</div> + <br> + </div> + </div> +$else: + $if show == None: + $#<small><a href="/heartranked?feedbase=timebased">timebased🌍</a> <a href="/heartranked?feedbase=heart1day">heartbased❤️day</a> <a href="/heartranked?feedbase=heart1week">week</a> <a href="/heartranked?feedbase=heart1month">month</a> <a href="/heartranked?feedbase=heart1year">year</a> <a href="/heartranked?feedbase=alltime">alltime</a></small> + <small>🌍 <a href="/heartranked?feedbase=time">time</a> ❤️ <a href="/heartranked?feedbase=heart">heart</a> ⚭ <a href="/heartranked?feedbase=combo">combo</a> for <a href="/heartranked?timebase=today">day</a> <a href="/heartranked?timebase=week">week</a> <a href="/heartranked?timebase=month">month</a> <a href="/heartranked?timebase=year">year</a> <a href="/heartranked?timebase=all">all</a></small> + <br> + $ goodies=getfeed() + $for g in goodies: + <div class="post" id="$g.soundname"> + <br> + <br> + <div class="heartpost"> + $:markdown.markdown(g.description) + </div> + <div class="postmenu"> + <small><small>$formattime(g.timeadded)</small></small> + <small>by $g.creator</small> + $:userimage(g.creator) + <br> + $getcombines(g.soundlink) + $if g.combine: + $if postexist(g.combine): + $ combined = db.select('published', where="soundlink='"+g.combine+"'")[0] + <small>combo with <a href="/heartranked?show=$combined.soundlink">$combined.soundname</a></small><br> + $if g.remix: + $if postexist(g.remix): + $ remixed = db.select('published', where="soundlink='"+g.remix+"'") + <small>remixed <a href="/heartranked?show=$remixed.soundlink">$remixed[0].soundname</a></small><br> + $if g.description2 != '': + $if len(g.description2) > 255: + <a href="/heartranked?show=$g.soundlink">read plenty more</a> + $else: + <a href="/heartranked?show=$g.soundlink">read more</a> + $else: + $if namn: + <a href="/editor?combine=$g.soundlink">combo</a> + or <a href="/heartranked?show=$g.soundlink">more</a> + $else: + <a href="/heartranked?show=$g.soundlink">combo</a> + or <div class="megalike" id="megalike$g.soundlink" onclick="like('$g.soundlink')">$getlikes(g.soundlink,namn)</div> + <br> + </div> + </div> + $else: + $ goodies = db.select('published', where="soundlink='"+show+"'") + $for g in goodies: + <a href="/heartranked#$g.soundname">back</a> + $if namn == g.creator: + or <a href="/heartranked?edit=$g.soundlink">edit</a> + $if namn: + or <a href="/editor?remix=$g.soundlink">remix</a> + or <a href="/editor?combine=$g.soundlink">combo</a> + $if namn == g.creator: + or <small><a href="/heartranked?remove=$g.soundlink">remove</a></small> + <div class="post" id="$g.soundname"> + <br> + <div class="heartpost"> + $:markdown.markdown(g.description) + $:markdown.markdown(g.description2) + </div> + <div class="postmenu"> + <small>by $g.creator $formattime(g.timeadded)</small><br> + $getcombines(g.soundlink) + $if g.combine: + $ combined = db.select('published', where="soundlink='"+g.combine+"'")[0] + <small>combo with <a href="/heartranked?show=$combined.soundlink">$combined.soundname</a></small><br> + $if g.remix: + $ remixed = db.select('published', where="soundlink='"+g.remix+"'")[0] + <small>remixed <a href="/heartranked?show=$remixed.soundlink">$remixed.soundname</a></small><br> + and <a href="/heartranked#$g.soundname">back</a> + $if namn == g.creator: + or <a href="/heartranked?edit=$g.soundlink">edit</a> + $if namn: + or <a href="/editor?remix=$g.soundlink">remix</a> + or <a href="/editor?combine=$g.soundlink">combo</a> + <div class="megalike" id="megalike$g.soundlink" onclick="like('$g.soundlink')">$getlikes(g.soundlink,namn)</div> + <br> + </div> + </div> + <br> + <br> + $ comboposts=getcombofeed(show) + $ choose_feed = False + $for c in comboposts: + $if c.soundname and choose_feed == False: + $#<small><a href="/heartranked?show=$g.soundlink&feedbase=timebased">timebased 🌍</a> <a href="/heartranked?show=$g.soundlink&feedbase=heart1day">heartbased ❤️ day</a> <a href="/heartranked?show=$g.soundlink&feedbase=heart1week">week</a> <a href="/heartranked?show=$g.soundlink&feedbase=heart1month">month</a> <a href="/heartranked?show=$g.soundlink&feedbase=heart1year">year</a> <a href="/heartranked?show=$g.soundlink&feedbase=alltime">alltime</a></small> + <small>🌍 <a href="/heartranked?show=$g.soundlink&feedbase=time">time</a> ❤️ <a href="/heartranked?show=$g.soundlink&feedbase=heart">heart</a> ⚭ <a href="/heartranked?show=$g.soundlink&feedbase=combo">combo</a> for <a href="/heartranked?show=$g.soundlink&feedbase=today">day</a> <a href="/heartranked?show=$g.soundlink&timebase=week">week</a> <a href="/heartranked?show=$g.soundlink&timebase=month">month</a> <a href="/heartranked?show=$g.soundlink&timebase=year">year</a> <a href="/heartranked?show=$g.soundlink&timebase=all">all</a></small> + $ choose_feed = True + <div class="post" id="$c.soundname"> + <br> + <br> + <div class="heartpost"> + $:markdown.markdown(c.description) + $:markdown.markdown(c.description2) + </div> + <div class="postmenu"> + <small>by $c.creator $formattime(c.timeadded)</small><br> + $getcombines(c.soundlink) + $if c.combine: + $ combined = db.select('published', where="soundlink='"+c.combine+"'")[0] + <small>combo with <a href="/heartranked?show=$combined.soundlink">$combined.soundname</a></small><br> + $if c.remix: + $ remixed = db.select('published', where="soundlink='"+c.remix+"'")[0] + <small>remixed <a href="/heartranked?show=$remixed.soundlink">$remixed.soundname</a></small><br> + <a href="/heartranked?show=$c.soundlink">more</a> + or <a href="/heartranked#$c.soundname">back</a> + $if namn == c.creator: + or <a href="/heartranked?edit=$c.soundlink">edit</a> + $if namn: + or <a href="/editor?combine=$c.soundlink">combo</a> + <div class="megalike" id="megalike$c.soundlink" onclick="like('$c.soundlink')">$getlikes(c.soundlink,namn)</div> + <br> + </div> + </div> + +<br> +<br> +robinbackman.com +<br> +Just Do Good +<br> +$if show: + <a href="/heartranked?show=$show#">back up?</a> or <a href="/heartranked#$show">go back</a> +$else: + <a href="/heartranked#">back up?</a> or <br> +</div> +<br> +<br> +<br> +<br> +<br> +<br> +<br> +</BODY> +<script type="text/javascript"> +async function like(id) { + const megalike = document.getElementById('megalike'+id); + const response = await fetch('/like?imghash='+id, { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + }) + const responseJson = await response.json() + if (responseJson.user_likes === true) { + megalike.innerText = '❤️ '+responseJson.likes; + } else { + megalike.innerText = '🤍 '+responseJson.likes; + } +} +</script> diff --git a/html/index.html b/html/index.html @@ -0,0 +1,97 @@ +$def with (products,bag,sessionkey,productname,inbag,db,getprice,getrate,category,markdown) +$ totsats = 0 +$ toteuro = 0 +$ x = 0 +$if sessionkey != 'empty': + <div id="bag"> + <div id="insidebag"> + in your cart:<br> + $for i in bag: + $code: + price = getprice(i.product) + quantity = i.quantity + p_totsats=i.quantity*price[0] + p_toteuro=i.quantity*price[1] + $i.quantity x $productname(i.product) + $p_toteuro€ + <a href="/dropitem/$i.product">remove</a> + <br> + $code: + totsats += p_totsats + toteuro += p_toteuro + $if totsats > 0: + total: $toteuro € + <br> + <h5><a href="/checkout">Checkout 🛒 --></a></h5> + ~<br> + </div> + </div> + +$ siteconfig = db.select('siteconfig', what='id, name, description, description2')[0] +$ categories = db.select('categories', what='id, category') + +<div id="container"> +<div class="intro"> +<img style="width:100px;" src="/static/img/thumb/logo.png"> +<br> +~*~<br> +<br> +<br> +<h1>$siteconfig.name</h1> +$:markdown.markdown(siteconfig.description) +$:markdown.markdown(siteconfig.description2) + +<div id="selectproducts"> +<b><a href="/shop#selectproducts">All</a> +$for c in categories: + | <a href="?category=$c.category#selectproducts">$c.category</a> +</b> +</div> +<br> +</div> +<div id="productlist"> +$for i in products: + $if category == i.category or category == None: + $if i.available > 0: + <div class="product" id="$i.id"> + ~*~<br> + <h2> + $i.name + </h2> + $i.category<br> + <br> + <br> + $ goodies = db.query("SELECT * FROM soundlink WHERE id='" +i.id+"';") + $for g in goodies: + $if g.soundname[-5:] == '.jpeg' or g.soundname[-4:] == '.png': + <a href="/bigpic/$g.id"><img class="imgprod" src="/static/img/thumb/$g.soundname"></a> + <br> + + <br> + $code: + sat, euro = getprice(i.id) + $:markdown.markdown(i.description) + product: $i.name + <br> + category: $i.category + <br> + <br> + $if i.available > 0: + Price $euro € <a href="/shop?putinbag=$i.id#$i.id">add to cart</a><br> + Available $i.available pcs + $else: + SOLD OUT! check back later. + </div> + <br> + <small>~-~</small> + <br> +</div> +<br> +<small>powered by <a href="https://dev.tarina.org/p/thiswebshoprules/">thiswebshoprules</a> and <a href="https://webpy.org">web.py </a></small> +<br> +<br> +<br> +<br> +<br> +<br> +<br> diff --git a/html/invites.html b/html/invites.html @@ -0,0 +1,22 @@ +$def with (tuningform, formfail, user, invites) +<div id="container"> + <div id="default"> + <h2>Sup $user! <br>Skicka nu inbjudan ti kaverin</h2> + + <form method="POST"> + $:tuningform.render() + </form> + <h2>$formfail</h2> + <br> + + <a href="/invites?render=yes">make new invite link</a> + <br> + $for i in invites: + $if i.accepted == '' or i.accepted == None: + <br><a href="/register?invite=$i.secretinvitation">$i.secretinvitation</a><br> created: $i.created.strftime('%d-%m-%y %H:%M') <br> + $else: + <br><a href="/register?invite=$i.secretinvitation">$i.secretinvitation</a><br> accepted $i.accepted.strftime('%d-%m-%y %H:%M') <br> + + <a href="/heartranked"><-- back</a> + </div> +</div> diff --git a/html/l33t.html b/html/l33t.html @@ -0,0 +1,14 @@ +$def with (addproduct) +<div id="container"> + <div id="default"> + <br> + <h2>Add Product</h2> + <div id="addevent"> + <form method="POST"> + $:addproduct.render() + </form> + </div> + <b><p></p></b> + </div> + </div> +</div> diff --git a/html/landing.html b/html/landing.html @@ -0,0 +1,16 @@ +$def with (nothing) +<div id="container"> +<h2>Gonzo Pi Web Shop opening soon!</h2> +<div id="logocontainer"> +<p>for preorders contact go@gonzopi.org +$#<img class="logo" src="/static/tarina-logo.png"> +<br> +<div id="logo2"> +</div> + +</div> +<br> +<small><a href="https://github.com/rbckman/gonzopi">Gonzopi code</a> <a href="https://github.com/rbckman/gonzopi_build">Gonzopi build</a> </small> +<br> +<br> +<br> diff --git a/html/login.html b/html/login.html @@ -0,0 +1,23 @@ +$def with (loginform, fejl, link) +<div id="container"> + <br> + <h3>LOGIN</h3> + <div id="addevent"> + <form method="POST"> + $:loginform.render() + </form> + <h4>$fejl</h4> + $if link == True: + <a href="/forgotpass">fuuu yeah na naa I forgot passcode</a> + </div> + <br> + <a href="javascript:history.back()"><-- back</a> + <br> + <br> + $#<h5><a href="/register">Don't have an account?</a></h5> + $#<br> + $#<h4><a href="/register">No need to worry!</a></h4> + $#<br> + $#<h6><a href="/register">Register to the Space Fleet, Now!</a></h6> + <br> +</div> diff --git a/html/ny.html b/html/ny.html @@ -0,0 +1,14 @@ +$def with (namn, url) +<div id="container"> +<div id="default"> +<br> +<h2>Välkommen $namn!</h2> +<p>Du är nu inlogga!.</p> +$if url != '': + <a href="$url">Fortsätt ---></a> +$else: + <a href="/bilder">Fortsätt ---></a> +<b><p></p></b> +</div> +</div> +</div> diff --git a/html/op.html b/html/op.html @@ -0,0 +1,13 @@ +$def with (content) +<!doctype html> +<HEAD> + <meta charset="utf-8"> + <title>Tarina web shop Welcome!</title> + <link rel="stylesheet" href="/static/robstyle.css?v=1.36" type="text/css" rel="stylesheet"/> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta http-equiv="cache-control" content="no-cache"> +</HEAD> +<BODY> + <a href="/upload">Upload</a> <a href="/feed">Feed</a> | <a href="/propaganda">Propaganda</a> | <a href="/config">Config</a> | <a href="/categories">Categories</a> | <a href="/products/">Products</a> | <a href="/shipping/">Shipping</a> | <a href="/orders?status=unpaid">Orders</a> | <a href="/logout">Logout</a> +$:content +</BODY> diff --git a/html/operator.html b/html/operator.html @@ -0,0 +1,4 @@ +<div id="container"> +<div id="default"> +</div> +</div> diff --git a/html/orders.html b/html/orders.html @@ -0,0 +1,83 @@ +$def with (payments,db,getinvoice,totsats,status,paid,unpaid,shipped,nonshipped,pickup,removed,thankyou,productname,getprice) +$ link = '' +<br> +<h2>Orders</h2> +<br> +<p>unpaid $unpaid</p> +<p>paid $paid</p> +<p>shipped $shipped</p> +<p>pickup $pickup</p> +<p>removed $removed</p> +<br> +<b>waiting to be shipped $nonshipped</b> +<br> +<a href="?status=unpaid">unpaid</a> | +<a href="?status=paid">paid</a> | +<a href="?status=shipped">shipped</a> | +<a href="?status=pickup">pickup</a> | +<a href="?status=removed">removed</a> | +<a href="?status=thankyou">thankyou</a> +<br> +<br> +$ id=0 +$ totsats=0 +$ toteuro=0 +$for i in payments: + $ id=id+1 + $ toteuro = 0 + $if i.status == status: + <div class="orders" id="$id"> + <pre> + $if i.status != 'unpaid' and i.status != 'thankyou': + $ bag = db.query("SELECT * FROM paidbags WHERE sessionkey='" + i.invoice_key +"';") + $else: + $ bag = db.query("SELECT * FROM customerbag WHERE sessionkey='"+i.invoice_key+"';") + $ pending = db.select('pending', where="invoice_key='"+i.invoice_key+"'")[0] + $ invoice = db.select('invoices', where="invoice_key='"+i.invoice_key+"'")[0] + $if i.payment == 'Bitcoin': + $ link = "/paybtc/" + i.invoice_key + $elif i.payment == 'Bitcoin Lightning': + $ link = "/payln/" + i.invoice_key + $elif i.payment == 'Mobile Pay': + <b>order status: $i.status</b> + <a href=$link>$i.invoice_key</a> + $i.payment + in your order:<br> + $ total = 0 + $for b in bag: + $ goodies = db.query("SELECT * FROM soundlink WHERE id='"+b.product+"';") + $code: + price = getprice(b.product) + quantity = b.quantity + p_totsats=b.quantity*price[0] + p_toteuro=b.quantity*price[1] + $b.quantity x $productname(b.product) + <a href="/dropitem/$b.product">X</a> $p_toteuro€<br> + $for g in goodies: + $if g.soundname[-5:] == '.jpeg' or g.soundname[-4:] == '.png': + <img src="/static/img/thumb/$g.soundname" style="width:120px"><br> + $code: + totsats += p_totsats + toteuro += p_toteuro + $if pending.country != None: + $ shippinginfo = db.select('shipping', where="country='" + pending.country + "'", what='price, days')[0] + Shipping cost to $pending.country is $(shippinginfo.price/100)€ <br> + Shipping estimate is $shippinginfo.days days<br> + $code: + toteuro += shippinginfo.price/100 + $if totsats > 0: + total: $toteuro € + + order $i.timestamp + $pending.email + $pending.firstname $pending.lastname + $if pending.country != 'NO-SHIPPING': + $pending.address + $pending.postalcode + $pending.town + $pending.country + </pre> + <a href='/orders?status=thankyou&key=$i.invoice_key'>thank you</a> | <a href='/orders?status=shipped&key=$i.invoice_key'>shipped</a> | <a href='/orders?status=paid&key=$i.invoice_key'>paid</a> | <a href='/orders?status=pickup&key=$i.invoice_key'>pickup</a> |<a href='/orders?status=paynotice&key=$i.invoice_key'>payment notice</a> | <a href='/orders?status=removed&key=$i.invoice_key'>remove</a> + </div> + <br> + diff --git a/html/orders2.html b/html/orders2.html @@ -0,0 +1,75 @@ +$def with (payments,db,getinvoice,totsats,status,paid,unpaid,shipped,nonshipped,pickup,removed,productname,getprice) +$ link = '' +<h2>Orders</h2> +<h4>total $totsats</h4> +<p>paid $paid</p> +<p>shipped $shipped</p> +<p>pickup $pickup</p> +<p>unpaid $unpaid</p> +<p>removed $removed</p> +<h3>waiting to be shipped $nonshipped</h3> +<a href="?status=unpaid">unpaid</a> +<a href="?status=paid">paid</a> +<a href="?status=shipped">shipped</a> +<a href="?status=pickup">pickup</a> +<a href="?status=removed">removed</a> +<a href="?status=thankyou">thankyou</a> +$ id=0 +$ totsats=0 +$ toteuro=0 +$for i in payments: + $ id=id+1 + $if i.status == status: + <div class="orders" id="$id"> + <pre> + $ bag = db.query("SELECT * FROM paidbags WHERE sessionkey='" + i.invoice_key +"';") + $ pending = db.select('pending', where="invoice_key='"+i.invoice_key+"'")[0] + $ invoice = db.select('invoices', where="invoice_key='"+i.invoice_key+"'")[0] + $ ln = getinvoice(i.ln) + $if i.payment == 'Bitcoin': + $ link = "/paybtc/" + i.invoice_key + $if i.payment == 'Bitcoin Lightning': + $ link = "/payln/" + i.invoice_key + <b>order status: $i.status</b> + <b>ln status: $ln['status']</b> + <a href=$link>$i.invoice_key</a> + $ln['msatoshi'] mSatoshis + $if ln['status'] == 'paid': + $ totsats=totsats+ln['msatoshi'] + $i.payment + $i.ln + in your order:<br> + $ total = 0 + $for b in bag: + $ goodies = db.query("SELECT * FROM soundlink WHERE id='"+b.product+"';") + $code: + price = getprice(b.product) + quantity = b.quantity + p_totsats=b.quantity*price[0] + p_toteuro=b.quantity*price[1] + $b.quantity x $productname(b.product) + <a href="/dropitem/$b.product">X</a> $p_totsats $p_toteuro€<br> + $for g in goodies: + $if g.soundname[-5:] == '.jpeg' or g.soundname[-4:] == '.png': + <img src="/static/img/thumb/$g.soundname" style="width:120px"><br> + $code: + totsats += p_totsats + toteuro += p_toteuro + $if totsats > 0: + <br> + total: $totsats Satoshi or $toteuro € + + Satoshis: $i.totsats + order $i.timestamp + $pending.email + $pending.firstname $pending.lastname + $if pending.country != 'NO-SHIPPING': + $pending.address + $pending.postalcode + $pending.town + $pending.country + </pre> + <a href='/orders?status=thankyou&key=$i.invoice_key'>thank you</a> | <a href='/orders?status=shipped&key=$i.invoice_key'>shipped</a> | <a href='/orders?status=paid&key=$i.invoice_key'>paid</a> | <a href='/orders?status=pickup&key=$i.invoice_key'>pickup</a> |<a href='/orders?status=paynotice&key=$i.invoice_key'>payment notice</a> | <a href='/orders?status=removed&key=$i.invoice_key'>remove</a> + </div> + <br> + diff --git a/html/ordersbtcold.html b/html/ordersbtcold.html @@ -0,0 +1,75 @@ +$def with (payments,db,getinvoice,totsats,status,paid,unpaid,shipped,nonshipped,pickup,removed,productname,getprice) +$ link = '' +<h2>Orders</h2> +<h4>total $totsats</h4> +<p>paid $paid</p> +<p>shipped $shipped</p> +<p>pickup $pickup</p> +<p>unpaid $unpaid</p> +<p>removed $removed</p> +<h3>waiting to be shipped $nonshipped</h3> +<a href="?status=unpaid">unpaid</a> +<a href="?status=paid">paid</a> +<a href="?status=shipped">shipped</a> +<a href="?status=pickup">pickup</a> +<a href="?status=removed">removed</a> +<a href="?status=thankyou">thankyou</a> +$ id=0 +$ totsats=0 +$ toteuro=0 +$for i in payments: + $ id=id+1 + $if i.status == status: + <div class="orders" id="$id"> + <pre> + $ bag = db.query("SELECT * FROM paidbags WHERE sessionkey='" + i.invoice_key +"';") + $ pending = db.select('pending', where="invoice_key='"+i.invoice_key+"'")[0] + $ invoice = db.select('invoices', where="invoice_key='"+i.invoice_key+"'")[0] + $ ln = getinvoice(i.ln) + $if i.payment == 'Bitcoin': + $ link = "/paybtc/" + i.invoice_key + $if i.payment == 'Bitcoin Lightning': + $ link = "/payln/" + i.invoice_key + <b>order status: $i.status</b> + <b>ln status: $ln['status']</b> + <a href=$link>$i.invoice_key</a> + $if ln['status'] == 'paid': + $ln['amount_msat'] mSatoshis + $ totsats=totsats+ln['amount_msat'] + $i.payment + $i.ln + in your order:<br> + $ total = 0 + $for b in bag: + $ goodies = db.query("SELECT * FROM soundlink WHERE id='"+b.product+"';") + $code: + price = getprice(b.product) + quantity = b.quantity + p_totsats=b.quantity*price[0] + p_toteuro=b.quantity*price[1] + $b.quantity x $productname(b.product) + <a href="/dropitem/$b.product">X</a> $p_totsats $p_toteuro€<br> + $for g in goodies: + $if g.soundname[-5:] == '.jpeg' or g.soundname[-4:] == '.png': + <img src="/static/img/thumb/$g.soundname" style="width:120px"><br> + $code: + totsats += p_totsats + toteuro += p_toteuro + $if totsats > 0: + <br> + total: $totsats Satoshi or $toteuro € + + Satoshis: $i.totsats + order $i.timestamp + $pending.email + $pending.firstname $pending.lastname + $if pending.country != 'NO-SHIPPING': + $pending.address + $pending.postalcode + $pending.town + $pending.country + </pre> + <a href='/orders?status=thankyou&key=$i.invoice_key'>thank you</a> | <a href='/orders?status=shipped&key=$i.invoice_key'>shipped</a> | <a href='/orders?status=paid&key=$i.invoice_key'>paid</a> | <a href='/orders?status=pickup&key=$i.invoice_key'>pickup</a> |<a href='/orders?status=paynotice&key=$i.invoice_key'>payment notice</a> | <a href='/orders?status=removed&key=$i.invoice_key'>remove</a> + </div> + <br> + diff --git a/html/pay.html b/html/pay.html @@ -0,0 +1,27 @@ +$def with (invoice) +$ qr = '/static/qr/' + invoice['id'] + '.png' +<script> +function copy() { + let textarea = document.getElementById("payreq"); + textarea.select(); + document.execCommand("copy"); +} +</script> +<meta http-equiv="refresh" content="5" /> +<br> +<h2>$invoice['description']<br>$invoice['msatoshi'] msat, $invoice['quoted_amount'] $invoice['quoted_currency']</h2> +<br> +<img src="$qr"> +<div id='hash'> +<h4>id:</h4> +<textarea id='payid'> +$invoice['id'] +</textarea> +<h4>pay req:</h4> +<textarea id='payreq'> +$invoice['payreq'] +</textarea> +<br> +<button id="copybutton" onclick="copy()">Copy</button> +<button id="backbutton" autofocus onclick="parent.location='/'">Back</button> +</div> diff --git a/html/paybtc.html b/html/paybtc.html @@ -0,0 +1,101 @@ +$def with (invoice, btcaddress, btcuri, showpayment, bag, productname, db, getprice, getrate, ordertype, pendinginfo, eur_to_sat) +$ qr = '/static/qr/' + btcaddress + '.png' +<script> +function copy() { + let textarea = document.getElementById("payreq"); + textarea.select(); + document.execCommand("copy"); +} +</script> +<meta http-equiv="refresh" content="60" /> + +<div id="container"> +<br> +<a href="/checkout">Go back!</a> + +<br> +in your order:<br> +$ totsats=0 +$ toteuro=0 +$for i in bag: + $ goodies = db.query("SELECT * FROM soundlink WHERE id='" +i.product+"';") + $code: + price = getprice(i.product) + quantity = i.quantity + p_totsats=i.quantity*price[0] + p_toteuro=i.quantity*price[1] + $i.quantity x $productname(i.product) + $p_totsats $p_toteuro€<br> + $for g in goodies: + $if g.soundname[-5:] == '.jpeg' or g.soundname[-4:] == '.png': + <img src="/static/img/thumb/$g.soundname" style="width:120px"> + <br> + $code: + totsats += p_totsats + toteuro += p_toteuro +$if totsats > 0: + <br> + +$if ordertype() == 'digital': + <h2>Digital goods will be shipped to your email once invoice paid..</h2> +$else: + $ shippinginfo = db.select('shipping', where="country='" + pendinginfo.country + "'", what='price, days')[0] + Shipping cost to $pendinginfo.country is <br>$eur_to_sat(shippinginfo.price) Satoshi or ~ $(shippinginfo.price/100)€ <br> + Shipping estimate is $shippinginfo.days days<br> + $code: + totsats += eur_to_sat(shippinginfo.price) + toteuro += shippinginfo.price/100 + <pre> + First Name: $pendinginfo.firstname + Last Name: $pendinginfo.lastname + Country: $pendinginfo.country + Address: $pendinginfo.address + Town: $pendinginfo.town + Postalcode: $pendinginfo.postalcode + Email: $pendinginfo.email + </pre> + +<br> +$if totsats > 0: + total: $totsats Satoshi ~ $(toteuro)€ + with rate: $getrate()€/₿ + +<br> +Order is only reserved once paid. +<br> +<br> + +$if showpayment == []: + <h5>Status: not paid</h5> +$else: + $for i in showpayment: + <h2>Status:</h2> + <h2>txid: $i['txids']</h2> + <h2>confirmations: $i['confirmations']</h2> +<br> +<img style="width:220px" src="$qr"> +<div id='hash'> +<h2>bitcoin address:</h2> +<textarea id='payid'> +$btcaddress +</textarea> +<h2>pay uri:</h2> +<textarea id='payreq'> +$btcuri +</textarea> +<br> +<button id="copybutton" onclick="copy()">Copy</button> +<button id="backbutton" autofocus onclick="parent.location='/payln/$invoice.invoice_key'">Pay with Lightning</button> +</div> + +<br> +<br> + +<a href="/checkout">Go back!</a> + +<br> +</div> +<br> +<br> +<br> +<br> diff --git a/html/payln.html b/html/payln.html @@ -0,0 +1,106 @@ +$def with (lninvoice,invoice,bag,productname,digitalkey,db,getprice,getrate,ordertype,pendinginfo,eur_to_sat) +$ qr = '/static/qr/' + invoice['invoice_key'] + '.png' +<script> +function copy() { + let textarea = document.getElementById("payreq"); + textarea.select(); + document.execCommand("copy"); +} +</script> + +<div id="container"> +<br> +<br> +$if lninvoice['status'] != 'paid': + <meta http-equiv="refresh" content="30" /> + <a href="/checkout">Go back!</a> + <br> + <h2>Pay with Bitcoin Lightning</h2> +$else: + <h3>Payment recieved!</h3> + $if digitalkey: + <p>link to your digital goodies is in your mail!</p><br> + <img src="/static/jamesfrancothanks.gif" style="width:300px"><br> + <a href="/">Back to beginning</a> + <br> +in your order:<br> +$ totsats=0 +$ toteuro=0 +$for i in bag: + $ goodies = db.query("SELECT * FROM soundlink WHERE id='" +i.product+"';") + $code: + price = getprice(i.product) + quantity = i.quantity + p_totsats=i.quantity*price[0] + p_toteuro=i.quantity*price[1] + $i.quantity x $productname(i.product) + $p_totsats $p_toteuro€<br> + $for g in goodies: + $if g.soundname[-5:] == '.jpeg' or g.soundname[-4:] == '.png': + <img src="/static/img/thumb/$g.soundname" style="width:120px"> + <br> + $code: + totsats += p_totsats + toteuro += p_toteuro + +$if ordertype() == 'digital': + <h2>Digital goods will be shipped to your email once invoice paid..</h2> +$else: + $ shippinginfo = db.select('shipping', where="country='" + pendinginfo.country + "'", what='price, days')[0] + Shipping cost to $pendinginfo.country is <br>$eur_to_sat(shippinginfo.price) Satoshi or ~ $(shippinginfo.price/100)€ <br> + Shipping estimate is $shippinginfo.days days<br> + $code: + totsats += eur_to_sat(shippinginfo.price) + toteuro += shippinginfo.price/100 + <pre> + First Name: $pendinginfo.firstname + Last Name: $pendinginfo.lastname + Country: $pendinginfo.country + Address: $pendinginfo.address + Town: $pendinginfo.town + Postalcode: $pendinginfo.postalcode + Email: $pendinginfo.email + </pre> + +<br> +$if totsats > 0: + total: $totsats Satoshi $(toteuro)€ + with rate: $getrate()€/₿ + +<br> +Order is only reserved once paid. +<br> +<br> + +$if totsats > 0: + <br> + total: $totsats Satoshi or $toteuro €<br> + with rate: $getrate()€/₿ + <h2>status: $lninvoice['status']</h2> +<br> +<a href="lightning:$lninvoice['bolt11']"><img src="$qr"></a> +<div id='hash'> +<h2>id:</h2> +<textarea id='payid'> +$lninvoice['label'] +</textarea> +<h2>bolt11:</h2> +<textarea id='payreq'> +$lninvoice['bolt11'] +</textarea> +<br> +<button id="copybutton" onclick="copy()">Copy</button> +<button id="backbutton" autofocus onclick="parent.location='/paybtc/$invoice.invoice_key'">Pay with Bitcoin on-chain</button> +</div> + +<br> +<br> + +<a href="/checkout">Go back!</a> + +<br> +</div> +<br> +<br> +<br> +<br> diff --git a/html/payment.html b/html/payment.html @@ -0,0 +1,27 @@ +$def with (invoice) +$ qr = '/static/qr/' + invoice['id'] + '.png' +<script> +function copy() { + let textarea = document.getElementById("payreq"); + textarea.select(); + document.execCommand("copy"); +} +</script> +<meta http-equiv="refresh" content="60" /> +<br> +<h2>$invoice['description']<br>$invoice['msatoshi'] msat, $invoice['quoted_amount'] $invoice['quoted_currency']</h2> +<br> +<img src="$qr"> +<div id='hash'> +<h4>id:</h4> +<textarea id='payid'> +$invoice['id'] +</textarea> +<h4>pay req:</h4> +<textarea id='payreq'> +$invoice['payreq'] +</textarea> +<br> +<button id="copybutton" onclick="copy()">Copy</button> +<button id="backbutton" autofocus onclick="parent.location='/'">Back</button> +</div> diff --git a/html/payments.html b/html/payments.html @@ -0,0 +1,33 @@ +$def with (payments) +$var payments = payments +$ link = '' +</div> +<h2>payments</h2> +<table> +$for i in payments: + $if i.payment == 'Bitcoin': + $ link = "/paybtc/" + i.invoice_key + $if i.payment == 'Bitcoin Lightning': + $ link = "/payln/" + i.invoice_key + <pre> + <b>status: $i.status</b> + <a href=$link>$i.invoice_key</a> + $i.payment + $i.btc + $i.ln + $i.products | $float(i.amount/100) € | Satoshis: $i.totsats + order $i.timestamp + $if i.datepaid: + paid $i.datepaid + $else: + not paid! + $i.email + $i.firstname $i.lastname + $i.address + $i.postalcode + $i.town + $i.country + <a href='/payments?status=thankyou&key=$i.invoice_key'>thank you</a> | <a href='/payments?status=shipped&key=$i.invoice_key'>shipped</a> | <a href='/payments?status=paynotice&key=$i.invoice_key'>payment notice</a> | <a href='/payments?status=remove&key=$i.invoice_key'>remove</a> + </pre> +</table> + diff --git a/html/paymobile.html b/html/paymobile.html @@ -0,0 +1,88 @@ +$def with (lninvoice,invoice,bag,productname,digitalkey,db,getprice,getrate,ordertype,pendinginfo,eur_to_sat) +$ qr = '/static/qr/' + invoice['invoice_key'] + '.png' +<script> +function copy() { + let textarea = document.getElementById("payreq"); + textarea.select(); + document.execCommand("copy"); +} +</script> + +<div id="container"> +<br> +~*~<br> +<br> +<h2>Waiting for payment</h2> +<br> +~*~<br> +$if invoice.status != 'paid': + <meta http-equiv="refresh" content="30" /> + <br> +$else: + <h3>Payment recieved!</h3> + $if digitalkey: + <p>link to your digital goodies is in your mail!</p><br> + <img src="/static/jamesfrancothanks.gif" style="width:300px"><br> + <a href="/">Back to beginning</a> + <br> +$ totsats=0 +$ toteuro=0 +$for i in bag: + $ goodies = db.query("SELECT * FROM soundlink WHERE id='" +i.product+"';") + $code: + price = getprice(i.product) + quantity = i.quantity + p_totsats=i.quantity*price[0] + p_toteuro=i.quantity*price[1] + $code: + toteuro += p_toteuro + +$if ordertype() == 'digital': + ~*~ +$else: + $ shippinginfo = db.select('shipping', where="country='" + pendinginfo.country + "'", what='price, days')[0] + $code: + totsats += eur_to_sat(shippinginfo.price) + toteuro += shippinginfo.price/100 + +$if invoice.status == 'unpaid': + <br> + Send a payment of total: $(toteuro)€ + <br> + <br> + to Robin Johannes Bäckman + <br> + with mobilepay app number: 0469507618 + <br> + or send payment here <a href="https://buymeacoffee.com/rbckman">buymecoffee</a> + <br> + <br> + ~<br> + <br> + it was a pleasure doing business with you and please give me feedback on me@robinbackman.com + <br> + <br> + ~<br> + <br> + status: unpaid + <br> + <br> + ~*~<br> + <br> + Order is only reserved once paid. + <br> +$else: + <br> + order status: $invoice.status + <br> + ~*~<br> +<br> + +<a href="/checkout"><--- back shopping for moar yes plz</a> + +<br> +</div> +<br> +<br> +<br> +<br> diff --git a/html/pending.html b/html/pending.html @@ -0,0 +1,64 @@ +$def with (pending_key,pendingform,pendinginfo,bag,productname,db,getprice,eur_to_sat,ordertype) +$ totsats = 0 +$ toteuro = 0 +<div id="container"> +<div id="default"> +<br> +~*~<br> +<h2>Your Order</h2> + +in your order:<br> +$for i in bag: + $ goodies = db.query("SELECT * FROM soundlink WHERE id='" +i.product+"';") + $code: + price = getprice(i.product) + quantity = i.quantity + p_totsats=i.quantity*price[0] + p_toteuro=i.quantity*price[1] + $i.quantity x $productname(i.product) + <a href="/dropitem/$i.product">X</a> $p_toteuro€<br> + $for g in goodies: + $if g.soundname[-5:] == '.jpeg' or g.soundname[-4:] == '.png': + <br> + <img src="/static/img/thumb/$g.soundname" style="width:120px"><br> + $code: + totsats += p_totsats + toteuro += p_toteuro + +<br> +<br> +$if ordertype() == 'digital': + <h2>Digital goods if any will be shipped to your email once invoice paid..</h2> +$else: + $ shippinginfo = db.select('shipping', where="country='" + pendinginfo.country + "'", what='price, days')[0] + Shipping cost to $pendinginfo.country is $(shippinginfo.price/100)€ <br> + Shipping estimate is $shippinginfo.days days<br> + $code: + totsats += eur_to_sat(shippinginfo.price) + toteuro += shippinginfo.price/100 + <pre> + First Name: $pendinginfo.firstname + Last Name: $pendinginfo.lastname + Country: $pendinginfo.country + Address: $pendinginfo.address + Town: $pendinginfo.town + Postalcode: $pendinginfo.postalcode + Email: $pendinginfo.email + </pre> + +<br> +<p> +$if totsats > 0: + total: $(toteuro)€ +<p> +~*~<br> +<div id="addevent"> +<form method="POST"> +$:pendingform.render() +</form> +</div> +<b><p></p></b> +<a href="/checkout"><- back shopping for moar? yes plz</a> +</div> +</div> +</div> diff --git a/html/products.html b/html/products.html @@ -0,0 +1,41 @@ +$def with (addproduct, listproducts, goodies, idvalue, nocache) +<div id="container"> +<div id="default"> +<br> +$for i in listproducts: + <div class="editproduct" id="$i.id"><a href='/products/$i.id'>$i.name[:15]</a></div> +<br> +$if idvalue == '': + <h2>Add product</h2> +$else: + <h2>Edit product</h2> +<div id="addevent"> +<form method="POST"> +$:addproduct.render() +</form> +<a href='/products/$idvalue?cmd=del&id=$idvalue'>remove product</a> +<br> +<hr> +$if goodies != None: + $for i in goodies: + $if i.soundname[-5:] == '.jpeg' or i.soundname[-4:] == '.png': + <img src="/static/img/thumb/$i.soundname?nocache=$nocache"> + $else: + <p>$i.soundname</p> + <br> + <a href='/products/$idvalue?cmd=flipleft&soundname=$i.soundname'>flip to left</a> | + <a href='/products/$idvalue?cmd=remove&soundname=$i.soundname'>remove</a> | + <a href='/products/$idvalue?cmd=flipright&soundname=$i.soundname'>flip to right</a> + <br> + <hr> +$if idvalue != '': + <form method="POST" enctype="multipart/form-data" action=""> + <input type="file" name="imgfile"/> <br> + <br/> + <input name="upload", type="submit" value="upload" /> + </form> +</div> + +</div> +</div> +</div> diff --git a/html/propaganda.html b/html/propaganda.html @@ -0,0 +1,47 @@ +$def with (configform, picform, goodies, nocache, story) +<br> +~*~ +<br> +$for i in goodies: + <a href="/propaganda?soundname=$i.soundlink">$i.soundlink</a> | $i.name + <br> +~*~ +<div id="container"> +<div id="default"> +<br> + +<form method="POST"> +$if story == None: + $:configform.render() +</form> +<br> +<b>upload images</b> +<br> +<form method="POST" enctype="multipart/form-data" action=""> +<input type="file" name="imgfile"/> <br> +<br/> +<input name="upload", type="submit" value="upload" /> +</form> +<br/> +$if story != None: + $for i in story: + $if i.soundname[-5:] == '.jpeg' or i.soundname[-4:] == '.png': + <img src="/static/img/thumb/$i.soundname?nocache=$nocache"> + $else: + <p>$i.soundname</p> + <br> + <a href='/propaganda?cmd=flipleft&soundname=$i.soundname'>flip to left</a> | + <a href='/propaganda?cmd=remove&soundname=$i.soundname'>remove</a> | + <a href='/propaganda?cmd=flipright&soundname=$i.soundname'>flip to right</a> + <br> + $picform.fill(name=i.name, description=i.description, description2=i.description2, id=i.soundlink) + <form method="POST"> + $:picform.render() + </form> + <hr> + +</div> + +</div> +</div> +</div> diff --git a/html/register.html b/html/register.html @@ -0,0 +1,24 @@ +$def with (loginform, formfail, totusers) +<div id="container"> + <div id="default"> + <br> + $if totusers > 1: + <h5>the social network</h5> + <h1>heart base</h1> + <h5>welcome</h5> + <p>❤️</p> + $else: + <h2>Registrera superadmin</h2> + <div id="addevent"> + <form method="POST"> + <small> + $:loginform.render() + <h2>$formfail</h2> + </form> + </small> + </div> + <br> + <a href="/heartranked"><-- back</a> + </div> + </div> +</div> diff --git a/html/shipping.html b/html/shipping.html @@ -0,0 +1,16 @@ +$def with (addcountry, listcountries) +<div id="container"> +<div id="default"> +<br> +<h2>Add shipping country</h2> +<div id="addevent"> +<form method="POST"> +$:addcountry.render() +</form> +</div> +$for i in listcountries: + <a href='/shipping/$i.id'>$i.country $i.price $i.days</a> +<b><p></p></b> +</div> +</div> +</div> diff --git a/html/showuploads.html b/html/showuploads.html @@ -0,0 +1,42 @@ +$def with (uploads, user, allowed, random) +<div id="container"> +<a href="javascript:history.back()"><-- back</a> +<br> + +$for i in uploads[:100]: + <code><a href="/static/users/$user/images/$i">/static/users/$user/images/web/$i</a></code> + <br> + $ nocache=random.choices(allowed, k=5) + <img src="/static/users/$user/images/web/$i?random=$nocache"><br> + <a style="color: white;" class="insert-link" onclick="rotateright('$i')">↻</a> + <a style="color: white;" class="insert-link" onclick="rotateleft('$i')">↺</a> + <code></code> +</div> + +<script> +async function rotateright(text) { + try { + const res = await fetch('/imageapi', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ image: text , action: 'rotateright'}) + }); + } catch (e) { + console.error(e); + status.innerHTML = '<span style="color:red">❌ Failed to send</span>'; + } +} + +async function rotateleft(text) { + try { + const res = await fetch('/imageapi', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ image: text , action: 'rotateleft'}) + }); + } catch (e) { + console.error(e); + status.innerHTML = '<span style="color:red">❌ Failed to send</span>'; + } +} +</script> diff --git a/html/splash.html b/html/splash.html @@ -0,0 +1,5 @@ +$def with (content) + +<!doctype html> +$:content + diff --git a/html/stats.html b/html/stats.html @@ -0,0 +1,64 @@ +$def with (visitors, total, unique, logfilter) +$var visitors = visitors +$var total = total +$var unique = unique +$ show = False +$ count = 0 +<link rel="stylesheet" href="/static/splash.css?v=115" type="text/css" rel="stylesheet"/> +<meta name="viewport" content="width=device-width, initial-scale=1"> +<meta http-equiv="cache-control" content="no-cache"> +<html> +<head> +<title>THE STATS</title> + + +<a href="/dude">go back</a> | +<a href="?">no filter</a> | +<a href="?logfilter=bots">filter bots</a> | +<a href="?logfilter=botsandme">filter bots and me</a> +<br> +total visits: $total <br> +unique visits: $unique <br> +<br> +$ ip_filters = ['85.76.43.33', '85.76.65.220', '85.76.65.227','84.253.216.59', '83.245.233.58', '85.76.142.151'] +$ filters = ['SemrushBot', 'Windows NT', 'Applebot', 'Amazonbot', 'bingbot', 'ClaudeBot', 'MJ12bot', 'AhrefsBot', 'YisouSpider' 'spider','Twitterbot','Scanning-activity', 'web index', 'spider', 'Bot', 'Spider', 'Crawler', 'Odin', 'crawler', 'Go-http-client', 'robot'] +<div id="visitors"> +$for i in visitors: + $if logfilter == 'bots': + $for f in filters: + $if f in i.environ: + $ show = False + $ break + $else: + $ show = True + $if show == True: + <img src="/static/flags/${i.countrycode}.png"> | $i.country | $i.ip | $i.referer | $i.environ | $i.time <br> + $ count = count + 1 + $ show = False + $elif logfilter == 'botsandme': + $for f in filters: + $if f in i.environ: + $ show = False + $ break + $else: + $ show = True + $for ip in ip_filters: + $if ip in i.ip: + $ show = False + $ break + $else: + $ show = True + $if show == True: + <img src="/static/flags/${i.countrycode}.png"> | $i.country | $i.ip | $i.referer | $i.environ | $i.time <br> + $ count = count + 1 + $ show = False + $else: + <img src="/static/flags/${i.countrycode}.png"> | $i.country | $i.ip | $i.referer | $i.environ | $i.time <br> + $ count = count + 1 + +<br> +total potential real visitors: +$count +</div> +</head> +</html> diff --git a/html/thankyou.html b/html/thankyou.html @@ -0,0 +1,36 @@ +$def with (lninvoice, invoice, bag, productname, float) +$ qr = '/static/qr/' + lninvoice['label'] + '.png' +<script> +function copy() { + let textarea = document.getElementById("payreq"); + textarea.select(); + document.execCommand("copy"); +} +</script> +<meta http-equiv="refresh" content="60" /> +<h2>Thank you for you payment!</h2> +in your order (click to remove):<br> +$for i in bag: + $code: + price = i.quantity * float(i.price/100) + <a href="/dropitem/$i.product">$i.quantity x $productname(i.product)</a> $price€ <br> + <img src="/static/img/$i.product/thumb/000.jpeg" style="width:120px"><br> + +<h3>$float(invoice.amount/100)€</h3> +<h3>$invoice.totsats Satoshi</h3> +<h3>$lninvoice['status']</h3> +<br> +<img src="$qr"> +<div id='hash'> +<h4>id:</h4> +<textarea id='payid'> +$lninvoice['label'] +</textarea> +<h4>bolt11:</h4> +<textarea id='payreq'> +$lninvoice['bolt11'] +</textarea> +<br> +<button id="copybutton" onclick="copy()">Copy</button> +<button id="backbutton" autofocus onclick="parent.location='/paybtc/$invoice.invoice_key'">Pay with Bitcoin on-chain</button> +</div> diff --git a/html/tuning.html b/html/tuning.html @@ -0,0 +1,14 @@ +$def with (tuningform, formfail, user) +<div id="container"> + <div id="default"> + <img src="static/users/$user/images/thumb/image_of_sarfar_rockin_.png"> + <h3><a href="/upload/image_of_sarfar_rockin_">upload your image here</a></h3><br> + <h2>Tuuna ditt konto $user!</h2> + <form method="POST"> + $:tuningform.render() + </form> + <h2>$formfail</h2> + + <a href="/heartranked"><-- back</a> + </div> +</div> diff --git a/html/uploads.html b/html/uploads.html @@ -0,0 +1,16 @@ +$def with (uploaded) +<div id="container"> +<div id="default"> +<br> +<p>uploaded</p> +<b>uploaded</b> +<b>uploaded</b> +<b>uploaded</b> +<br> +$for i in uploaded: + $i[0]/$i[1] + $if i[1][-4:] == 'jpeg': + <img src="/static/img/thumb/$i[1]"><br> + <a href="/static/upload/$i[0]/$i[1]">link</a><br> +</div> +</div> diff --git a/html/user.html b/html/user.html @@ -0,0 +1,12 @@ +$def with (songs,credits,user,datetime,str,int) +<a href="javascript:history.back()"><-- back</a> +<br> + +$for i in songs: + <a href="/s/$user/$i.soundlink">$i.soundname</a> + <br> + +$for i in credits: + <a href="$i">$i</a><br> + +</div> diff --git a/public_html/flags/ad.png b/public_html/flags/ad.png Binary files differ. diff --git a/public_html/flags/ae.png b/public_html/flags/ae.png Binary files differ. diff --git a/public_html/flags/af.png b/public_html/flags/af.png Binary files differ. diff --git a/public_html/flags/ag.png b/public_html/flags/ag.png Binary files differ. diff --git a/public_html/flags/ai.png b/public_html/flags/ai.png Binary files differ. diff --git a/public_html/flags/al.png b/public_html/flags/al.png Binary files differ. diff --git a/public_html/flags/am.png b/public_html/flags/am.png Binary files differ. diff --git a/public_html/flags/ao.png b/public_html/flags/ao.png Binary files differ. diff --git a/public_html/flags/aq.png b/public_html/flags/aq.png Binary files differ. diff --git a/public_html/flags/ar.png b/public_html/flags/ar.png Binary files differ. diff --git a/public_html/flags/as.png b/public_html/flags/as.png Binary files differ. diff --git a/public_html/flags/at.png b/public_html/flags/at.png Binary files differ. diff --git a/public_html/flags/au.png b/public_html/flags/au.png Binary files differ. diff --git a/public_html/flags/aw.png b/public_html/flags/aw.png Binary files differ. diff --git a/public_html/flags/ax.png b/public_html/flags/ax.png Binary files differ. diff --git a/public_html/flags/az.png b/public_html/flags/az.png Binary files differ. diff --git a/public_html/flags/ba.png b/public_html/flags/ba.png Binary files differ. diff --git a/public_html/flags/bb.png b/public_html/flags/bb.png Binary files differ. diff --git a/public_html/flags/bd.png b/public_html/flags/bd.png Binary files differ. diff --git a/public_html/flags/be.png b/public_html/flags/be.png Binary files differ. diff --git a/public_html/flags/bf.png b/public_html/flags/bf.png Binary files differ. diff --git a/public_html/flags/bg.png b/public_html/flags/bg.png Binary files differ. diff --git a/public_html/flags/bh.png b/public_html/flags/bh.png Binary files differ. diff --git a/public_html/flags/bi.png b/public_html/flags/bi.png Binary files differ. diff --git a/public_html/flags/bj.png b/public_html/flags/bj.png Binary files differ. diff --git a/public_html/flags/bl.png b/public_html/flags/bl.png Binary files differ. diff --git a/public_html/flags/bm.png b/public_html/flags/bm.png Binary files differ. diff --git a/public_html/flags/bn.png b/public_html/flags/bn.png Binary files differ. diff --git a/public_html/flags/bo.png b/public_html/flags/bo.png Binary files differ. diff --git a/public_html/flags/bq.png b/public_html/flags/bq.png Binary files differ. diff --git a/public_html/flags/br.png b/public_html/flags/br.png Binary files differ. diff --git a/public_html/flags/bs.png b/public_html/flags/bs.png Binary files differ. diff --git a/public_html/flags/bt.png b/public_html/flags/bt.png Binary files differ. diff --git a/public_html/flags/bv.png b/public_html/flags/bv.png Binary files differ. diff --git a/public_html/flags/bw.png b/public_html/flags/bw.png Binary files differ. diff --git a/public_html/flags/by.png b/public_html/flags/by.png Binary files differ. diff --git a/public_html/flags/bz.png b/public_html/flags/bz.png Binary files differ. diff --git a/public_html/flags/ca.png b/public_html/flags/ca.png Binary files differ. diff --git a/public_html/flags/cc.png b/public_html/flags/cc.png Binary files differ. diff --git a/public_html/flags/cd.png b/public_html/flags/cd.png Binary files differ. diff --git a/public_html/flags/cf.png b/public_html/flags/cf.png Binary files differ. diff --git a/public_html/flags/cg.png b/public_html/flags/cg.png Binary files differ. diff --git a/public_html/flags/ch.png b/public_html/flags/ch.png Binary files differ. diff --git a/public_html/flags/ci.png b/public_html/flags/ci.png Binary files differ. diff --git a/public_html/flags/ck.png b/public_html/flags/ck.png Binary files differ. diff --git a/public_html/flags/cl.png b/public_html/flags/cl.png Binary files differ. diff --git a/public_html/flags/cm.png b/public_html/flags/cm.png Binary files differ. diff --git a/public_html/flags/cn.png b/public_html/flags/cn.png Binary files differ. diff --git a/public_html/flags/co.png b/public_html/flags/co.png Binary files differ. diff --git a/public_html/flags/cr.png b/public_html/flags/cr.png Binary files differ. diff --git a/public_html/flags/cu.png b/public_html/flags/cu.png Binary files differ. diff --git a/public_html/flags/cv.png b/public_html/flags/cv.png Binary files differ. diff --git a/public_html/flags/cw.png b/public_html/flags/cw.png Binary files differ. diff --git a/public_html/flags/cx.png b/public_html/flags/cx.png Binary files differ. diff --git a/public_html/flags/cy.png b/public_html/flags/cy.png Binary files differ. diff --git a/public_html/flags/cz.png b/public_html/flags/cz.png Binary files differ. diff --git a/public_html/flags/de.png b/public_html/flags/de.png Binary files differ. diff --git a/public_html/flags/dj.png b/public_html/flags/dj.png Binary files differ. diff --git a/public_html/flags/dk.png b/public_html/flags/dk.png Binary files differ. diff --git a/public_html/flags/dm.png b/public_html/flags/dm.png Binary files differ. diff --git a/public_html/flags/do.png b/public_html/flags/do.png Binary files differ. diff --git a/public_html/flags/dz.png b/public_html/flags/dz.png Binary files differ. diff --git a/public_html/flags/ec.png b/public_html/flags/ec.png Binary files differ. diff --git a/public_html/flags/ee.png b/public_html/flags/ee.png Binary files differ. diff --git a/public_html/flags/eg.png b/public_html/flags/eg.png Binary files differ. diff --git a/public_html/flags/eh.png b/public_html/flags/eh.png Binary files differ. diff --git a/public_html/flags/er.png b/public_html/flags/er.png Binary files differ. diff --git a/public_html/flags/es.png b/public_html/flags/es.png Binary files differ. diff --git a/public_html/flags/et.png b/public_html/flags/et.png Binary files differ. diff --git a/public_html/flags/fi.png b/public_html/flags/fi.png Binary files differ. diff --git a/public_html/flags/fj.png b/public_html/flags/fj.png Binary files differ. diff --git a/public_html/flags/fk.png b/public_html/flags/fk.png Binary files differ. diff --git a/public_html/flags/fm.png b/public_html/flags/fm.png Binary files differ. diff --git a/public_html/flags/fo.png b/public_html/flags/fo.png Binary files differ. diff --git a/public_html/flags/fr.png b/public_html/flags/fr.png Binary files differ. diff --git a/public_html/flags/ga.png b/public_html/flags/ga.png Binary files differ. diff --git a/public_html/flags/gb-eng.png b/public_html/flags/gb-eng.png Binary files differ. diff --git a/public_html/flags/gb-nir.png b/public_html/flags/gb-nir.png Binary files differ. diff --git a/public_html/flags/gb-sct.png b/public_html/flags/gb-sct.png Binary files differ. diff --git a/public_html/flags/gb-wls.png b/public_html/flags/gb-wls.png Binary files differ. diff --git a/public_html/flags/gb.png b/public_html/flags/gb.png Binary files differ. diff --git a/public_html/flags/gd.png b/public_html/flags/gd.png Binary files differ. diff --git a/public_html/flags/ge.png b/public_html/flags/ge.png Binary files differ. diff --git a/public_html/flags/gf.png b/public_html/flags/gf.png Binary files differ. diff --git a/public_html/flags/gg.png b/public_html/flags/gg.png Binary files differ. diff --git a/public_html/flags/gh.png b/public_html/flags/gh.png Binary files differ. diff --git a/public_html/flags/gi.png b/public_html/flags/gi.png Binary files differ. diff --git a/public_html/flags/gl.png b/public_html/flags/gl.png Binary files differ. diff --git a/public_html/flags/gm.png b/public_html/flags/gm.png Binary files differ. diff --git a/public_html/flags/gn.png b/public_html/flags/gn.png Binary files differ. diff --git a/public_html/flags/gp.png b/public_html/flags/gp.png Binary files differ. diff --git a/public_html/flags/gq.png b/public_html/flags/gq.png Binary files differ. diff --git a/public_html/flags/gr.png b/public_html/flags/gr.png Binary files differ. diff --git a/public_html/flags/gs.png b/public_html/flags/gs.png Binary files differ. diff --git a/public_html/flags/gt.png b/public_html/flags/gt.png Binary files differ. diff --git a/public_html/flags/gu.png b/public_html/flags/gu.png Binary files differ. diff --git a/public_html/flags/gw.png b/public_html/flags/gw.png Binary files differ. diff --git a/public_html/flags/gy.png b/public_html/flags/gy.png Binary files differ. diff --git a/public_html/flags/hk.png b/public_html/flags/hk.png Binary files differ. diff --git a/public_html/flags/hm.png b/public_html/flags/hm.png Binary files differ. diff --git a/public_html/flags/hn.png b/public_html/flags/hn.png Binary files differ. diff --git a/public_html/flags/hr.png b/public_html/flags/hr.png Binary files differ. diff --git a/public_html/flags/ht.png b/public_html/flags/ht.png Binary files differ. diff --git a/public_html/flags/hu.png b/public_html/flags/hu.png Binary files differ. diff --git a/public_html/flags/id.png b/public_html/flags/id.png Binary files differ. diff --git a/public_html/flags/ie.png b/public_html/flags/ie.png Binary files differ. diff --git a/public_html/flags/il.png b/public_html/flags/il.png Binary files differ. diff --git a/public_html/flags/im.png b/public_html/flags/im.png Binary files differ. diff --git a/public_html/flags/in.png b/public_html/flags/in.png Binary files differ. diff --git a/public_html/flags/io.png b/public_html/flags/io.png Binary files differ. diff --git a/public_html/flags/iq.png b/public_html/flags/iq.png Binary files differ. diff --git a/public_html/flags/ir.png b/public_html/flags/ir.png Binary files differ. diff --git a/public_html/flags/is.png b/public_html/flags/is.png Binary files differ. diff --git a/public_html/flags/it.png b/public_html/flags/it.png Binary files differ. diff --git a/public_html/flags/je.png b/public_html/flags/je.png Binary files differ. diff --git a/public_html/flags/jm.png b/public_html/flags/jm.png Binary files differ. diff --git a/public_html/flags/jo.png b/public_html/flags/jo.png Binary files differ. diff --git a/public_html/flags/jp.png b/public_html/flags/jp.png Binary files differ. diff --git a/public_html/flags/ke.png b/public_html/flags/ke.png Binary files differ. diff --git a/public_html/flags/kg.png b/public_html/flags/kg.png Binary files differ. diff --git a/public_html/flags/kh.png b/public_html/flags/kh.png Binary files differ. diff --git a/public_html/flags/ki.png b/public_html/flags/ki.png Binary files differ. diff --git a/public_html/flags/km.png b/public_html/flags/km.png Binary files differ. diff --git a/public_html/flags/kn.png b/public_html/flags/kn.png Binary files differ. diff --git a/public_html/flags/kp.png b/public_html/flags/kp.png Binary files differ. diff --git a/public_html/flags/kr.png b/public_html/flags/kr.png Binary files differ. diff --git a/public_html/flags/kw.png b/public_html/flags/kw.png Binary files differ. diff --git a/public_html/flags/ky.png b/public_html/flags/ky.png Binary files differ. diff --git a/public_html/flags/kz.png b/public_html/flags/kz.png Binary files differ. diff --git a/public_html/flags/la.png b/public_html/flags/la.png Binary files differ. diff --git a/public_html/flags/lb.png b/public_html/flags/lb.png Binary files differ. diff --git a/public_html/flags/lc.png b/public_html/flags/lc.png Binary files differ. diff --git a/public_html/flags/li.png b/public_html/flags/li.png Binary files differ. diff --git a/public_html/flags/lk.png b/public_html/flags/lk.png Binary files differ. diff --git a/public_html/flags/lr.png b/public_html/flags/lr.png Binary files differ. diff --git a/public_html/flags/ls.png b/public_html/flags/ls.png Binary files differ. diff --git a/public_html/flags/lt.png b/public_html/flags/lt.png Binary files differ. diff --git a/public_html/flags/lu.png b/public_html/flags/lu.png Binary files differ. diff --git a/public_html/flags/lv.png b/public_html/flags/lv.png Binary files differ. diff --git a/public_html/flags/ly.png b/public_html/flags/ly.png Binary files differ. diff --git a/public_html/flags/ma.png b/public_html/flags/ma.png Binary files differ. diff --git a/public_html/flags/mc.png b/public_html/flags/mc.png Binary files differ. diff --git a/public_html/flags/md.png b/public_html/flags/md.png Binary files differ. diff --git a/public_html/flags/me.png b/public_html/flags/me.png Binary files differ. diff --git a/public_html/flags/mf.png b/public_html/flags/mf.png Binary files differ. diff --git a/public_html/flags/mg.png b/public_html/flags/mg.png Binary files differ. diff --git a/public_html/flags/mh.png b/public_html/flags/mh.png Binary files differ. diff --git a/public_html/flags/mk.png b/public_html/flags/mk.png Binary files differ. diff --git a/public_html/flags/ml.png b/public_html/flags/ml.png Binary files differ. diff --git a/public_html/flags/mm.png b/public_html/flags/mm.png Binary files differ. diff --git a/public_html/flags/mn.png b/public_html/flags/mn.png Binary files differ. diff --git a/public_html/flags/mo.png b/public_html/flags/mo.png Binary files differ. diff --git a/public_html/flags/mp.png b/public_html/flags/mp.png Binary files differ. diff --git a/public_html/flags/mq.png b/public_html/flags/mq.png Binary files differ. diff --git a/public_html/flags/mr.png b/public_html/flags/mr.png Binary files differ. diff --git a/public_html/flags/ms.png b/public_html/flags/ms.png Binary files differ. diff --git a/public_html/flags/mt.png b/public_html/flags/mt.png Binary files differ. diff --git a/public_html/flags/mu.png b/public_html/flags/mu.png Binary files differ. diff --git a/public_html/flags/mv.png b/public_html/flags/mv.png Binary files differ. diff --git a/public_html/flags/mw.png b/public_html/flags/mw.png Binary files differ. diff --git a/public_html/flags/mx.png b/public_html/flags/mx.png Binary files differ. diff --git a/public_html/flags/my.png b/public_html/flags/my.png Binary files differ. diff --git a/public_html/flags/mz.png b/public_html/flags/mz.png Binary files differ. diff --git a/public_html/flags/na.png b/public_html/flags/na.png Binary files differ. diff --git a/public_html/flags/nc.png b/public_html/flags/nc.png Binary files differ. diff --git a/public_html/flags/ne.png b/public_html/flags/ne.png Binary files differ. diff --git a/public_html/flags/nf.png b/public_html/flags/nf.png Binary files differ. diff --git a/public_html/flags/ng.png b/public_html/flags/ng.png Binary files differ. diff --git a/public_html/flags/ni.png b/public_html/flags/ni.png Binary files differ. diff --git a/public_html/flags/nl.png b/public_html/flags/nl.png Binary files differ. diff --git a/public_html/flags/no.png b/public_html/flags/no.png Binary files differ. diff --git a/public_html/flags/np.png b/public_html/flags/np.png Binary files differ. diff --git a/public_html/flags/nr.png b/public_html/flags/nr.png Binary files differ. diff --git a/public_html/flags/nu.png b/public_html/flags/nu.png Binary files differ. diff --git a/public_html/flags/nz.png b/public_html/flags/nz.png Binary files differ. diff --git a/public_html/flags/om.png b/public_html/flags/om.png Binary files differ. diff --git a/public_html/flags/pa.png b/public_html/flags/pa.png Binary files differ. diff --git a/public_html/flags/pe.png b/public_html/flags/pe.png Binary files differ. diff --git a/public_html/flags/pf.png b/public_html/flags/pf.png Binary files differ. diff --git a/public_html/flags/pg.png b/public_html/flags/pg.png Binary files differ. diff --git a/public_html/flags/ph.png b/public_html/flags/ph.png Binary files differ. diff --git a/public_html/flags/pk.png b/public_html/flags/pk.png Binary files differ. diff --git a/public_html/flags/pl.png b/public_html/flags/pl.png Binary files differ. diff --git a/public_html/flags/pm.png b/public_html/flags/pm.png Binary files differ. diff --git a/public_html/flags/pn.png b/public_html/flags/pn.png Binary files differ. diff --git a/public_html/flags/pr.png b/public_html/flags/pr.png Binary files differ. diff --git a/public_html/flags/ps.png b/public_html/flags/ps.png Binary files differ. diff --git a/public_html/flags/pt.png b/public_html/flags/pt.png Binary files differ. diff --git a/public_html/flags/pw.png b/public_html/flags/pw.png Binary files differ. diff --git a/public_html/flags/py.png b/public_html/flags/py.png Binary files differ. diff --git a/public_html/flags/qa.png b/public_html/flags/qa.png Binary files differ. diff --git a/public_html/flags/re.png b/public_html/flags/re.png Binary files differ. diff --git a/public_html/flags/ro.png b/public_html/flags/ro.png Binary files differ. diff --git a/public_html/flags/rs.png b/public_html/flags/rs.png Binary files differ. diff --git a/public_html/flags/ru.png b/public_html/flags/ru.png Binary files differ. diff --git a/public_html/flags/rw.png b/public_html/flags/rw.png Binary files differ. diff --git a/public_html/flags/sa.png b/public_html/flags/sa.png Binary files differ. diff --git a/public_html/flags/sb.png b/public_html/flags/sb.png Binary files differ. diff --git a/public_html/flags/sc.png b/public_html/flags/sc.png Binary files differ. diff --git a/public_html/flags/sd.png b/public_html/flags/sd.png Binary files differ. diff --git a/public_html/flags/se.png b/public_html/flags/se.png Binary files differ. diff --git a/public_html/flags/sg.png b/public_html/flags/sg.png Binary files differ. diff --git a/public_html/flags/sh.png b/public_html/flags/sh.png Binary files differ. diff --git a/public_html/flags/si.png b/public_html/flags/si.png Binary files differ. diff --git a/public_html/flags/sj.png b/public_html/flags/sj.png Binary files differ. diff --git a/public_html/flags/sk.png b/public_html/flags/sk.png Binary files differ. diff --git a/public_html/flags/sl.png b/public_html/flags/sl.png Binary files differ. diff --git a/public_html/flags/sm.png b/public_html/flags/sm.png Binary files differ. diff --git a/public_html/flags/sn.png b/public_html/flags/sn.png Binary files differ. diff --git a/public_html/flags/so.png b/public_html/flags/so.png Binary files differ. diff --git a/public_html/flags/sr.png b/public_html/flags/sr.png Binary files differ. diff --git a/public_html/flags/ss.png b/public_html/flags/ss.png Binary files differ. diff --git a/public_html/flags/st.png b/public_html/flags/st.png Binary files differ. diff --git a/public_html/flags/sv.png b/public_html/flags/sv.png Binary files differ. diff --git a/public_html/flags/sx.png b/public_html/flags/sx.png Binary files differ. diff --git a/public_html/flags/sy.png b/public_html/flags/sy.png Binary files differ. diff --git a/public_html/flags/sz.png b/public_html/flags/sz.png Binary files differ. diff --git a/public_html/flags/tc.png b/public_html/flags/tc.png Binary files differ. diff --git a/public_html/flags/td.png b/public_html/flags/td.png Binary files differ. diff --git a/public_html/flags/tf.png b/public_html/flags/tf.png Binary files differ. diff --git a/public_html/flags/tg.png b/public_html/flags/tg.png Binary files differ. diff --git a/public_html/flags/th.png b/public_html/flags/th.png Binary files differ. diff --git a/public_html/flags/tj.png b/public_html/flags/tj.png Binary files differ. diff --git a/public_html/flags/tk.png b/public_html/flags/tk.png Binary files differ. diff --git a/public_html/flags/tl.png b/public_html/flags/tl.png Binary files differ. diff --git a/public_html/flags/tm.png b/public_html/flags/tm.png Binary files differ. diff --git a/public_html/flags/tn.png b/public_html/flags/tn.png Binary files differ. diff --git a/public_html/flags/to.png b/public_html/flags/to.png Binary files differ. diff --git a/public_html/flags/tr.png b/public_html/flags/tr.png Binary files differ. diff --git a/public_html/flags/tt.png b/public_html/flags/tt.png Binary files differ. diff --git a/public_html/flags/tv.png b/public_html/flags/tv.png Binary files differ. diff --git a/public_html/flags/tw.png b/public_html/flags/tw.png Binary files differ. diff --git a/public_html/flags/tz.png b/public_html/flags/tz.png Binary files differ. diff --git a/public_html/flags/ua.png b/public_html/flags/ua.png Binary files differ. diff --git a/public_html/flags/ug.png b/public_html/flags/ug.png Binary files differ. diff --git a/public_html/flags/um.png b/public_html/flags/um.png Binary files differ. diff --git a/public_html/flags/us.png b/public_html/flags/us.png Binary files differ. diff --git a/public_html/flags/uy.png b/public_html/flags/uy.png Binary files differ. diff --git a/public_html/flags/uz.png b/public_html/flags/uz.png Binary files differ. diff --git a/public_html/flags/va.png b/public_html/flags/va.png Binary files differ. diff --git a/public_html/flags/vc.png b/public_html/flags/vc.png Binary files differ. diff --git a/public_html/flags/ve.png b/public_html/flags/ve.png Binary files differ. diff --git a/public_html/flags/vg.png b/public_html/flags/vg.png Binary files differ. diff --git a/public_html/flags/vi.png b/public_html/flags/vi.png Binary files differ. diff --git a/public_html/flags/vn.png b/public_html/flags/vn.png Binary files differ. diff --git a/public_html/flags/vu.png b/public_html/flags/vu.png Binary files differ. diff --git a/public_html/flags/wf.png b/public_html/flags/wf.png Binary files differ. diff --git a/public_html/flags/ws.png b/public_html/flags/ws.png Binary files differ. diff --git a/public_html/flags/xk.png b/public_html/flags/xk.png Binary files differ. diff --git a/public_html/flags/ye.png b/public_html/flags/ye.png Binary files differ. diff --git a/public_html/flags/yt.png b/public_html/flags/yt.png Binary files differ. diff --git a/public_html/flags/za.png b/public_html/flags/za.png Binary files differ. diff --git a/public_html/flags/zm.png b/public_html/flags/zm.png Binary files differ. diff --git a/public_html/flags/zw.png b/public_html/flags/zw.png Binary files differ. diff --git a/public_html/fonts/Now-Black.otf b/public_html/fonts/Now-Black.otf Binary files differ. diff --git a/public_html/fonts/Now-Bold.otf b/public_html/fonts/Now-Bold.otf Binary files differ. diff --git a/public_html/fonts/Now-Light.otf b/public_html/fonts/Now-Light.otf Binary files differ. diff --git a/public_html/fonts/Now-Medium.otf b/public_html/fonts/Now-Medium.otf Binary files differ. diff --git a/public_html/fonts/Now-Regular.otf b/public_html/fonts/Now-Regular.otf Binary files differ. diff --git a/public_html/fonts/Now-Thin.otf b/public_html/fonts/Now-Thin.otf Binary files differ. diff --git a/public_html/fonts/OFL-FAQ.txt b/public_html/fonts/OFL-FAQ.txt @@ -0,0 +1,429 @@ +Copyright (c) 2015, Alfredo Marco Pradil (<http://behance.net/pradil | ammpradil@gmail.com>), with Reserved Font Name Now. + +OFL FAQ - Frequently Asked Questions about the SIL Open Font License (OFL) +Version 1.1-update4 - Sept 2014 +(See http://scripts.sil.org/OFL for updates) + + +CONTENTS OF THIS FAQ +1 USING AND DISTRIBUTING FONTS LICENSED UNDER THE OFL +2 USING OFL FONTS FOR WEB PAGES AND ONLINE WEB FONT SERVICES +3 MODIFYING OFL-LICENSED FONTS +4 LICENSING YOUR ORIGINAL FONTS UNDER THE OFL +5 CHOOSING RESERVED FONT NAMES +6 ABOUT THE FONTLOG +7 MAKING CONTRIBUTIONS TO OFL PROJECTS +8 ABOUT THE LICENSE ITSELF +9 ABOUT SIL INTERNATIONAL +APPENDIX A - FONTLOG EXAMPLE + +1 USING AND DISTRIBUTING FONTS LICENSED UNDER THE OFL + +1.1 Can I use the fonts for a book or other print publication, to create logos or other graphics or even to manufacture objects based on their outlines? +Yes. You are very welcome to do so. Authors of fonts released under the OFL allow you to use their font software as such for any kind of design work. No additional license or permission is required, unlike with some other licenses. Some examples of these uses are: logos, posters, business cards, stationery, video titling, signage, t-shirts, personalised fabric, 3D-printed/laser-cut shapes, sculptures, rubber stamps, cookie cutters and lead type. + +1.1.1 Does that restrict the license or distribution of that artwork? +No. You remain the author and copyright holder of that newly derived graphic or object. You are simply using an open font in the design process. It is only when you redistribute, bundle or modify the font itself that other conditions of the license have to be respected (see below for more details). + +1.1.2 Is any kind of acknowledgement required? +No. Font authors may appreciate being mentioned in your artwork's acknowledgements alongside the name of the font, possibly with a link to their website, but that is not required. + +1.2 Can the fonts be included with Free/Libre and Open Source Software collections such as GNU/Linux and BSD distributions and repositories? +Yes! Fonts licensed under the OFL can be freely included alongside other software under FLOSS (Free/Libre and Open Source Software) licenses. Since fonts are typically aggregated with, not merged into, existing software, there is little need to be concerned about incompatibility with existing software licenses. You may also repackage the fonts and the accompanying components in a .rpm or .deb package (or other similar package formats or installers) and include them in distribution CD/DVDs and online repositories. (Also see section 5.9 about rebuilding from source.) + +1.3 I want to distribute the fonts with my program. Does this mean my program also has to be Free/Libre and Open Source Software? +No. Only the portions based on the Font Software are required to be released under the OFL. The intent of the license is to allow aggregation or bundling with software under restricted licensing as well. + +1.4 Can I sell a software package that includes these fonts? +Yes, you can do this with both the Original Version and a Modified Version of the fonts. Examples of bundling made possible by the OFL would include: word processors, design and publishing applications, training and educational software, games and entertainment software, mobile device applications, etc. + +1.5 Can I include the fonts on a CD of freeware or commercial fonts? +Yes, as long some other font or software is also on the disk, so the OFL font is not sold by itself. + +1.6 Why won't the OFL let me sell the fonts alone? +The intent is to keep people from making money by simply redistributing the fonts. The only people who ought to profit directly from the fonts should be the original authors, and those authors have kindly given up potential direct income to distribute their fonts under the OFL. Please honour and respect their contribution! + +1.7 What about sharing OFL fonts with friends on a CD, DVD or USB stick? +You are very welcome to share open fonts with friends, family and colleagues through removable media. Just remember to include the full font package, including any copyright notices and licensing information as available in OFL.txt. In the case where you sell the font, it has to come bundled with software. + +1.8 Can I host the fonts on a web site for others to use? +Yes, as long as you make the full font package available. In most cases it may be best to point users to the main site that distributes the Original Version so they always get the most recent stable and complete version. See also discussion of web fonts in Section 2. + +1.9 Can I host the fonts on a server for use over our internal network? +Yes. If the fonts are transferred from the server to the client computer by means that allow them to be used even if the computer is no longer attached to the network, the full package (copyright notices, licensing information, etc.) should be included. + +1.10 Does the full OFL license text always need to accompany the font? +The only situation in which an OFL font can be distributed without the text of the OFL (either in a separate file or in font metadata), is when a font is embedded in a document or bundled within a program. In the case of metadata included within a font, it is legally sufficient to include only a link to the text of the OFL on http://scripts.sil.org/OFL, but we strongly recommend against this. Most modern font formats include metadata fields that will accept the full OFL text, and full inclusion increases the likelihood that users will understand and properly apply the license. + +1.11 What do you mean by 'embedding'? How does that differ from other means of distribution? +By 'embedding' we mean inclusion of the font in a document or file in a way that makes extraction (and redistribution) difficult or clearly discouraged. In many cases the names of embedded fonts might also not be obvious to those reading the document, the font data format might be altered, and only a subset of the font - only the glyphs required for the text - might be included. Any other means of delivering a font to another person is considered 'distribution', and needs to be accompanied by any copyright notices and licensing information available in OFL.txt. + +1.12 So can I embed OFL fonts in my document? +Yes, either in full or a subset. The restrictions regarding font modification and redistribution do not apply, as the font is not intended for use outside the document. + +1.13 Does embedding alter the license of the document itself? +No. Referencing or embedding an OFL font in any document does not change the license of the document itself. The requirement for fonts to remain under the OFL does not apply to any document created using the fonts and their derivatives. Similarly, creating any kind of graphic using a font under OFL does not make the resulting artwork subject to the OFL. + +1.14 If OFL fonts are extracted from a document in which they are embedded (such as a PDF file), what can be done with them? Is this a risk to author(s)? +The few utilities that can extract fonts embedded in a PDF will typically output limited amounts of outlines - not a complete font. To create a working font from this method is much more difficult and time consuming than finding the source of the original OFL font. So there is little chance that an OFL font would be extracted and redistributed inappropriately through this method. Even so, copyright laws address any misrepresentation of authorship. All Font Software released under the OFL and marked as such by the author(s) is intended to remain under this license regardless of the distribution method, and cannot be redistributed under any other license. We strongly discourage any font extraction - we recommend directly using the font sources instead - but if you extract font outlines from a document, please be considerate: respect the work of the author(s) and the licensing model. + +1.15 What about distributing fonts with a document? Within a compressed folder structure? Is it distribution, bundling or embedding? +Certain document formats may allow the inclusion of an unmodified font within their file structure which may consist of a compressed folder containing the various resources forming the document (such as pictures and thumbnails). Including fonts within such a structure is understood as being different from embedding but rather similar to bundling (or mere aggregation) which the license explicitly allows. In this case the font is conveyed unchanged whereas embedding a font usually transforms it from the original format. The OFL does not allow anyone to extract the font from such a structure to then redistribute it under another license. The explicit permission to redistribute and embed does not cancel the requirement for the Font Software to remain under the license chosen by its author(s). Even if the font travels inside the document as one of its assets, it should not lose its authorship information and licensing. + +1.16 What about ebooks shipping with open fonts? +The requirements differ depending on whether the fonts are linked, embedded or distributed (bundled or aggregated). Some ebook formats use web technologies to do font linking via @font-face, others are designed for font embedding, some use fonts distributed with the document or reading software, and a few rely solely on the fonts already present on the target system. The license requirements depend on the type of inclusion as discussed in 1.15. + +1.17 Can Font Software released under the OFL be subject to URL-based access restrictions methods or DRM (Digital Rights Management) mechanisms? +Yes, but these issues are out-of-scope for the OFL. The license itself neither encourages their use nor prohibits them since such mechanisms are not implemented in the components of the Font Software but through external software. Such restrictions are put in place for many different purposes corresponding to various usage scenarios. One common example is to limit potentially dangerous cross-site scripting attacks. However, in the spirit of libre/open fonts and unrestricted writing systems, we strongly encourage open sharing and reuse of OFL fonts, and the establishment of an environment where such restrictions are unnecessary. Note that whether you wish to use such mechanisms or you prefer not to, you must still abide by the rules set forth by the OFL when using fonts released by their authors under this license. Derivative fonts must be licensed under the OFL, even if they are part of a service for which you charge fees and/or for which access to source code is restricted. You may not sell the fonts on their own - they must be part of a larger software package, bundle or subscription plan. For example, even if the OFL font is distributed in a software package or via an online service using a DRM mechanism, the user would still have the right to extract that font, use, study, modify and redistribute it under the OFL. + +1.18 I've come across a font released under the OFL. How can I easily get more information about the Original Version? How can I know where it stands compared to the Original Version or other Modified Versions? +Consult the copyright statement(s) in the license for ways to contact the original authors. Consult the FONTLOG (see section 6 for more details and examples) for information on how the font differs from the Original Version, and get in touch with the various contributors via the information in the acknowledgement section. Please consider using the Original Versions of the fonts whenever possible. + +1.19 What do you mean in condition 4 of the OFL's permissions and conditions? Can you provide examples of abusive promotion / endorsement / advertisement vs. normal acknowledgement? +The intent is that the goodwill and reputation of the author(s) should not be used in a way that makes it sound like the original author(s) endorse or approve of a specific Modified Version or software bundle. For example, it would not be right to advertise a word processor by naming the author(s) in a listing of software features, or to promote a Modified Version on a web site by saying "designed by ...". However, it would be appropriate to acknowledge the author(s) if your software package has a list of people who deserve thanks. We realize that this can seem to be a grey area, but the standard used to judge an acknowledgement is that if the acknowledgement benefits the author(s) it is allowed, but if it primarily benefits other parties, or could reflect poorly on the author(s), then it is not. + +1.20 I'm writing a small app for mobile platforms, do I need to include the whole package? +If you bundle a font under the OFL with your mobile app you must comply with the terms of the license. At a minimum you must include the copyright statement, the license notice and the license text. A mention of this information in your About box or Changelog, with a link to where the font package is from, is good practice, and the extra space needed to carry these items is very small. You do not, however, need to include the full contents of the font package - only the fonts you use and the copyright and license that apply to them. For example, if you only use the regular weight in your app, you do not need to include the italic and bold versions. + +1.21 What about including OFL fonts by default in my firmware or dedicated operating system? +Many such systems are restricted and turned into appliances so that users cannot study or modify them. Using open fonts to increase quality and language coverage is a great idea, but you need to be aware that if there is a way for users to extract fonts you cannot legally prevent them from doing that. The fonts themselves, including any changes you make to them, must be distributed under the OFL even if your firmware has a more restrictive license. If you do transform the fonts and change their formats when you include them in your firmware you must respect any names reserved by the font authors via the RFN mechanism and pick your own font name. Alternatively if you directly add a font under the OFL to the font folder of your firmware without modifying or optimizing it you are simply bundling the font like with any other software collection, and do not need to make any further changes. + +1.22 Can I make and publish CMS themes or templates that use OFL fonts? Can I include the fonts themselves in the themes or templates? Can I sell the whole package? +Yes, you are very welcome to integrate open fonts into themes and templates for your preferred CMS and make them more widely available. Remember that you can only sell the fonts and your CMS add-on as part of a software bundle. (See 1.4 for details and examples about selling bundles). + +1.23 Can OFL fonts be included in services that deliver fonts to the desktop from remote repositories? Even if they contain both OFL and non-OFL fonts? +Yes. Some foundries have set up services to deliver fonts to subscribers directly to desktops from their online repositories; similarly, plugins are available to preview and use fonts directly in your design tool or publishing suite. These services may mix open and restricted fonts in the same channel, however they should make a clear distinction between them to users. These services should also not hinder users (such as through DRM or obfuscation mechanisms) from extracting and using the OFL fonts in other environments, or continuing to use OFL fonts after subscription terms have ended, as those uses are specifically allowed by the OFL. + +1.24 Can services that provide or distribute OFL fonts restrict my use of them? +No. The terms of use of such services cannot replace or restrict the terms of the OFL, as that would be the same as distributing the fonts under a different license, which is not allowed. You are still entitled to use, modify and redistribute them as the original authors have intended outside of the sole control of that particular distribution channel. Note, however, that the fonts provided by these services may differ from the Original Versions. + + +2 USING OFL FONTS FOR WEBPAGES AND ONLINE WEB FONT SERVICES + +NOTE: This section often refers to a separate paper on 'Web Fonts & RFNs'. This is available at http://scripts.sil.org/OFL_web_fonts_and_RFNs + +2.1 Can I make webpages using these fonts? +Yes! Go ahead! Using CSS (Cascading Style Sheets) is recommended. Your three best options are: +- referring directly in your stylesheet to open fonts which may be available on the user's system +- providing links to download the full package of the font - either from your own website or from elsewhere - so users can install it themselves +- using @font-face to distribute the font directly to browsers. This is recommended and explicitly allowed by the licensing model because it is distribution. The font file itself is distributed with other components of the webpage. It is not embedded in the webpage but referenced through a web address which will cause the browser to retrieve and use the corresponding font to render the webpage (see 1.11 and 1.15 for details related to embedding fonts into documents). As you take advantage of the @font-face cross-platform standard, be aware that web fonts are often tuned for a web environment and not intended for installation and use outside a browser. The reasons in favour of using web fonts are to allow design of dynamic text elements instead of static graphics, to make it easier for content to be localized and translated, indexed and searched, and all this with cross-platform open standards without depending on restricted extensions or plugins. You should check the CSS cascade (the order in which fonts are being called or delivered to your users) when testing. + +2.2 Can I make and use WOFF (Web Open Font Format) versions of OFL fonts? +Yes, but you need to be careful. A change in font format normally is considered modification, and Reserved Font Names (RFNs) cannot be used. Because of the design of the WOFF format, however, it is possible to create a WOFF version that is not considered modification, and so would not require a name change. You are allowed to create, use and distribute a WOFF version of an OFL font without changing the font name, but only if: + +- the original font data remains unchanged except for WOFF compression, and +- WOFF-specific metadata is either omitted altogether or present and includes, unaltered, the contents of all equivalent metadata in the original font. + +If the original font data or metadata is changed, or the WOFF-specific metadata is incomplete, the font must be considered a Modified Version, the OFL restrictions would apply and the name of the font must be changed: any RFNs cannot be used and copyright notices and licensing information must be included and cannot be deleted or modified. You must come up with a unique name - we recommend one corresponding to your domain or your particular web application. Be aware that only the original author(s) can use RFNs. This is to prevent collisions between a derivative tuned to your audience and the original upstream version and so to reduce confusion. + +Please note that most WOFF conversion tools and online services do not meet the two requirements listed above, and so their output must be considered a Modified Version. So be very careful and check to be sure that the tool or service you're using is compressing unchanged data and completely and accurately reflecting the original font metadata. + +2.3 What about other web font formats such as EOT/EOTLite/CWT/etc.? +In most cases these formats alter the original font data more than WOFF, and do not completely support appropriate metadata, so their use must be considered modification and RFNs may not be used. However, there may be certain formats or usage scenarios that may allow the use of RFNs. See http://scripts.sil.org/OFL_web_fonts_and_RFNs + +2.4 Can I make OFL fonts available through web font online services? +Yes, you are welcome to include OFL fonts in online web font services as long as you properly meet all the conditions of the license. The origin and open status of the font should be clear among the other fonts you are hosting. Authorship, copyright notices and license information must be sufficiently visible to your users or subscribers so they know where the font comes from and the rights granted by the author(s). Make sure the font file contains the needed copyright notice(s) and licensing information in its metadata. Please double-check the accuracy of every field to prevent contradictory information. Other font formats, including EOT/EOTLite/CWT and superior alternatives like WOFF, already provide fields for this information. Remember that if you modify the font within your library or convert it to another format for any reason the OFL restrictions apply and you need to change the names accordingly. Please respect the author's wishes as expressed in the OFL and do not misrepresent original designers and their work. Don't lump quality open fonts together with dubious freeware or public domain fonts. Consider how you can best work with the original designers and foundries, support their efforts and generate goodwill that will benefit your service. (See 1.17 for details related to URL-based access restrictions methods or DRM mechanisms). + +2.5 Some web font formats and services provide ways of "optimizing" the font for a particular website or web application; is that allowed? +Yes, it is permitted, but remember that these optimized versions are Modified Versions and so must follow OFL requirements like appropriate renaming. Also you need to bear in mind the other important parameters beyond compression, speed and responsiveness: you need to consider the audience of your particular website or web application, as choosing some optimization parameters may turn out to be less than ideal for them. Subsetting by removing certain glyphs or features may seriously limit functionality of the font in various languages that your users expect. It may also introduce degradation of quality in the rendering or specific bugs on the various target platforms compared to the original font from upstream. In other words, remember that one person's optimized font may be another person's missing feature. Various advanced typographic features (OpenType, Graphite or AAT) are also available through CSS and may provide the desired effects without the need to modify the font. + +2.6 Is subsetting a web font considered modification? +Yes. Removing any parts of the font when delivering a web font to a browser, including unused glyphs and smart font code, is considered modification. This is permitted by the OFL but would not normally allow the use of RFNs. Some newer subsetting technologies may be able to subset in a way that allows users to effectively have access to the complete font, including smart font behaviour. See 2.8 and http://scripts.sil.org/OFL_web_fonts_and_RFNs + +2.7 Are there any situations in which a modified web font could use RFNs? +Yes. If a web font is optimized only in ways that preserve Functional Equivalence (see 2.8), then it may use RFNs, as it reasonably represents the Original Version and respects the intentions of the author(s) and the main purposes of the RFN mechanism (avoids collisions, protects authors, minimizes support, encourages derivatives). However this is technically very difficult and often impractical, so a much better scenario is for the web font service or provider to sign a separate agreement with the author(s) that allows the use of RFNs for Modified Versions. + +2.8 How do you know if an optimization to a web font preserves Functional Equivalence? +Functional Equivalence is described in full in the 'Web fonts and RFNs' paper at http://scripts.sil.org/OFL_web_fonts_and_RFNs, in general, an optimized font is deemed to be Functionally Equivalent (FE) to the Original Version if it: + +- Supports the same full character inventory. If a character can be properly displayed using the Original Version, then that same character, encoded correctly on a web page, will display properly. +- Provides the same smart font behavior. Any dynamic shaping behavior that works with the Original Version should work when optimized, unless the browser or environment does not support it. There does not need to be guaranteed support in the client, but there should be no forced degradation of smart font or shaping behavior, such as the removal or obfuscation of OpenType, Graphite or AAT tables. +- Presents text with no obvious degradation in visual quality. The lettershapes should be equally (or more) readable, within limits of the rendering platform. +- Preserves original author, project and license metadata. At a minimum, this should include: Copyright and authorship; The license as stated in the Original Version, whether that is the full text of the OFL or a link to the web version; Any RFN declarations; Information already present in the font or documentation that points back to the Original Version, such as a link to the project or the author's website. + +If an optimized font meets these requirements, and so is considered to be FE, then it's very likely that the original author would feel that the optimized font is a good and reasonable equivalent. If it falls short of any of these requirements, the optimized font does not reasonably represent the Original Version, and so should be considered to be a Modified Version. Like other Modified Versions, it would not be allowed to use any RFNs and you simply need to pick your own font name. + +2.9 Isn't use of web fonts another form of embedding? +No. Unlike embedded fonts in a PDF, web fonts are not an integrated part of the document itself. They are not specific to a single document and are often applied to thousands of documents around the world. The font data is not stored alongside the document data and often originates from a different location. The ease by which the web fonts used by a document may be identified and downloaded for desktop use demonstrates that they are philosophically and technically separate from the web pages that specify them. See http://scripts.sil.org/OFL_web_fonts_and_RFNs + +2.10 So would it be better to not use RFNs at all if you want your font to be distributed by a web fonts service? +No. Although the OFL does not require authors to use RFNs, the RFN mechanism is an important part of the OFL model and completely compatible with web font services. If that web font service modifies the fonts, then the best solution is to sign a separate agreement for the use of any RFNs. It is perfectly valid for an author to not declare any RFNs, but before they do so they need to fully understand the benefits they are giving up, and the overall negative effect of allowing many different versions bearing the same name to be widely distributed. As a result, we don't generally recommend it. + +2.11 What should an agreement for the use of RFNs say? Are there any examples? +There is no prescribed format for this agreement, as legal systems vary, and no recommended examples. Authors may wish to add specific clauses to further restrict use, require author review of Modified Versions, establish user support mechanisms or provide terms for ending the agreement. Such agreements are usually not public, and apply only to the main parties. However, it would be very beneficial for web font services to clearly state when they have established such agreements, so that the public understands clearly that their service is operating appropriately. + +See the separate paper on 'Web Fonts & RFNs' for in-depth discussion of issues related to the use of RFNs for web fonts. This is available at http://scripts.sil.org/OFL_web_fonts_and_RFNs + + +3 MODIFYING OFL-LICENSED FONTS + +3.1 Can I change the fonts? Are there any limitations to what things I can and cannot change? +You are allowed to change anything, as long as such changes do not violate the terms of the license. In other words, you are not allowed to remove the copyright statement(s) from the font, but you could put additional information into it that covers your contribution. See the placeholders in the OFL header template for recommendations on where to add your own statements. (Remember that, when authors have reserved names via the RFN mechanism, you need to change the internal names of the font to your own font name when making your modified version even if it is just a small change.) + +3.2 I have a font that needs a few extra glyphs - can I take them from an OFL licensed font and copy them into mine? +Yes, but if you distribute that font to others it must be under the OFL, and include the information mentioned in condition 2 of the license. + +3.3 Can I charge people for my additional work? In other words, if I add a bunch of special glyphs or OpenType/Graphite/AAT code, can I sell the enhanced font? +Not by itself. Derivative fonts must be released under the OFL and cannot be sold by themselves. It is permitted, however, to include them in a larger software package (such as text editors, office suites or operating systems), even if the larger package is sold. In that case, you are strongly encouraged, but not required, to also make that derived font easily and freely available outside of the larger package. + +3.4 Can I pay someone to enhance the fonts for my use and distribution? +Yes. This is a good way to fund the further development of the fonts. Keep in mind, however, that if the font is distributed to others it must be under the OFL. You won't be able to recover your investment by exclusively selling the font, but you will be making a valuable contribution to the community. Please remember how you have benefited from the contributions of others. + +3.5 I need to make substantial revisions to the font to make it work with my program. It will be a lot of work, and a big investment, and I want to be sure that it can only be distributed with my program. Can I restrict its use? +No. If you redistribute a Modified Version of the font it must be under the OFL. You may not restrict it in any way beyond what the OFL permits and requires. This is intended to ensure that all released improvements to the fonts become available to everyone. But you will likely get an edge over competitors by being the first to distribute a bundle with the enhancements. Again, please remember how you have benefited from the contributions of others. + +3.6 Do I have to make any derivative fonts (including extended source files, build scripts, documentation, etc.) publicly available? +No, but please consider sharing your improvements with others. You may find that you receive in return more than what you gave. + +3.7 If a trademark is claimed in the OFL font, does that trademark need to remain in modified fonts? +Yes. Any trademark notices must remain in any derivative fonts to respect trademark laws, but you may add any additional trademarks you claim, officially registered or not. For example if an OFL font called "Foo" contains a notice that "Foo is a trademark of Acme", then if you rename the font to "Bar" when creating a Modified Version, the new trademark notice could say "Foo is a trademark of Acme Inc. - Bar is a trademark of Roadrunner Technologies Ltd.". Trademarks work alongside the OFL and are not subject to the terms of the licensing agreement. The OFL does not grant any rights under trademark law. Bear in mind that trademark law varies from country to country and that there are no international trademark conventions as there are for copyright. You may need to significantly invest in registering and defending a trademark for it to remain valid in the countries you are interested in. This may be costly for an individual independent designer. + +3.8 If I commit changes to a font (or publish a branch in a DVCS) as part of a public open source software project, do I have to change the internal font names? +Only if there are declared RFNs. Making a public commit or publishing a public branch is effectively redistributing your modifications, so any change to the font will require that you do not use the RFNs. Even if there are no RFNs, it may be useful to change the name or add a suffix indicating that a particular version of the font is still in development and not released yet. This will clearly indicate to users and fellow designers that this particular font is not ready for release yet. See section 5 for more details. + + +4 LICENSING YOUR ORIGINAL FONTS UNDER THE OFL + +4.1 Can I use the SIL OFL for my own fonts? +Yes! We heartily encourage everyone to use the OFL to distribute their own original fonts. It is a carefully constructed license that allows great freedom along with enough artistic integrity protection for the work of the authors as well as clear rules for other contributors and those who redistribute the fonts. The licensing model is used successfully by various organisations, both for-profit and not-for-profit, to release fonts of varying levels of scope and complexity. + +4.2 What do I have to do to apply the OFL to my font? +If you want to release your fonts under the OFL, we recommend you do the following: + +4.2.1 Put your copyright and Reserved Font Names information at the beginning of the main OFL.txt file in place of the dedicated placeholders (marked with the <> characters). Include this file in your release package. + +4.2.2 Put your copyright and the OFL text with your chosen Reserved Font Name(s) into your font files (the copyright and license fields). A link to the OFL text on the OFL web site is an acceptable (but not recommended) alternative. Also add this information to any other components (build scripts, glyph databases, documentation, test files, etc). Accurate metadata in your font files is beneficial to you as an increasing number of applications are exposing this information to the user. For example, clickable links can bring users back to your website and let them know about other work you have done or services you provide. Depending on the format of your fonts and sources, you can use template human-readable headers or machine-readable metadata. You should also double-check that there is no conflicting metadata in the font itself contradicting the license, such as the fstype bits in the os2 table or fields in the name table. + +4.2.3 Write an initial FONTLOG.txt for your font and include it in the release package (see Section 6 and Appendix A for details including a template). + +4.2.4 Include the relevant practical documentation on the license by adding the current OFL-FAQ.txt file in your package. + +4.2.5 If you wish you can use the OFL graphics (http://scripts.sil.org/OFL_logo) on your website. + +4.3 Will you make my font OFL for me? +We won't do the work for you. We can, however, try to answer your questions, unfortunately we do not have the resources to review and check your font packages for correct use of the OFL. We recommend you turn to designers, foundries or consulting companies with experience in doing open font design to provide this service to you. + +4.4 Will you distribute my OFL font for me? +No, although if the font is of sufficient quality and general interest we may include a link to it on our partial list of OFL fonts on the OFL web site. You may wish to consider other open font catalogs or hosting services, such as the Unifont Font Guide (http://unifont.org/fontguide), The League of Movable Type (http://theleagueofmovabletype.com) or the Open Font Library (http://openfontlibrary.org/), which despite the name has no direct relationship to the OFL or SIL. We do not endorse any particular catalog or hosting service - it is your responsibility to determine if the service is right for you and if it treats authors with fairness. + +4.5 Why should I use the OFL for my fonts? +- to meet needs for fonts that can be modified to support lesser-known languages +- to provide a legal and clear way for people to respect your work but still use it (and reduce piracy) +- to involve others in your font project +- to enable your fonts to be expanded with new weights and improved writing system/language support +- to allow more technical font developers to add features to your design (such as OpenType, Graphite or AAT support) +- to renew the life of an old font lying on your hard drive with no business model +- to allow your font to be included in Libre Software operating systems like Ubuntu +- to give your font world status and wide, unrestricted distribution +- to educate students about quality typeface and font design +- to expand your test base and get more useful feedback +- to extend your reach to new markets when users see your metadata and go to your website +- to get your font more easily into one of the web font online services +- to attract attention for your commercial fonts +- to make money through web font services +- to make money by bundling fonts with applications +- to make money adjusting and extending existing open fonts +- to get a better chance that foundations/NGOs/charities/companies who commission fonts will pick you +- to be part of a sharing design and development community +- to give back and contribute to a growing body of font sources + + +5 CHOOSING RESERVED FONT NAMES + +5.1 What are Reserved Font Names? +These are font names, or portions of font names, that the author has chosen to reserve for use only with the Original Version of the font, or for Modified Version(s) created by the original author. + +5.2 Why can't I use the Reserved Font Names in my derivative font names? I'd like people to know where the design came from. +The best way to acknowledge the source of the design is to thank the original authors and any other contributors in the files that are distributed with your revised font (although no acknowledgement is required). The FONTLOG is a natural place to do this. Reserved Font Names ensure that the only fonts that have the original names are the unmodified Original Versions. This allows designers to maintain artistic integrity while allowing collaboration to happen. It eliminates potential confusion and name conflicts. When choosing a name, be creative and avoid names that reuse almost all the same letters in the same order or sound like the original. It will help everyone if Original Versions and Modified Versions can easily be distinguished from one another and from other derivatives. Any substitution and matching mechanism is outside the scope of the license. + +5.3 What do you mean by "primary name as presented to the user"? Are you referring to the font menu name? +Yes, this applies to the font menu name and other mechanisms that specify a font in a document. It would be fine, however, to keep a text reference to the original fonts in the description field, in your modified source file or in documentation provided alongside your derivative as long as no one could be confused that your modified source is the original. But you cannot use the Reserved Font Names in any way to identify the font to the user (unless the Copyright Holder(s) allow(s) it through a separate agreement). Users who install derivatives (Modified Versions) on their systems should not see any of the original Reserved Font Names in their font menus, for example. Again, this is to ensure that users are not confused and do not mistake one font for another and so expect features only another derivative or the Original Version can actually offer. + +5.4 Am I not allowed to use any part of the Reserved Font Names? +You may not use individual words from the Reserved Font Names, but you would be allowed to use parts of words, as long as you do not use any word from the Reserved Font Names entirely. We do not recommend using parts of words because of potential confusion, but it is allowed. For example, if "Foobar" was a Reserved Font Name, you would be allowed to use "Foo" or "bar", although we would not recommend it. Such an unfortunate choice would confuse the users of your fonts as well as make it harder for other designers to contribute. + +5.5 So what should I, as an author, identify as Reserved Font Names? +Original authors are encouraged to name their fonts using clear, distinct names, and only declare the unique parts of the name as Reserved Font Names. For example, the author of a font called "Foobar Sans" would declare "Foobar" as a Reserved Font Name, but not "Sans", as that is a common typographical term, and may be a useful word to use in a derivative font name. Reserved Font Names should also be single words for simplicity and legibility. A font called "Flowing River" should have Reserved Font Names "Flowing" and "River", not "Flowing River". You also need to be very careful about reserving font names which are already linked to trademarks (whether registered or not) which you do not own. + +5.6 Do I, as an author, have to identify any Reserved Font Names? +No. RFNs are optional and not required, but we encourage you to use them. This is primarily to avoid confusion between your work and Modified Versions. As an author you can release a font under the OFL and not declare any Reserved Font Names. There may be situations where you find that using no RFNs and letting your font be changed and modified - including any kind of modification - without having to change the original name is desirable. However you need to be fully aware of the consequences. There will be no direct way for end-users and other designers to distinguish your Original Version from many Modified Versions that may be created. You have to trust whoever is making the changes and the optimizations to not introduce problematic changes. The RFNs you choose for your own creation have value to you as an author because they allow you to maintain artistic integrity and keep some control over the distribution channel to your end-users. For discussion of RFNs and web fonts see section 2. + +5.7 Are any names (such as the main font name) reserved by default? +No. That is a change to the license as of version 1.1. If you want any names to be Reserved Font Names, they must be specified after the copyright statement(s). + +5.8 Is there any situation in which I can use Reserved Font Names for a Modified Version? +The Copyright Holder(s) can give certain trusted parties the right to use any of the Reserved Font Names through separate written agreements. For example, even if "Foobar" is a RFN, you could write up an agreement to give company "XYZ" the right to distribute a modified version with a name that includes "Foobar". This allows for freedom without confusion. The existence of such an agreement should be made as clear as possible to downstream users and designers in the distribution package and the relevant documentation. They need to know if they are a party to the agreement or not and what they are practically allowed to do or not even if all the details of the agreement are not public. + +5.9 Do font rebuilds require a name change? Do I have to change the name of the font when my packaging workflow includes a full rebuild from source? +Yes, all rebuilds which change the font data and the smart code are Modified Versions and the requirements of the OFL apply: you need to respect what the Author(s) have chosen in terms of Reserved Font Names. However if a package (or installer) is simply a wrapper or a compressed structure around the final font - leaving them intact on the inside - then no name change is required. Please get in touch with the author(s) and copyright holder(s) to inquire about the presence of font sources beyond the final font file(s) and the recommended build path. That build path may very well be non-trivial and hard to reproduce accurately by the maintainer. If a full font build path is made available by the upstream author(s) please be aware that any regressions and changes you may introduce when doing a rebuild for packaging purposes is your own responsibility as a package maintainer since you are effectively creating a separate branch. You should make it very clear to your users that your rebuilt version is not the canonical one from upstream. + +5.10 Can I add other Reserved Font Names when making a derivative font? +Yes. List your additional Reserved Font Names after your additional copyright statement, as indicated with example placeholders at the top of the OFL.txt file. Be sure you do not remove any existing RFNs but only add your own. RFN statements should be placed next to the copyright statement of the relevant author as indicated in the OFL.txt template to make them visible to designers wishing to make their separate version. + + +6 ABOUT THE FONTLOG + +6.1 What is this FONTLOG thing exactly? +It has three purposes: 1) to provide basic information on the font to users and other designers and developers, 2) to document changes that have been made to the font or accompanying files, either by the original authors or others, and 3) to provide a place to acknowledge authors and other contributors. Please use it! + +6.2 Is the FONTLOG required? +It is not a requirement of the license, but we strongly recommend you have one. + +6.3 Am I required to update the FONTLOG when making Modified Versions? +No, but users, designers and other developers might get very frustrated with you if you don't. People need to know how derivative fonts differ from the original, and how to take advantage of the changes, or build on them. There are utilities that can help create and maintain a FONTLOG, such as the FONTLOG support in FontForge. + +6.4 What should the FONTLOG look like? +It is typically a separate text file (FONTLOG.txt), but can take other formats. It commonly includes these four sections: + +- brief header describing the FONTLOG itself and name of the font family +- Basic Font Information - description of the font family, purpose and breadth +- ChangeLog - chronological listing of changes +- Acknowledgements - list of authors and contributors with contact information + +It could also include other sections, such as: where to find documentation, how to make contributions, information on contributing organizations, source code details, and a short design guide. See Appendix A for an example FONTLOG. + + +7 MAKING CONTRIBUTIONS TO OFL PROJECTS + +7.1 Can I contribute work to OFL projects? +In many cases, yes. It is common for OFL fonts to be developed by a team of people who welcome contributions from the wider community. Contact the original authors for specific information on how to participate in their projects. + +7.2 Why should I contribute my changes back to the original authors? +It would benefit many people if you contributed back in response to what you've received. Your contributions and improvements to the fonts and other components could be a tremendous help and would encourage others to contribute as well and 'give back'. You will then benefit from other people's contributions as well. Sometimes maintaining your own separate version takes more effort than merging back with the original. Be aware that any contributions, however, must be either your own original creation or work that you own, and you may be asked to affirm that clearly when you contribute. + +7.3 I've made some very nice improvements to the font. Will you consider adopting them and putting them into future Original Versions? +Most authors would be very happy to receive such contributions. Keep in mind that it is unlikely that they would want to incorporate major changes that would require additional work on their end. Any contributions would likely need to be made for all the fonts in a family and match the overall design and style. Authors are encouraged to include a guide to the design with the fonts. It would also help to have contributions submitted as patches or clearly marked changes - the use of smart source revision control systems like subversion, mercurial, git or bzr is a good idea. Please follow the recommendations given by the author(s) in terms of preferred source formats and configuration parameters for sending contributions. If this is not indicated in a FONTLOG or other documentation of the font, consider asking them directly. Examples of useful contributions are bug fixes, additional glyphs, stylistic alternates (and the smart font code to access them) or improved hinting. Keep in mind that some kinds of changes (esp. hinting) may be technically difficult to integrate. + +7.4 How can I financially support the development of OFL fonts? +It is likely that most authors of OFL fonts would accept financial contributions - contact them for instructions on how to do this. Such contributions would support future development. You can also pay for others to enhance the fonts and contribute the results back to the original authors for inclusion in the Original Version. + + +8 ABOUT THE LICENSE ITSELF + +8.1 I see that this is version 1.1 of the license. Will there be later changes? +Version 1.1 is the first minor revision of the OFL. We are confident that version 1.1 will meet most needs, but are open to future improvements. Any revisions would be for future font releases, and previously existing licenses would remain in effect. No retroactive changes are possible, although the Copyright Holder(s) can re-release the font under a revised OFL. All versions will be available on our web site: http://scripts.sil.org/OFL. + +8.2 Does this license restrict the rights of the Copyright Holder(s)? +No. The Copyright Holder(s) still retain(s) all the rights to their creation; they are only releasing a portion of it for use in a specific way. For example, the Copyright Holder(s) may choose to release a 'basic' version of their font under the OFL, but sell a restricted 'enhanced' version under a different license. They may also choose to release the same font under both the OFL and some other license. Only the Copyright Holder(s) can do this, and doing so does not change the terms of the OFL as it applies to that font. + +8.3 Is the OFL a contract or a license? +The OFL is a worldwide license based on international copyright agreements and conventions. It is not a contract and so does not require you to sign it to have legal validity. By using, modifying and redistributing components under the OFL you indicate that you accept the license. + +8.4 I really like the terms of the OFL, but want to change it a little. Am I allowed to take ideas and actual wording from the OFL and put them into my own custom license for distributing my fonts? +We strongly recommend against creating your very own unique open licensing model. Using a modified or derivative license will likely cut you off - along with the font(s) under that license - from the community of designers using the OFL, potentially expose you and your users to legal liabilities, and possibly put your work and rights at risk. The OFL went though a community and legal review process that took years of effort, and that review is only applicable to an unmodified OFL. The text of the OFL has been written by SIL (with review and consultation from the community) and is copyright (c) 2005-2013 SIL International. You may re-use the ideas and wording (in part, not in whole) in another non-proprietary license provided that you call your license by another unambiguous name, that you do not use the preamble, that you do not mention SIL and that you clearly present your license as different from the OFL so as not to cause confusion by being too similar to the original. If you feel the OFL does not meet your needs for an open license, please contact us. + +8.5 Can I translate the license and the FAQ into other languages? +SIL certainly recognises the need for people who are not familiar with English to be able to understand the OFL and its use. Making the license very clear and readable has been a key goal for the OFL, but we know that people understand their own language best. + +If you are an experienced translator, you are very welcome to translate the OFL and OFL-FAQ so that designers and users in your language community can understand the license better. But only the original English version of the license has legal value and has been approved by the community. Translations do not count as legal substitutes and should only serve as a way to explain the original license. SIL - as the author and steward of the license for the community at large - does not approve any translation of the OFL as legally valid because even small translation ambiguities could be abused and create problems. + +SIL gives permission to publish unofficial translations into other languages provided that they comply with the following guidelines: + +- Put the following disclaimer in both English and the target language stating clearly that the translation is unofficial: + +"This is an unofficial translation of the SIL Open Font License into <language_name>. It was not published by SIL International, and does not legally state the distribution terms for fonts that use the OFL. A release under the OFL is only valid when using the original English text. However, we recognize that this unofficial translation will help users and designers not familiar with English to better understand and use the OFL. We encourage designers who consider releasing their creation under the OFL to read the OFL-FAQ in their own language if it is available. Please go to http://scripts.sil.org/OFL for the official version of the license and the accompanying OFL-FAQ." + +- Keep your unofficial translation current and update it at our request if needed, for example if there is any ambiguity which could lead to confusion. + +If you start such a unofficial translation effort of the OFL and OFL-FAQ please let us know. + +8.6 Does the OFL have an explicit expiration term? +No, the implicit intent of the OFL is that the permissions granted are perpetual and irrevocable. + + +9 ABOUT SIL INTERNATIONAL + +9.1 Who is SIL International and what do they do? +SIL serves language communities worldwide, building their capacity for sustainable language development, by means of research, translation, training and materials development. SIL makes its services available to all without regard to religious belief, political ideology, gender, race, or ethnic background. SIL's members and volunteers share a Christian commitment. + +9.2 What does this have to do with font licensing? +The ability to read, write, type and publish in one's own language is one of the most critical needs for millions of people around the world. This requires fonts that are widely available and support lesser-known languages. SIL develops - and encourages others to develop - a complete stack of writing systems implementation components available under open licenses. This open stack includes input methods, smart fonts, smart rendering libraries and smart applications. There has been a need for a common open license that is specifically applicable to fonts and related software (a crucial component of this stack), so SIL developed the SIL Open Font License with the help of the Free/Libre and Open Source Software community. + +9.3 How can I contact SIL? +Our main web site is: http://www.sil.org/ +Our site about complex scripts is: http://scripts.sil.org/ +Information about this license (and contact information) is at: http://scripts.sil.org/OFL + + +APPENDIX A - FONTLOG EXAMPLE + +Here is an example of the recommended format for a FONTLOG, although other formats are allowed. + +----- +FONTLOG for the GlobalFontFamily fonts + +This file provides detailed information on the GlobalFontFamily Font Software. This information should be distributed along with the GlobalFontFamily fonts and any derivative works. + +Basic Font Information + +GlobalFontFamily is a Unicode typeface family that supports all languages that use the Latin script and its variants, and could be expanded to support other scripts. + +NewWorldFontFamily is based on the GlobalFontFamily and also supports Greek, Hebrew, Cyrillic and Armenian. + +More specifically, this release supports the following Unicode ranges... +This release contains... +Documentation can be found at... +To contribute to the project... + +ChangeLog + +10 December 2010 (Fred Foobar) GlobalFontFamily-devel version 1.4 +- fix new build and testing system (bug #123456) + +1 August 2008 (Tom Parker) GlobalFontFamily version 1.2.1 +- Tweaked the smart font code (Branch merged with trunk version) +- Provided improved build and debugging environment for smart behaviours + +7 February 2007 (Pat Johnson) NewWorldFontFamily Version 1.3 +- Added Greek and Cyrillic glyphs + +7 March 2006 (Fred Foobar) NewWorldFontFamily Version 1.2 +- Tweaked contextual behaviours + +1 Feb 2005 (Jane Doe) NewWorldFontFamily Version 1.1 +- Improved build script performance and verbosity +- Extended the smart code documentation +- Corrected minor typos in the documentation +- Fixed position of combining inverted breve below (U+032F) +- Added OpenType/Graphite smart code for Armenian +- Added Armenian glyphs (U+0531 -> U+0587) +- Released as "NewWorldFontFamily" + +1 Jan 2005 (Joe Smith) GlobalFontFamily Version 1.0 +- Initial release + +Acknowledgements + +If you make modifications be sure to add your name (N), email (E), web-address (if you have one) (W) and description (D). This list is in alphabetical order. + +N: Jane Doe +E: jane@university.edu +W: http://art.university.edu/projects/fonts +D: Contributor - Armenian glyphs and code + +N: Fred Foobar +E: fred@foobar.org +W: http://foobar.org +D: Contributor - misc Graphite fixes + +N: Pat Johnson +E: pat@fontstudio.org +W: http://pat.fontstudio.org +D: Designer - Greek & Cyrillic glyphs based on Roman design + +N: Tom Parker +E: tom@company.com +W: http://www.company.com/tom/projects/fonts +D: Engineer - original smart font code + +N: Joe Smith +E: joe@fontstudio.org +W: http://joe.fontstudio.org +D: Designer - original Roman glyphs + +Fontstudio.org is an not-for-profit design group whose purpose is... +Foobar.org is a distributed community of developers... +Company.com is a small business who likes to support community designers... +University.edu is a renowned educational institution with a strong design department... +----- + diff --git a/public_html/fonts/Terminus-Bold.ttf b/public_html/fonts/Terminus-Bold.ttf Binary files differ. diff --git a/public_html/fonts/Terminus-Italic.ttf b/public_html/fonts/Terminus-Italic.ttf Binary files differ. diff --git a/public_html/fonts/Terminus.ttf b/public_html/fonts/Terminus.ttf Binary files differ. diff --git a/public_html/fonts/__MACOSX/._Now-Black.otf b/public_html/fonts/__MACOSX/._Now-Black.otf Binary files differ. diff --git a/public_html/fonts/__MACOSX/._Now-Bold.otf b/public_html/fonts/__MACOSX/._Now-Bold.otf Binary files differ. diff --git a/public_html/fonts/__MACOSX/._Now-Light.otf b/public_html/fonts/__MACOSX/._Now-Light.otf Binary files differ. diff --git a/public_html/fonts/__MACOSX/._Now-Medium.otf b/public_html/fonts/__MACOSX/._Now-Medium.otf Binary files differ. diff --git a/public_html/fonts/__MACOSX/._Now-Regular.otf b/public_html/fonts/__MACOSX/._Now-Regular.otf Binary files differ. diff --git a/public_html/fonts/__MACOSX/._Now-Thin.otf b/public_html/fonts/__MACOSX/._Now-Thin.otf Binary files differ. diff --git a/public_html/fonts/__MACOSX/._OFL-FAQ.txt b/public_html/fonts/__MACOSX/._OFL-FAQ.txt Binary files differ. diff --git a/public_html/fonts/cyber.ttf b/public_html/fonts/cyber.ttf Binary files differ. diff --git a/public_html/fonts/digital_counter_7.ttf b/public_html/fonts/digital_counter_7.ttf Binary files differ. diff --git a/public_html/fonts/fonts/Terminus-Bold.ttf b/public_html/fonts/fonts/Terminus-Bold.ttf Binary files differ. diff --git a/public_html/fonts/fonts/Terminus-Italic.ttf b/public_html/fonts/fonts/Terminus-Italic.ttf Binary files differ. diff --git a/public_html/fonts/fonts/Terminus.ttf b/public_html/fonts/fonts/Terminus.ttf Binary files differ. diff --git a/public_html/fonts/fonts/lmmono10-italic.otf b/public_html/fonts/fonts/lmmono10-italic.otf Binary files differ. diff --git a/public_html/fonts/fonts/lmmono10-regular.otf b/public_html/fonts/fonts/lmmono10-regular.otf Binary files differ. diff --git a/public_html/fonts/fonts/roberta.ttf b/public_html/fonts/fonts/roberta.ttf Binary files differ. diff --git a/public_html/fonts/lmmono10-italic.otf b/public_html/fonts/lmmono10-italic.otf Binary files differ. diff --git a/public_html/fonts/lmmono10-regular.otf b/public_html/fonts/lmmono10-regular.otf Binary files differ. diff --git a/public_html/fonts/now.zip b/public_html/fonts/now.zip Binary files differ. diff --git a/public_html/fonts/retro.ttf b/public_html/fonts/retro.ttf Binary files differ. diff --git a/public_html/fonts/roberta.ttf b/public_html/fonts/roberta.ttf Binary files differ. diff --git a/public_html/mobile.css b/public_html/mobile.css @@ -0,0 +1,182 @@ +/* mobile styles */ +@font-face{ + font-family: "Terminus-Bold"; + src: url('../fonts/Terminus-Bold.ttf'), + url('../fonts/Terminus-Bold.ttf'); /* IE */ + } + +@font-face{ + font-family: "Terminus"; + src: url('../fonts/Terminus.ttf'), + url('../fonts/Terminus.ttf'); /* IE */ + } + +body +{ + margin:0px; + border:0px; + text-align: center; + background-color:#440044; + background-repeat:no-repeat; + text-decoration: none; + font-style: normal; + color: #f4f4f4; + font-family: 'Terminus', sans-serif; + font-size: 18px; + -webkit-font-smoothing: antialiased; +} + + +a +{ + color:#fff; +} + + +div.story1 +{ + background-color:#1D0E1D; + font-weight: normal; + font-style: normal; + font-size: 16px; + height: auto; + margin-top: 7px; + margin-bottom: 1px; + padding-left: 2%; + padding-right: 2%; + border-radius:10px; + padding-bottom: 15px; +} + +div.metawindow +{ + margin: 0px auto; + height: 40px; +} + +video +{ + width: 100%; +} + +#default +{ + padding-top: 50px; + margin:0 auto; + width:80%; + padding-bottom: 50px; +} + +#navigation +{ + background-color: #231f20; + position: fixed; + font-weight: bold; + font-size: 15px; + text-align: center; + padding-top:10px; + padding-bottom: 10px; + top: 0px; + height: auto; + width: 100%; +} + +#navigation ul +{ + margin: 0px auto; + padding: 0px; + text-align: center; + width: auto; +} + +#navigation ul li +{ + list-style-type: none; + display: inline; + background-color: #231f20; + padding: 0px; + padding-bottom: 0px; + border-radius: 4px; +} + +#navigation li a +{ + display: inline; + list-style: none; + padding: 4px; + color:##f4f4f4; + text-decoration: none; + border-radius: 4px; +} + +#navigation li a:hover { background:#7A2939; } + +#container +{ + margin: 0px auto; + width:100%; +} + + +#top +{ + padding-top:60px; +} + +#titel +{ + font-family: 'Terminus-Bold', sans-serif; + font-size: 35px; +} + +#citat +{ + font-size: 15px; + padding-bottom: 20px; +} + +#one, #two, #three, #four +{ + margin: 0 auto; + text-align: left; + width: 90%; + padding-top: 50px; + +} + + +img +{ + max-width: 100%; + height: auto; +} + +#spacer +{ + height:100px; +} + +#robin +{ + background-color:#3399FF; + padding-bottom: 20px; + margin: 0px auto; + font-weight: normal; + text-align: center; +} + +#footer +{ + margin: 0 auto; + background-color:#231f20; + font-weight: normal; + font-size: 15px; + padding-top:5px; + height: auto; + width: 100%; + position: fixed; + bottom: 0px; + +} + + diff --git a/public_html/robstyle.css b/public_html/robstyle.css @@ -0,0 +1,700 @@ +@font-face{ + font-family: "Latin-Mono-Regular"; + src: url('fonts/lmmono10-regular.otf'), + url('fonts/lmmono10-regular.otf'); /* IE */ + } + +@font-face{ + font-family: "Latin-Mono-Italic"; + src: url('fonts/lmmono10-italic.otf'), + url('fonts/lmmono10-italic.otf'); /* IE */ + } + +@font-face{ + font-family: "Roberta"; + src: url('fonts/roberta.ttf'), + url('fonts/roberta.ttf'); /* IE */ + } + +@font-face{ + font-family: "Digital"; + src: url('fonts/digital_counter_7.ttf'), + url('fonts/digital_counter_7.ttf'); /* IE */ + } +@font-face{ + font-family: "Retro"; + src: url('fonts/retro.ttf'), + url('fonts/retro.ttf'); /* IE */ + } +@font-face{ + font-family: "Cyber"; + src: url('fonts/cyber.ttf'), + url('fonts/cyber.ttf'); /* IE */ + } + +body +{ + margin:0 auto; + border:0px; + text-align: center; + background-color:#242021; + font-family: 'Latin-Mono-Regular', sans-serif; + font-weight: normal; + color: #f4f4f4; + word-wrap: break-word; + font-size: 12pt; +} + +a +{ + color:#FFBA00; + text-decoration: none; +} + +a:hover +{ + color: #fcdd09; + padding: 2px; +} + +h1 +{ + padding: 0px; + margin: 0px; + font-size: 71pt; + color:#f8f9fa; + font-family: 'Roberta', sans-serif; + line-height: 75px; + font-weight: normal; +} + +h2 +{ + padding: 0px; + margin: 0px; + font-size: 20pt; + font-family: 'Latin-Mono-Italic', sans-serif; + font-weight: normal; +} + + +h3 +{ + padding: 0px; + margin: 0px; + font-size: 50pt; + line-height: 45px; + color:#f8f9fa; + text-transform:uppercase; + font-family: 'Roberta', sans-serif; + font-weight: normal; +} + +h4 +{ + padding: 0px; + margin: 0px; + font-size: 21pt; + font-family: 'Cyber', sans-serif; + font-weight: normal; +} + +h5 +{ + padding: 0px; + margin: 20px; + color:#f8f9fa; + font-size: 17pt; + line-height: 0px; + font-family: 'Retro', sans-serif; + font-weight: normal; +} + +h6 +{ + padding: 0px; + margin: 0px; + font-size: 12pt; + font-family: 'Digital', sans-serif; + font-weight: normal; +} + + +table +{ + padding: 0px; + margin: 0px auto; + width: 80%; + font-style: normal; + font-weight: normal; + +} + +td { + display: block; + clear:both; + } + +th { + display: block; + clear:both; + } + +video +{ + width: 100%; +} + +input +{ + width: 70%; + height: 30px; + border: 0px solid; + color: #fff; + padding-left: 5px; + padding-right: 5px; + background-color:#555; + border-radius: 3px; +} + +button +{ + color: #fff; + border-radius: 3px; + font-size: 14pt; + background-color: #444; + border: 0px; + padding: 5px; + height: 30px; + width: 20%; +} + +button:hover +{ + + background-color: #ff0000; +} + +blockquote { +font-size: 1.5em; +margin: 20px 0; +padding: 10px; +border-left: 5px solid #ccc; +font-style: italic; +} + +blockquote::before { +content: "“"; +font-size: 2em; +color: #ccc; +} + +blockquote::after { +content: "”"; +font-size: 2em; +color: #ccc; +} + +code { + background: #282c34; + color: #abb2bf; + padding: 2px; + border-radius: 2px; + overflow-x: auto; + font-family: monospace; + margin: 0.5rem 0; +} + +pre code { + font-family: inherit; +} +.insert-link { + color: #0066cc; + text-decoration: underline; + margin-right: 20px; + cursor: pointer; + font-size: 16px; +} +.insert-link:hover { + color: #004499; +} + +.introtext img +{ + width: auto; +} + +img +{ + border-radius: 3px; + width: 95%; +} + +.introtext img +{ + width: auto; + word-wrap:break-word; +} + +#visitors img +{ + border-radius: 0px; + width: auto; + max-width: auto; +} + +#container +{ + margin: 0px auto; + height: auto; + width: 450px; + text-align: center; + word-wrap:break-word; +} + +#propaganda-container +{ + margin: 0px auto; + height: auto; + max-width: 1500px; + text-align: center; + word-wrap:break-word; +} + +.promopic { + position: relative; + color: white; +} + +.promotext { + position: absolute; + text-align: right; + top: 10%; + left: 10%; + transform: translate(-10%, -10%); + width: 400px; +} + +.bild +{ + + background-color: #29252b; + border-radius: 5px; +} +.bild p +{ + font-size: 14px; + margin:0px; +} +.bild h4 +{ + padding:5px; +} + +#album +{ + margin: 0px auto; + height: auto; + width: 90%; + max-width: 900px; +} + +#default +{ + margin: 0 auto; + padding-top: 5px; + width: 95%; + max-width: 400px; + height: auto; +} + +#logo +{ + padding-top: 5px; + width: 95%; + padding-bottom: 6px; +} + +#tools +{ + font-family: 'Roberta', sans-serif; + font-size:25pt; + padding-bottom: 10px; +} + +#shoutbox +{ + text-align: left; + padding-left: 5%; + padding-top: 10px; + padding-bottom: 20px; +} + +#shoutbox p +{ + margin: 2px; +} + +#matrix-shoutbox +{ + margin-top: 10px; +} + +#matrix-shoutbox img +{ + width: 90%; +} + +#time +{ + font-size: 8pt; + color: #98ffff; +} + +#msg +{ + font-size: 11pt; + color: #98ffff; +} + +#top +{ + margin: 0 auto; + text-align: center; + height: 60vh; + width: 50%; +} + +#robin +{ + background-color:#3B6861; + padding-bottom: 100px; + margin: 0px auto; + font-weight: normal; + font-size: 16px; + text-align: center; +} + +#footer +{ + position: fixed; + margin: 0 auto; + background-color:#231f20; + font-weight: normal; + font-size: 17px; + bottom:0px; + padding-top:10px; + height:30px; + width: 100%; +} + +#onair +{ + font-size: 30px; + color: #DB232C; + opacity: 0.2; +} + +#tipjar img +{ + max-width: 350px; + padding:2px; + background-color:#fff; + width: 35%; + border-radius: 2px; +} +#onair.neon {opacity: 1} +#onair.neonoff {opacity: 0.2} + +#onairvideo +{ + font-family: "Digital"; + font-size: 14px; + color: #032604; + opacity: 0.5; + text-align: center; + padding-top: 5px; + padding-bottom: 5px; +} + +#onairvideo.neongreen {opacity: 1} +#onairvideo.neongreenoff {opacity: 0.2} + +#song { + font-family: "Digital"; + font-size: 15px; + color: #fcdd09; + opacity: 0.5; + text-align: center; + padding-top: 10px; +} + +#lyssnare { + font-family: "Digital"; + font-size: 15px; + color: #7CFC00; + opacity: 0.5; + text-align: center; + padding-top: 10px; +} + +#bag +{ + margin: 0px auto; + position:fixed; + color:#fff; + top:0; + width:100%; + background:#0A5200; +} + +#insidebag +{ + margin: 10px auto; + font-size: 14px; + width:100%; +} + +table, tbody, tr, td +{ + width: 100%; +} + +input, select +{ + padding: 4px; + color: #fff; + background-color: #555; + font-size: 16px; + border: 0px; +} + +textarea +{ + padding: 4px; + color: #fff; + background-color: #555; + font-size: 16px; + border: 0px; + width: 100%; + height: 30px; +} + +button +{ + margin:10px; + padding: 4px; + font-size: 18px; + color: #fff; + background-color: #333; + width: 90%; +} + +pre +{ + white-space: pre-wrap; /* Since CSS 2.1 */ + white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + word-wrap: break-word; /* Internet Explorer 5.5+ */ +} + +.logo +{ + width: 80%; + height:auto; +} + +.logo2 +{ + width: 70%; + height:auto; +} + +.intro +{ + margin: 10px auto; + scroll-margin-top: 10rem; + padding: 10px; + border-radius:5px; + padding-bottom: 20px; +} + +.product +{ + margin: 10px auto; + scroll-margin-top: 10rem; + width: 80%; + padding: 10px; + border-radius:5px; + background-color:#333; + padding-bottom: 20px; +} + +.editproduct +{ + margin: 1px; + display:inline-block; + border-radius:5px; + background-color:#333; +} + +.orders +{ + margin:0 auto; + background-color:#333; + font-weight: normal; + font-style: normal; + font-size: 15px; + padding-top: 5px; + padding-left: 20px; + padding-right: 20px; + text-align: left; + height: auto; + width: 90%; + padding-bottom: 20px; + border-radius:5px; +} + +.imgprod +{ + border-radius:5px; +} + +#payid +{ + margin: 0px auto; + color: #888; + text-decoration: normal; + background-color: #111; + border: 0px; + width: 100%; + font-size: 10px; + text-align: center; + white-space: pre-wrap; /* CSS3 */ + white-space: -moz-pre-wrap; /* Firefox */ + white-space: -pre-wrap; /* Opera <7 */ + white-space: -o-pre-wrap; /* Opera 7 */ + word-wrap: break-word; /* IE */ +} + +#payreq +{ + margin: 0px auto; + color: #888; + background-color: #111; + border: 0px; + width: 100%; + height: 55px; + font-size: 10px; + text-align: center; + white-space: pre-wrap; /* CSS3 */ + white-space: -moz-pre-wrap; /* Firefox */ + white-space: -pre-wrap; /* Opera <7 */ + white-space: -o-pre-wrap; /* Opera 7 */ + word-wrap: break-word; /* IE */ +} + +#copybutton +{ + color: #fff; + text-decoration: bold; + background-color: #111; + border: 0px; + padding: 5px; + width: auto; +} + +#backbutton +{ + color: #fff; + text-decoration: bold; + background-color: #111; + border: 0px; + padding: 5px; + width: auto; +} + +#description +{ + height:800px; + font-size: 12px; +} + +#description2 +{ + height:800px; + font-size: 12px; +} + +.neonoff { + font-family: "Latin-Mono-Regular"; + color: #DB232C; + text-transform: uppercase; + text-align: center; + opacity: 0.2; + } + +.neon { + font-family: "Roberta"; + color: #DB232C; + text-align: center; + opacity: 1; + } + +.neon { + animation: neon 20.9s infinite alternate; + -moz-animation: neon 20.9s infinite alternate; + -webkit-animation: neon 20.9s infinite alternate; +} + +.neongreenoff { + font-family: "Digital"; + color: #23db29; + text-transform: uppercase; + text-align: center; + opacity: 0.2; + } + +.neongreen { + font-family: "Digital"; + color: #D2974E; + text-transform: uppercase; + text-align: center; + opacity: 1; + } + +.neongreen { + animation: neongreen 20.9s infinite alternate; + -moz-animation: neongreen 20.9s infinite alternate; + -webkit-animation: neongreen 20.9s infinite alternate; +} + +@keyframes neon { + 0%, 19%, 21%, 23%, 25%, 14%, 6%, 10% { + text-shadow: 0 0 1vw #FA1C16, 0 0 3vw #FA1C16, 0 0 10vw #FA1C16, 0 0 10vw #FA1C16; + color: #DB232C; + } + 50% { + text-shadow: 0 0 .5vw #800E0B, 0 0 1.5vw #800E0B, 0 0 5vw #800E0B, 0 0 5vw #800E0B; + } + 20%, 24%, 55% { + text-shadow: none; + box-shadow: none; + } + } + +@keyframes neongreen { + 0%, 19%, 21%, 23%, 25%, 14%, 26%, 10% { + text-shadow: 0 0 1vw #16fa1e, 0 0 3vw #16fa1e, 0 0 10vw #16fa1e, 0 0 10vw #16fa1e; + color: #26db23; + } + 50% { + text-shadow: 0 0 .5vw #0d7f0b, 0 0 1.5vw #0d7f0b, 0 0 5vw #0d7f0b, 0 0 5vw #0d7f0b; + } + 2%, 14%, 5% { + text-shadow: none; + box-shadow: none; + } + } + diff --git a/public_html/scrollcookie.js b/public_html/scrollcookie.js @@ -0,0 +1,9 @@ +$(window).on("scroll", function() { + $.cookie("tempScrollTop", $(window).scrollTop()); +}); +$(function() { + if ($.cookie("tempScrollTop")) { + $(window).scrollTop($.cookie("tempScrollTop")); + alert("loaded postion : " + $.cookie("tempScrollTop")); + } +}); diff --git a/public_html/splash.css b/public_html/splash.css @@ -0,0 +1,754 @@ +@font-face{ + font-family: "Latin-Mono-Regular"; + src: url('fonts/lmmono10-regular.otf'), + url('fonts/lmmono10-regular.otf'); /* IE */ + } + +@font-face{ + font-family: "Latin-Mono-Italic"; + src: url('fonts/lmmono10-italic.otf'), + url('fonts/lmmono10-italic.otf'); /* IE */ + } + +@font-face{ + font-family: "Roberta"; + src: url('fonts/roberta.ttf'), + url('fonts/roberta.ttf'); /* IE */ + } + +@font-face{ + font-family: "Digital"; + src: url('fonts/digital_counter_7.ttf'), + url('fonts/digital_counter_7.ttf'); /* IE */ + } +@font-face{ + font-family: "Retro"; + src: url('fonts/retro.ttf'), + url('fonts/retro.ttf'); /* IE */ + } +@font-face{ + font-family: "Cyber"; + src: url('fonts/cyber.ttf'), + url('fonts/cyber.ttf'); /* IE */ + } + +body +{ + margin:0 auto; + border:0px; + text-align: left; + background-color:#242021; + font-family: 'Latin-Mono-Regular', sans-serif; + font-weight: normal; + color: #f4f4f4; + font-size: 12pt; +} + +a +{ + color:#FFBA00; + text-decoration: none; +} + +a:hover +{ + color: #fcdd09; + padding: 2px; +} + +h1 +{ + padding: 0px; + margin: 0px; + font-size: 100px; + color:#f8f9fa; + font-family: 'Roberta', sans-serif; + line-height: 75px; + font-weight: normal; +} + +h2 +{ + padding: 0px; + margin: 0px; + font-size: 40pt; + line-height: 40px; + font-family: 'Latin-Mono-Italic', sans-serif; + font-weight: normal; +} + + +h3 +{ + padding: 0px; + margin: 0px; + font-size: 50pt; + line-height: 50px; + color:#f8f9fa; + text-transform:uppercase; + font-family: 'Roberta', sans-serif; + font-weight: normal; +} + +h4 +{ + padding: 0px; + margin: 0px; + font-size: 35pt; + line-height: 40px; + font-family: 'Cyber', sans-serif; + font-weight: normal; +} + +h5 +{ + padding: 0px; + margin-top: 10px; + margin-left: 0px; + margin-right: 0px; + margin-bottom: 10px; + color:#f8f9fa; + font-size: 35pt; + line-height: 40px; + font-family: 'Retro', sans-serif; + font-weight: normal; +} + +h6 +{ + padding: 0px; + margin: 0px; + font-size: 30pt; + font-family: 'Digital', sans-serif; + font-weight: normal; +} + + +table +{ + padding: 0px; + margin: 0px auto; + width: 80%; + font-style: normal; + font-weight: normal; + +} + +td { + display: block; + clear:both; + } + +th { + display: block; + clear:both; + } + +video +{ + width: 100%; +} + +input +{ + width: 70%; + height: 30px; + border: 0px solid; + color: #fff; + padding-left: 5px; + padding-right: 5px; + background-color:#555; + border-radius: 3px; +} + +button +{ + color: #fff; + border-radius: 3px; + font-size: 14pt; + font-family: 'Roberta', sans-serif; + background-color: #444; + border: 0px; + padding: 5px; + height: 30px; + width: 20%; +} + +button:hover +{ + + background-color: #ff0000; +} + +blockquote { +font-size: 1.5em; +margin: 20px 0; +padding: 10px; +border-left: 5px solid #ccc; +font-style: italic; +} + +blockquote::before { +content: "“"; +font-size: 2em; +color: #ccc; +} + +blockquote::after { +content: "”"; +font-size: 2em; +color: #ccc; +} + +#rendered { + width: 455px; /* Always 455px */ +} + +code { + background: #282c34; + color: #abb2bf; + font-size: 8pt; + padding: 2px; + border-radius: 2px; + min-width: 455px; + width: 455px; /* Always 455px */ + min-width: 455px; /* Prevents shrinking */ + max-width: 455px; /* Prevents growing */ + box-sizing: border-box; /* Includes padding & border in the width */ + overflow-x: auto; + font-family: monospace; + text-align: left; + margin: 0.5rem 0; + /* Key properties for respecting line breaks */ + white-space: pre-wrap; /* preserves whitespace + wraps long lines */ + word-break: break-all; /* optional: breaks very long words */ + tab-size: 4; /* nice tab spacing */ +} + +pre code { + font-family: inherit; +} +.insert-link { + color: #0066cc; + text-decoration: underline; + margin-right: 20px; + cursor: pointer; + font-size: 16px; +} +.insert-link:hover { + color: #004499; +} + + +video +{ + border-radius: 10px; + width: 100%; +} + +img +{ + border-radius: 10px; + width: 100%; +} + +#visitors img +{ + border-radius: 0px; + width: auto; + max-width: auto; +} + +#container +{ + margin: 0px auto; + height: auto; +} + +#propaganda-container +{ + margin: 0px auto; + height: auto; + width: 90%; +} + +.introtext +{ + margin: 0px auto; + width: 100%; + height: auto; + max-width: 455px; +} + +.promotext +{ + margin: 0px auto; + width: 50%; + height: auto; + max-width: 400px; +} + +.heartpost +{ + + background-color: #222223; + border-radius: 5px; + padding-top:5px; + padding-left:10px; + padding-right:10px; + padding-bottom:1px; +} + +.usrimg +{ + max-width: 25px; + max-height: 25px; +} + +.postmenu +{ + text-align:right; +} + +#search +{ + placeholder: "search..."; + padding: 0px; + width: 55%; +} + +.bild +{ + + background-color: #29252b; + border-radius: 5px; +} +.bild p +{ + font-size: 14px; + margin:0px; +} +.bild h4 +{ + padding:5px; +} + +#album +{ + margin: 0px auto; + height: auto; + width: 90%; + max-width: 900px; +} + +#default +{ + margin: 0 auto; + padding-top: 5px; + width: 100%; + max-width: 400px; + height: auto; +} + +#logo +{ + padding-top: 5px; + width: 95%; + padding-bottom: 6px; +} + +#tools +{ + font-family: 'Roberta', sans-serif; + font-size:25pt; + padding-bottom: 10px; +} + +#shoutbox +{ + padding-left: 5%; + padding-top: 10px; + padding-bottom: 20px; +} + +#shoutbox p +{ + margin: 2px; +} + +#matrix-shoutbox +{ + margin-top: 10px; +} + +#matrix-shoutbox img +{ + width: 90%; +} + +#time +{ + font-size: 8pt; + color: #98ffff; +} + +#msg +{ + font-size: 11pt; + color: #98ffff; +} + +#top +{ + margin: 0 auto; + height: 60vh; + width: 50%; +} + +#robin +{ + background-color:#3B6861; + padding-bottom: 100px; + margin: 0px auto; + font-weight: normal; + font-size: 16px; +} + +#footer +{ + position: fixed; + margin: 0 auto; + background-color:#231f20; + font-weight: normal; + font-size: 17px; + bottom:0px; + padding-top:10px; + height:30px; + width: 100%; +} + +#onair +{ + font-size: 30px; + color: #DB232C; + opacity: 0.2; +} + +#tipjar img +{ + max-width: 350px; + padding:2px; + background-color:#fff; + width: 35%; + border-radius: 2px; +} +#onair.neon {opacity: 1} +#onair.neonoff {opacity: 0.2} + +#onairvideo +{ + font-family: "Digital"; + font-size: 14px; + color: #032604; + opacity: 0.5; + padding-top: 5px; + padding-bottom: 5px; +} + +#onairvideo.neongreen {opacity: 1} +#onairvideo.neongreenoff {opacity: 0.2} + +#song { + font-family: "Digital"; + font-size: 15px; + color: #fcdd09; + opacity: 0.5; + text-align: center; + padding-top: 10px; +} + +#lyssnare { + font-family: "Digital"; + font-size: 15px; + color: #7CFC00; + opacity: 0.5; + text-align: center; + padding-top: 10px; +} + +#bag +{ + margin: 0px auto; + position:fixed; + color:#fff; + top:0; + width:100%; + background:#0A5200; +} + +#insidebag +{ + margin: 10px auto; + font-size: 14px; + width:100%; +} + +table, tbody, tr, td +{ + width: 100%; +} + +input, select +{ + padding: 4px; + color: #fff; + background-color: #555; + font-size: 16px; + border: 0px; +} + +textarea +{ + padding: 4px; + color: #fff; + background-color: #555; + font-size: 16px; + border: 0px; + width: 100%; + height: 20px; +} + +button +{ + margin:10px; + padding: 4px; + font-size: 18px; + color: #fff; + background-color: #333; + width: 90%; +} + +pre +{ + white-space: pre-wrap; /* Since CSS 2.1 */ + white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + word-wrap: break-word; /* Internet Explorer 5.5+ */ +} + +.logo +{ + width: 80%; + height:auto; +} + +.logo2 +{ + width: 70%; + height:auto; +} + +.intro +{ + margin: 10px auto; + scroll-margin-top: 10rem; + padding: 10px; + border-radius:5px; + padding-bottom: 20px; +} + +.product +{ + margin: 10px auto; + scroll-margin-top: 10rem; + width: 80%; + padding: 10px; + border-radius:5px; + background-color:#333; + padding-bottom: 20px; +} + +.editproduct +{ + margin: 1px; + display:inline-block; + border-radius:5px; + background-color:#333; +} + +.orders +{ + margin:0 auto; + background-color:#333; + font-weight: normal; + font-style: normal; + font-size: 15px; + padding-top: 5px; + padding-left: 20px; + padding-right: 20px; + text-align: left; + height: auto; + width: 90%; + padding-bottom: 20px; + border-radius:5px; +} + +.imgprod +{ + border-radius:5px; +} + +#payid +{ + margin: 0px auto; + color: #888; + text-decoration: normal; + background-color: #111; + border: 0px; + width: 100%; + font-size: 10px; + text-align: center; + white-space: pre-wrap; /* CSS3 */ + white-space: -moz-pre-wrap; /* Firefox */ + white-space: -pre-wrap; /* Opera <7 */ + white-space: -o-pre-wrap; /* Opera 7 */ + word-wrap: break-word; /* IE */ +} + +#payreq +{ + margin: 0px auto; + color: #888; + background-color: #111; + border: 0px; + width: 100%; + height: 55px; + font-size: 10px; + text-align: center; + white-space: pre-wrap; /* CSS3 */ + white-space: -moz-pre-wrap; /* Firefox */ + white-space: -pre-wrap; /* Opera <7 */ + white-space: -o-pre-wrap; /* Opera 7 */ + word-wrap: break-word; /* IE */ +} + +#copybutton +{ + color: #333; + text-decoration: bold; + background-color: #111; + border: 0px; + padding: 5px; + width: auto; +} + +#backbutton +{ + color: #333; + text-decoration: bold; + background-color: #111; + border: 0px; + padding: 5px; + width: auto; +} + +#description +{ + height:300px; +} + +#description2 +{ + height:300px; +} + +.megalike { + display: inline-block; + border-radius: 50%; /* Makes it round */ + font-size: 15px; /* Size of the emoji */ + cursor: pointer; + transition: transform 0.2s; + user-select: none; + +} + +.megalike:hover { + transform: scale(1.1); +} + +.megalike:active { + transform: scale(0.98); +} + +.neonoff { + font-family: "Latin-Mono-Regular"; + color: #DB232C; + text-transform: uppercase; + text-align: center; + opacity: 0.2; + } + +.neon { + font-family: "Roberta"; + color: #DB232C; + text-align: center; + opacity: 1; + } + +.neon { + animation: neon 20.9s infinite alternate; + -moz-animation: neon 20.9s infinite alternate; + -webkit-animation: neon 20.9s infinite alternate; +} + +.neongreenoff { + font-family: "Digital"; + color: #23db29; + text-transform: uppercase; + text-align: center; + opacity: 0.2; + } + +.neongreen { + font-family: "Digital"; + color: #D2974E; + text-transform: uppercase; + text-align: center; + opacity: 1; + } + +.neongreen { + animation: neongreen 20.9s infinite alternate; + -moz-animation: neongreen 20.9s infinite alternate; + -webkit-animation: neongreen 20.9s infinite alternate; +} + +@keyframes neon { + 0%, 19%, 21%, 23%, 25%, 14%, 6%, 10% { + text-shadow: 0 0 1vw #FA1C16, 0 0 3vw #FA1C16, 0 0 10vw #FA1C16, 0 0 10vw #FA1C16; + color: #DB232C; + } + 50% { + text-shadow: 0 0 .5vw #800E0B, 0 0 1.5vw #800E0B, 0 0 5vw #800E0B, 0 0 5vw #800E0B; + } + 20%, 24%, 55% { + text-shadow: none; + box-shadow: none; + } + } + +@keyframes neongreen { + 0%, 19%, 21%, 23%, 25%, 14%, 26%, 10% { + text-shadow: 0 0 1vw #16fa1e, 0 0 3vw #16fa1e, 0 0 10vw #16fa1e, 0 0 10vw #16fa1e; + color: #26db23; + } + 50% { + text-shadow: 0 0 .5vw #0d7f0b, 0 0 1.5vw #0d7f0b, 0 0 5vw #0d7f0b, 0 0 5vw #0d7f0b; + } + 2%, 14%, 5% { + text-shadow: none; + box-shadow: none; + } + } + diff --git a/public_html/style.css b/public_html/style.css @@ -0,0 +1,251 @@ +@font-face{ +font-family: "Latin-Mono-Regular"; +src: url('fonts/lmmono10-regular.otf'), +url('fonts/lmmono10-regular.otf'); /* IE */ +} + +@font-face{ +font-family: "Latin-Mono-Italic"; +src: url('fonts/lmmono10-italic.otf'), +url('fonts/lmmono10-italic.otf'); /* IE */ +} + +@font-face{ +font-family: "Roberta"; +src: url('fonts/roberta.ttf'), +url('fonts/roberta.ttf'); /* IE */ +} + +/*use line-height*/ +.font{ + line-height: 1px; + letter-spacing: 1px; +} + +@viewport +{ + width: device-width ; + zoom: 1.0 ; +} + +body +{ + margin: 20px auto; + scroll-behavior: smooth; + font-size: 16px; + width: 100%; + text-align: center; + background-color:#000; + color: #f5f5f5; + font-family: "Latin-Mono-Regular"; +} + +p{ + margin:1px 0; +} + +h1{ + margin:1px 0; + font-size: 60px; + font-family: "Roberta"; + font-style: none; + line-height: 42px; + font-margin: 0px; +} + +h2{ + margin:1px 0; + color:#FCD612; + font-size: 30px; + font-family: "Latin-Mono-Regular"; + line-height: 30px; + font-margin: 0px; +} +h3{ + margin:1px 0; + font-size: 30px; + font-family: "Latin-Mono-Regular"; + font-style: none; +} +h4{ + margin:1px 0; + font-size: 20px; + font-family: "Latin-Mono-Italic"; + font-style: none; +} + +a{ + color:#FCD612; +} + +#logocontainer +{ + margin: 0px auto; + width: 100%; + height: 100%; + text-align: center; + vertical-align: middle; +} + +#container +{ + margin: 0px auto; + max-width: 450px; + width: 100%; + text-align: center; + vertical-align: middle; +} + +#bag +{ + margin: 0px auto; + position:fixed; + color:#fff; + top:0; + width:100%; + background:#555; +} + +#insidebag +{ + margin: 10px auto; + font-size: 14px; + width:100%; +} + +table, tbody, tr, td +{ + width: 100%; +} + +input, select +{ + padding: 4px; + color: #fff; + background-color: #555; + font-size: 16px; + border: 0px; +} + +textarea +{ + padding: 4px; + color: #fff; + background-color: #555; + font-size: 16px; + border: 0px; + width: 100%; + height: 20px; +} + +button +{ + margin:10px; + padding: 4px; + font-size: 18px; + color: #ff0000; + background-color: #222; + width: 90%; +} + +.logo +{ + width: 80%; + height:auto; +} + +.logo2 +{ + width: 70%; + height:auto; +} + +.product +{ + scroll-margin-top: 10rem; +} + +.orders +{ + margin:0 auto; + background-color:#333; + font-weight: normal; + font-style: normal; + font-size: 15px; + padding-top: 5px; + padding-left: 20px; + padding-right: 20px; + text-align: left; + height: auto; + width: 90%; + padding-bottom: 20px; + border-radius:5px; +} + +.imgprod +{ + border-radius:5px; +} +#payid +{ + margin: 0px auto; + color: #888; + text-decoration: normal; + background-color: #111; + border: 0px; + width: 100%; + font-size: 10px; + text-align: center; + white-space: pre-wrap; /* CSS3 */ + white-space: -moz-pre-wrap; /* Firefox */ + white-space: -pre-wrap; /* Opera <7 */ + white-space: -o-pre-wrap; /* Opera 7 */ + word-wrap: break-word; /* IE */ +} + +#payreq +{ + margin: 0px auto; + color: #888; + background-color: #111; + border: 0px; + width: 100%; + height: 55px; + font-size: 10px; + text-align: center; + white-space: pre-wrap; /* CSS3 */ + white-space: -moz-pre-wrap; /* Firefox */ + white-space: -pre-wrap; /* Opera <7 */ + white-space: -o-pre-wrap; /* Opera 7 */ + word-wrap: break-word; /* IE */ +} + +#copybutton +{ + color: #333; + text-decoration: bold; + background-color: #111; + border: 0px; + padding: 5px; + width: auto; +} + +#backbutton +{ + color: #333; + text-decoration: bold; + background-color: #111; + border: 0px; + padding: 5px; + width: auto; +} + +#description +{ + height:200px; +} + +#description2 +{ + height:200px; +} diff --git a/runfirst.sh b/runfirst.sh @@ -0,0 +1,4 @@ +mkdir sessions +sudo chown -R www-data sessions/ +sudo chown -R www-data db/ + diff --git a/server.py b/server.py @@ -0,0 +1,2600 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- + +import time, datetime, os, sys + +file_dir = os.path.dirname(__file__) +sys.path.append(file_dir) + +import json +import requests +import subprocess +import web +import hashlib +import random +import time +import shutil +import settings +import binascii +import base64 +import markdown +import re +import bcrypt +import unicodedata +import urllib +from pathlib import Path +from mutagen.flac import FLAC +from mutagen.easyid3 import EasyID3 +from mutagen.oggvorbis import OggVorbis +from PIL import Image +from PIL import ImageSequence +from forex_python.bitcoin import BtcConverter +from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException +import settings + +urls = ( + '/shop?', 'index', + '/?', 'almost', + '/putinbag/(.*)', 'putinbag', + '/dropitem/(.*)?', 'dropitem', + '/payln/(.*)', 'payln', + '/paymobile/(.*)', 'paymobile', + '/goodies/(.*)', 'goodies', + "/stats?", "stats", + '/lightning?', 'lightning', + '/paybtc/(.*)', 'paybtc', + '/payment/(.*)', 'payment', + '/orders?', 'orders', + '/checkout?', 'checkout', + '/pending', 'pending', + '/thankyou', 'thankyou', + "/login?", "login", + "/logout", "logout", + "/invites?", "invites", + "/users","users", + "/like?","like", + "/imageapi?","imageapi", + "/u/(.*)?", "user", + "/forgotpass?", "forgotpass", + "/register?", "register", + "/tuning?", "tuning", + '/products/(.*)?', 'products', + '/bigpic/(.*)?', 'bigpic', + '/categories?', 'categories', + '/op', 'op', + '/bitcoin', 'bitcoin', + '/shipping/(.*)', 'shipping', + '/propaganda?', 'propaganda', + '/editor?', 'editor', + '/heartranked?','heartranked', + '/save', 'save', + '/upload', 'upload', + '/rendered', 'rendered', + '/uploads?', 'uploads', + '/config', 'config', + '/payments?', 'payments', + '/cv', 'cv') + +bag = '' + +#Load from settings + +rtl = settings.rtl +rpcauth = settings.rpcauth +webmaster = settings.webmaster +baseurl = settings.baseurl +siteurl = baseurl +allowed = settings.allowed +postadmin = settings.postadmin +postadmin_signature = settings.postadmin_signature + +basedir = os.path.dirname(os.path.realpath(__file__))+'/' +templatedir = basedir + 'public_html/templates/' +staticdir = basedir + 'public_html/static/' +web.config.debug = False +app = web.application(urls, globals()) +store = web.session.DiskStore(basedir + 'sessions') +render = web.template.render(templatedir, base="base") +renderop = web.template.render(templatedir, base="op") +rendersplash = web.template.render(templatedir, base="splash") +db = web.database(dbn='sqlite', db=basedir + "db/cyberpunkcafe.db", timeout=10) +session = web.session.Session(app,store,initializer={'login':0, 'privilege':0, 'bag':[], 'sessionkey':'empty','soundlink':'','backurl':'','user':'','search':'', 'bildsida':'', 'feedbase':'', 'timebase':''}) + +allowedchar = '_','-','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','1','2','3','4','5','6','7','8','9','0' + +#----------- Database setup ------------- + +#Remeber to store Euros in cents + +#CREATE TABLE products (id integer PRIMARY KEY, name text NOT NULL, description text, price integer NOT NULL, available integer, sold integer, priority integer, dateadded integer, datelastsold integer, daterunout integer, dateavailable integer); + +#CREATE TABLE shipping (id integer PRIMARY KEY, country text NOT NULL, cost integer NOT NULL, days integer NOT NULL); + +#should rename to customer +#CREATE TABLE pending (id integer PRIMARY KEY, invoice_key text NOT NULL, country text NOT NULL, firstname text NOT NULL, lastname text NOT NULL, address text NOT NULL, town text NOT NULL, postalcode integer NOT NULL, email text NOT NULL, dateadded integer) + +#CREATE TABLE invoices (id INT AUTO_INCREMENT, invoice_key TEXT, btc TEXT, ln TEXT, products TEXT, payment TEXT, amount INT, totsats INT, timestamp TIMESTAMP, status TEXT, datepaid TIMESTAMP, dateshipped TIMESTAMP); + + +def logged(): + if session.login > 0: + return True + else: + return False + +def adduser(name, password, mail): + originalname=name + name=safe_filename(name[:12]) + password = password.encode("utf-8") + salt = bcrypt.gensalt() + password_hashed = bcrypt.hashpw(password, salt) + #check user db, if empty create admin + users = db.query("SELECT COUNT(*) AS users FROM rymdadmin")[0] + tot = int(users.users) + print('users alltsomallt: ' + str(tot)) + if tot > 1: + db.insert('rymdadmin', name=name, displayname=originalname, password=password_hashed, mail=mail, subscribe='aldrig', adminlevel=3) + else: + db.insert('rymdadmin', name=name, displayname=originalname, password=password_hashed, mail=mail, subscribe='aldrig', adminlevel=5) + print("new user added") + return + +def bildhistoriker(): + #bildhistoriker = db.query("SELECT name, displayname, mail, password FROM rymdadmin") + bildhistoriker = db.select('rymdadmin') + return bildhistoriker + +def adminlevel(user): + level = db.query("SELECT adminlevel FROM rymdadmin WHERE name='"+user+"';")[0] + #1 session logout, web.py bug + #2 rights to see pics and comment + #3 rights to upoload + #5 superadmin + session.login = int(level.adminlevel) + return + +def stopresetpass(mail): + t = None + try: + t = db.select('stopresetpass', where='mail="'+mail+'"', what='tid')[0] + print(t) + except Exception as e: + db.insert('stopresetpass', mail=mail, tid=time.time()) + print(e) + return False + try: + db.update('stopresetpass', where='mail="'+mail+'"', tid=time.time()) + print('okkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk') + except Exception as e: + print(e) + try: + senast = time.time() - t.tid + print(senast) + if senast < 600: + print('mail is in password reset spam filter') + return True + else: + return False + except Exception as e: + print(e) + return True + +def stopflood(ip,referer): + time.sleep(0.2) + try: + t = db.select('stopflood', where='ip="'+ip+'"', what='tid')[0] + except: + print('notin in db about ip') + pass + try: + if t: + db.update('stopflood', where='ip="'+ip+'"', tid=time.time()) + print('found ip, update stopflood time') + except: + db.insert('stopflood', ip=ip, tid=time.time()) + print('no ip adding flood ban time') + try: + senast = time.time() - t.tid + print(senast) + if senast < 2: + #ban_for_flood(ip) + return True + else: + return False + except: + return False + +def getinvitation(secretinvitation): + invites=db.query("SELECT * FROM invites;") + for i in invites: + if i.secretinvitation == secretinvitation: + if i.accepted == None: + return True + return False + +class login(): + form = web.form.Form( + web.form.Textbox('user', web.form.notnull, description="your registered mail account:"), + web.form.Password('password', web.form.notnull, description="and your passcode please:"), + web.form.Button('Login')) + def GET(self): + fejl = '' + resetpasslink = False + i = web.input(error=None) + if i.error == 'fejl': + fejl = 'wrong passcode!' + resetpasslink = True + if i.error == 'tom': + fejl = 'didnt work' + if session.login < 3: + loginform = self.form() + return render.login(loginform, fejl, resetpasslink) + if session.login == 3: + return web.seeother('/heartranked') + if session.login == 5: + raise web.seeother('/heartranked') + def POST(self): + referer = web.ctx.env.get('HTTP_REFERER',baseurl) + ip = web.ctx['ip'] + stopflood(ip, referer) + loginform = self.form() + i = web.input() + if i.user == '' or i.password == '': + raise web.seeother('/login?error=tom') + rymdadmins = [] + rymdadmins = bildhistoriker() + #if not rymdadmins: + # raise web.seeother('/register') + for p in rymdadmins: + if p.name.lower() == i.user.lower() or p.mail.lower() == i.user.lower(): + try: + encodepass = p.password.encode("utf-8") + print('nooooooooooooooooooooooooooooooooo') + except: + encodepass = p.password + if bcrypt.checkpw(i.password.encode('utf-8'), encodepass) == True: + session.user = p.name + adminlevel(p.name) + print('BACKURL: '+session.backurl) + if session.login == 5: + raise web.seeother('/heartranked') + if session.backurl != '': + backurl = session.backurl + session.backurl = '' + raise web.seeother(backurl) + else: + raise web.seeother('/heartranked') + return web.seeother('/login?error=fejl') + +class register(): + form = web.form.Form( + web.form.Textbox('invite', description="invitation code (do not edit):"), + web.form.Textbox('user', description="name:"), + web.form.Password('password', description="passcode:"), + web.form.Textbox('mail', description="mail:"), + web.form.Button('JOIN')) + def GET(self): + registerform = self.form() + w = web.input(invite=None) + formfail = '' + n = '' + m = '' + if getinvitation(w.invite): + try: + if w.fail == 'namn': + formfail = 'hey, need a name. If ya don lik ya real name imagination buddy' + if w.namn: + n = w.namn + if w.epost: + m = w.epost + elif w.epost == '': + formfail = 'we need an email, if u loose your passcode for example...' + if w.fail == 'notmail': + formfail = 'uhm, this is not an email' + elif w.fail == 'nametaken': + formfail = 'Name already taken' + elif w.fail == 'mailtaken': + formfail = 'You already got a account on this email. Try reset your passcode' + elif w.fail == 'kortlosen': + formfail = 'Too shoort passcode. Min 5 char.' + except: + pass + #check user db, if empty create admin + users = db.query("SELECT COUNT(*) AS users FROM rymdadmin")[0] + totusers = int(users.users) + registerform.fill(user=urllib.parse.unquote_plus(n), mail=urllib.parse.unquote_plus(m), invite=w.invite) + return render.register(registerform, formfail, totusers) + else: + return web.seeother('/oopsie') + def POST(self): + registerform = self.form() + i = web.input(invite=None) + if getinvitation(i.invite): + r = '&namn=' + i.user + '&epost=' + i.mail + urllib.parse.quote_plus(r) + if i.user == '': + raise web.seeother('/register?invite='+i.invite+'&fail=namn'+r) + if '@' not in i.mail: + raise web.seeother('/register?invite='+i.invite+'&fail=notmail'+r) + if len(i.password) < 5: + raise web.seeother('/register?invite='+i.invite+'&fail=kortlosen'+r) + rymdadmins = db.select('rymdadmin', what='name, mail') + for p in rymdadmins: + if p.name.lower() == i.user.lower(): + raise web.seeother('/register?invite='+i.invite+'&fail=nametaken' +r) + if p.mail.lower() == i.mail.lower(): + raise web.seeother('/register?invite='+i.invite+'&fail=mailtaken' +r) + adduser(i.user, i.password, i.mail.lower()) + #Send mail to Madbaker + msg = "Wowowowoweeewaaa! Lets Ride The INTERNET Wave Together, Bee as home, HEART RANKED ftw! " + i.user + ' ' + i.mail + sendmail(postadmin, 'Wowowoweewaaa!', msg) + #Send mail to new user + msg = "Wowowowoweeewaaa! "+i.user+" Lets Ride INTERNET Wave Together, Bee as home, HEART RANKED ftw! https://robinbackman.com/heartranked" + sendmail(i.mail, 'HEART RANKED VISIONARY Fleet', msg) + #session.login = 3 + #session.user = safe_filename(i.user) + #add user to matrix + #os.system("register_new_matrix_user -u "+i.user+" -p "+i.password+" --no-admin -c /etc/matrix-synapse/homeserver.yaml") + #db.update('invites', where='secretinvitation="'+i.invite+'"', accepted=datetime.datetime.now()) + return web.seeother('/login') + else: + raise web.seeother('/oopsie') + +class welcome(): + def GET(self): + if session.login > 2: + backurl = '' + if session.backurl != '': + backurl = session.backurl + session.backurl = '' + return render.ny(session.user, backurl) + +class like: + def POST(self): + if session.user != '': + i = web.input(unlike=None, like=None, hate=None, unhate=None, user=None, imghash=None) + user = i.user + imghash = i.imghash + l = db.query("SELECT * FROM likes WHERE bild='"+imghash+"' AND user='"+session.user+"';") + print(session.user) + print(session.user) + print('fuuuuuuuuuuuuuuuuu') + if l: + user_likes = True + else: + user_likes = False + if user_likes == False: + db.insert('likes', user=session.user, bild=imghash, datum=datetime.datetime.now()) + user_likes = True + elif user_likes == True: + db.query("DELETE FROM likes WHERE bild='"+imghash+"' AND user='"+session.user+"';") + user_likes = False + likes = db.query("SELECT Count(*) AS likes FROM likes WHERE bild='"+imghash+"';")[0] + # Example: Update like count in your database + # This is a placeholder; replace with your database logic + # Return JSON response + web.header('Content-Type', 'application/json') + return json.dumps({'likes': likes.likes, 'user_likes': user_likes }) + +class user(): + def GET(self, user): + data = web.input(soundname=None, onair=None, public=None, showuploads=None) + if user == session.user: + if data.public and data.soundname: + db.update('published', where="soundlink='" + data.soundname +"'", public=data.public) + elif data.showuploads=='yes': + uploads = [] + uploads = get_files_by_modtime(basedir+'public_html/static/users/' + user + '/images/web/',newest_first=True) + return render.showuploads(uploads,user,allowedchar, random) + elif data.onair and data.soundname: + db.update('published', where="soundlink='" + data.soundname +"'", playing=data.onair) + #soundname='aurora_ruderalis-greatful_bread' + #filetype='flac' + #soundlink = hashlib.md5(str(random.getrandbits(256)).encode('utf-8')).hexdigest() + #db.insert('sound', soundlink=soundlink, filename=soundname, sort=filetype, title=soundname, uploaddate=datetime.datetime.now(), uppladdare=user, lastmod=datetime.datetime.now(), moddedby=user) + usersounds = db.query("SELECT * FROM published WHERE creator='"+user+"' ORDER BY timeadded DESC;") + sounds = db.select('published') + creditsounds = [] + for i in sounds: + try: + credits=i.musicians.split(',') + except: + credits='' + for u in credits: + if u.strip().lower() == user.strip().lower(): + creditsounds.append(i.title) + return render.user(usersounds,creditsounds,user,datetime,str,int) + return web.seeother('/login') + +class invites(): + form = web.form.Form( + web.form.Textbox('mail', description="epost:"), + web.form.Button('Skicka')) + def GET(self): + if session.login > 2: + user = db.select('rymdadmin', where='name="'+session.user+'"')[0] + invites = db.select('invites', where='createdby="'+session.user+'"') + tuningform = self.form() + w = web.input(epost=None, render=None) + formfail = '' + if w.epost == '': + formfail = formfail + 'you have to put your email in' + if w.render == 'yes': + secret_invite = hashlib.md5(str(random.getrandbits(256)).encode('utf-8')).hexdigest() + db.insert('invites', secretinvitation=secret_invite, created=datetime.datetime.now(), createdby=session.user) + return render.invites(tuningform, formfail, user.name, invites) + def POST(self): + if session.login > 2: + user = db.select('rymdadmin', where='name="'+session.user+'"')[0] + tuningform = self.form() + i = web.input() + if i.mail == '': + raise web.seeother('/invites?fail=nomail') + if '@' not in i.mail: + raise web.seeother('/tuning?fail=notmail') + secret_invite = hashlib.md5(str(random.getrandbits(256)).encode('utf-8')).hexdigest() + db.insert('invites', secretinvitation=secret_invite, created=datetime.datetime.now(), createdby=session.user) + msg = "YO! You are the One! " + user.name + " is your Morpheous. Follow this rabbit https://robinbackman.com/register?invite="+secret_invite + sendmail(i.mail, 'Invitation to HEART RANKED!', msg) + return web.seeother('/heartranked') + +class tuning(): + form = web.form.Form( + web.form.Textbox('user', description="synligt namn:"), + web.form.Password('password', description="lösenord:"), + web.form.Password('newpassword', description="nytt lösen (ifall du vill byta):"), + web.form.Password('newpassword2', description="nytt lösen igen:"), + web.form.Textbox('mail', description="epost:"), + web.form.Button('Spara')) + def GET(self): + if session.login > 2: + print('asdfasdfasdf') + user = db.select('rymdadmin', where='name="'+session.user+'"')[0] + tuningform = self.form() + w = web.input(namn=None,epost=None,fail=None,upd=None) + print('asdfasdfasdfkdakkakka') + formfail = '' + if w.fail == 'wrongpass': + formfail = formfail + 'wrong passcode' + if w.fail == 'nopass': + formfail = formfail + 'you have to write passcode' + if w.namn == '': + formfail = formfail + 'whats your displayname' + if w.epost == '': + formfail = formfail + 'write your email please' + elif w.fail == 'notmail': + formfail = formfail + 'email please' + if w.fail == 'nametaken': + formfail = formfail + 'name is taken! choose another' + if w.fail == 'mailtaken': + formfail = formfail + 'mail address taken' + if w.fail == 'kortlosen': + formfail = formfail + '5 characters minimum' + if w.fail == 'newpass': + formfail = formfail + 'new passcode doesnt match' + if w.upd == 'yes': + formfail = 'Yes, your account has been tuned in thanks!' + tuningform.fill(user=user.displayname, mail=user.mail, subscribe=user.subscribe) + return render.tuning(tuningform, formfail, user.name) + else: + return web.seeother('/register') + def POST(self): + if session.login > 2: + tuningform = self.form() + i = web.input() + if i.password == '': + raise web.seeother('/tuning?fail=nopass') + rymdadmins = bildhistoriker() + for p in rymdadmins: + print(p) + if p.name == session.user: + if bcrypt.checkpw(i.password.encode('utf-8'), p.password): + #check if display name taken + b_displayname = bildhistoriker() + for a in b_displayname: + if i.user in a.displayname and a.name != session.user: + raise web.seeother('/tuning?fail=nametaken') + if i.mail in a.mail and i.mail != p.mail: + raise web.seeother('/tuning?fail=mailtaken') + if i.newpassword != '': + if i.newpassword != i.newpassword2: + raise web.seeother('/tuning?fail=newpass') + if len(i.newpassword) < 5: + raise web.seeother('/tuning?fail=kortlosen') + else: + #update with password change + password = i.newpassword.encode("utf-8") + salt = bcrypt.gensalt() + password_hashed = bcrypt.hashpw(password, salt) + db.update('rymdadmin', where='name="'+session.user+'"', displayname=i.user, password=password_hashed, mail=i.mail.lower()) + return web.seeother('/tuning?upd=yes') + if '@' not in i.mail: + raise web.seeother('/tuning?fail=notmail') + #update without passwordchange + db.update('rymdadmin', where='name="'+session.user+'"', displayname=i.user, mail=i.mail.lower()) + return web.seeother('/tuning?upd=yes') + else: + raise web.seeother('/tuning?fail=wrongpass') + +class forgotpass(): + form = web.form.Form( + web.form.Textbox('mail', web.form.notnull, description="email:"), + web.form.Button('Send me new passcode')) + def GET(self): + fejl = '' + i = web.input(error=None) + if i.error == 'fejl': + fejl = 'no email like that sorry!' + elif i.error == 'done': + fejl = 'your passcode is updated and sent to your mail' + elif i.error == 'nej': + fejl = 'nope, dont worky' + elif i.error == 'stopresetpass': + fejl = 'Already sent passcode to mail' + if session.login < 3: + loginform = self.form() + return render.forgotpass(loginform, fejl) + if session.login == 3: + return web.seeother('/s') + if session.login == 5: + raise web.seeother('/s') + def POST(self): + referer = web.ctx.env.get('HTTP_REFERER',baseurl) + ip = web.ctx['ip'] + stopflood(ip, referer) + sendpassform = self.form() + if not sendpassform.validates(): + raise web.seeother('/forgotpass?error=fejl') + else: + i = web.input() + if '@' not in i.mail: + raise web.seeother('/forgotpass?error=fejl') + rymdadmin = [] + rymdadmins = bildhistoriker() + for p in rymdadmins: + if p.mail.lower() == i.mail.lower(): + passfilter = stopresetpass(i.mail.lower()) + if passfilter == True: + raise web.seeother('/forgotpass?error=stopresetpass') + unencrypted_password = ('%06x' % random.randrange(16**6)) + password = unencrypted_password.encode("utf-8") + salt = bcrypt.gensalt() + password_hashed = bcrypt.hashpw(password, salt) + db.update('rymdadmin', where='name="'+p.name+'"', password=password_hashed) + print("lösenordet uppdaterat!") + msg = "Your new passcode is: " + unencrypted_password + ' , once you logg in with this enter a new passcode by pressin your name, it a um link. Take care now bye bye then.' + sendmail(p.mail, 'Heart Ranked Passcode', msg) + raise web.seeother('/forgotpass?error=done') + raise web.seeother('/forgotpass?error=fejl') + +def sendmail(email, subject, msg): + #Send mail + echomsg = subprocess.Popen(('echo', msg+'\n'+postadmin_signature), stdout=subprocess.PIPE) + sendmsg = subprocess.check_output(('mail', '-r', postadmin, '-s', subject, email), stdin=echomsg.stdout) + echomsg.wait() + #subprocess.call(['echo', msg, '|', 'mail', '-r', postadmin,'-s', subject, email]) + +def resize_gif(input_path, output_path, max_size): + input_image = Image.open(input_path) + frames = list(_thumbnail_frames(input_image,max_size)) + output_image = frames[0] + output_image.save( + output_path, + save_all=True, + append_images=frames[1:], + disposal=input_image.disposal_method, + **input_image.info, + ) + +def _thumbnail_frames(image,max_size): + for frame in ImageSequence.Iterator(image): + new_frame = frame.copy() + new_frame.thumbnail(max_size, Image.Resampling.LANCZOS) + yield new_frame + +def scale_gif(path, scale, new_path=None): + gif = Image.open(path) + if not new_path: + new_path = path + old_gif_information = { + 'loop': bool(gif.info.get('loop', 1)), + 'duration': gif.info.get('duration', 40), + 'background': gif.info.get('background', 223), + 'extension': gif.info.get('extension', (b'NETSCAPE2.0')), + 'transparency': gif.info.get('transparency', 223) + } + new_frames = get_new_frames(gif, scale) + save_new_gif(new_frames, old_gif_information, new_path) + +def get_new_frames(gif, scale): + new_frames = [] + actual_frames = gif.n_frames + for frame in range(actual_frames): + gif.seek(frame) + new_frame = Image.new('RGBA', gif.size) + new_frame.paste(gif) + new_frame.thumbnail(scale, Image.Resampling.LANCZOS) + new_frames.append(new_frame) + return new_frames + +def save_new_gif(new_frames, old_gif_information, new_path): + new_frames[0].save(new_path, + save_all = True, + append_images = new_frames[1:], + duration = old_gif_information['duration'], + loop = old_gif_information['loop'], + background = old_gif_information['background'], + extension = old_gif_information['extension'] , + transparency = old_gif_information['transparency']) + +def getdisplayname(user): + try: + displayname = db.query("SELECT displayname FROM rymdadmin WHERE name='"+user+"';")[0] + displayname = displayname.displayname + except: + displayname = user + return displayname + +def safe_filename(name: str, max_length: int = 100, replacement: str = "-") -> str: + """ + Convert a filename into a web-safe version. + """ + if not name: + return "file" + + # Normalize unicode (é → e, etc.) + name = unicodedata.normalize('NFKD', name) + name = name.encode('ascii', 'ignore').decode('ascii') + + # Replace spaces and common separators with the replacement char + name = re.sub(r'[\s_]+', replacement, name) + + # Remove any character that is not alphanumeric, hyphen, underscore, or dot + name = re.sub(r'[^a-zA-Z0-9.\-_]', '', name) + + # Replace multiple replacement chars with single one + name = re.sub(re.escape(replacement) + r'+', replacement, name) + + # Remove leading/trailing replacement chars and dots + name = name.strip(replacement + '.') + + # Prevent empty or hidden files + if not name or name.startswith('.'): + name = "file" + name + + # Enforce max length (leave room for extension) + if len(name) > max_length: + name = name[:max_length] + + return name.lower() + +#-------------Get files and sort em by date modified--------------- + +def get_files_by_modtime(directory: str = ".", newest_first: bool = True): + """ + Returns a list of file names in the directory sorted by last modified time. + + - newest_first=True → Newest files first (most recent modification) + - newest_first=False → Oldest files first + """ + path = Path(directory) + + # Get all files (exclude directories and hidden files if you want) + files = [f for f in path.iterdir() if f.is_file()] + + # Sort by modification time + sorted_files = sorted( + files, + key=lambda f: f.stat().st_mtime, # last modified timestamp + reverse=newest_first + ) + # Return just the file names (as strings) + return [f.name for f in sorted_files] + + +def getfiles(filmfolder): + #get a list of films, in order of settings.p file last modified + films_sorted = [] + print(filmfolder+'FUUUUUUUUUUUUUUUUUUUUUU') + films = next(os.walk(filmfolder))[1] + for i in films: + uploaded = os.listdir(filmfolder + i + '/') + for f in uploaded: + if os.path.isfile(filmfolder + i + '/'+f) == True: + lastupdate = os.path.getmtime(filmfolder + i + '/' + f) + films_sorted.append((i,f,lastupdate)) + else: + films_sorted.append((i,f,0)) + films_sorted = sorted(films_sorted, key=lambda tup: tup[2], reverse=True) + return films_sorted + +def getmacaroon(): + with open(basedir+'access.macaroon', 'rb') as f: + m = f.read() + #m = binascii.hexlify(m).decode() + m = base64.b64encode(m).decode() + return m + +def createinvoice(amount, description, label): + #Cents to EUR + amount = str(amount*1000) + invoice_details = {"amount":amount, "description": description, "label": label} + print(invoice_details) + macaroon = getmacaroon() + headers = {'macaroon': macaroon} + resp = requests.post(rtl+'invoice/genInvoice', json=invoice_details, headers=headers,verify=False) + print(resp.json()) + return resp.json() + +def getinvoice(label): + macaroon = getmacaroon() + headers = {'macaroon': macaroon} + resp = requests.get(rtl+'invoice/listInvoices?label='+label, headers=headers, verify=False) + return resp.json()['invoices'][0] + +def getnewaddr(): + macaroon = getmacaroon() + headers = {'macaroon': macaroon} + resp = requests.get(rtl+'invoice/newaddr', headers=headers, verify=False) + return resp.json()['address'][0] + +def callsubprocess(cmd): + subprocess.call(cmd.split()) + +def dropitems(d): + i = getproduct(d) + try: + product = db.query("SELECT * FROM customerbag WHERE sessionkey='" + session.sessionkey +"' AND product='"+str(i.id)+"';")[0] + except: + return 'empty' + if product.quantity > 1: + db.update('customerbag', where="sessionkey='" + session.sessionkey +"' and product='"+str(i.id)+"'", quantity=product.quantity-1) + db.update('products', where="id='"+str(i.id)+"'", available=i.available+1) + else: + db.query("DELETE FROM customerbag WHERE sessionkey='" + session.sessionkey +"' AND product='"+str(i.id)+"';") + db.update('products', where="id='"+str(i.id)+"'", available=i.available+1) + return 'empty' + +def addtobag(p): + i = getproduct(p) + if i.available > 0: + #session.bag += (i.name, i.price, i.id), + db.update('products', where="id='"+str(i.id)+"'", available=i.available-1) + product = db.query("SELECT * FROM customerbag WHERE sessionkey='" + session.sessionkey +"' AND product='"+str(i.id)+"';") + if product: + product = product[0] + print(product) + db.update('customerbag', where="sessionkey='" + session.sessionkey +"' and product='"+str(i.id)+"'", quantity=product.quantity+1) + print('gwtdafaakouttahere') + else: + db.insert('customerbag', sessionkey=session.sessionkey, product=i.id, type=i.type, currency=i.currency, price=i.price, quantity=1, timeadded=datetime.datetime.now()) + +def productname(productid): + try: + name = db.query("SELECT name FROM products WHERE id='"+str(productid)+"';")[0] + except: + return '' + return name.name + +def getproduct(productid): + try: + product = db.query("SELECT * FROM products WHERE id='"+str(productid)+"';")[0] + except: + return '' + return product + +def getcategories(): + try: + categories = db.query("SELECT * FROM categories;")[0] + except: + return '' + return categories + +def ordertype(): + physical=False + bag = db.query("SELECT * FROM customerbag WHERE sessionkey='" + session.sessionkey +"';") + for b in bag: + if b.type=='physical': + return 'physical' + return 'digital' + +def getavailable(productid): + try: + name = db.query("SELECT available FROM products WHERE id='"+str(productid)+"';")[0] + except: + return '' + return name.available + +def getbtcrate(): + btc_to_euro = db.select("btcrate", where="currency='EUR'") + #shippinginfo = db.select('shipping', where="country='" + pendinginfo.country + "'", what='price, days')[0] + btcrate = 65619 + return btcrate + try: + if time.time() - btc_to_euro[0].timeadded > 6000: + btcrate = 64485 + b = BtcConverter() + btcrate = int(b.get_latest_price('EUR')) + db.update('btcrate', where='currency="EUR"', rate=btcrate, timeadded=time.time()) + else: + btc_to_euro = db.select("btcrate", where="currency='EUR'") + btcrate = btc_to_euro[0].rate + except: + db.insert('btcrate', currency='EUR', rate=64485, timeadded=time.time()) + +def getbtcratetime(): + btc_to_euro = db.select("btcrate", where="currency='EUR'") + btctime = btc_to_euro[0].timeadded + return datetime.datetime.fromtimestamp(btctime).strftime('%c') + +def getprice(productid): + p = db.query("SELECT * FROM products WHERE id='"+str(productid)+"';")[0] + #b = BtcConverter() + btcrate=getbtcrate() + if p.currency=='euro': + sat = 1/btcrate*(p.price/100) * 100000000 + #sat = b.convert_to_btc(p.price/100, 'EUR') * 100000000 + euro = p.price/100 + if p.currency=='bitcoin': + euro = btcrate*p.price/100000000 + #euro = b.convert_btc_to_cur(p.price/100000000,'EUR') + sat = p.price + return int(sat), round(euro,2) + +def btc_to_eur(amount): + #b = BtcConverter() + btcrate=getbtcrate() + #euro = round(b.convert_btc_to_cur(amount/100000000,'EUR'),2) + euro = round(btcrate*amount/100000000) + return euro + +def eur_to_sat(amount): + btcrate=getbtcrate() + #b = BtcConverter() + #btc = b.convert_to_btc(amount/100, 'EUR') + btc = 1/btcrate*(amount/100) + sat=btc*100000000 + return int(sat) + +def getrate(): + #b = BtcConverter() + btcrate=getbtcrate() + #return int(b.get_latest_price('EUR')) + return int(btcrate) + +def checkforoldbags(): + print('checking for old bags') + bags = db.select('customerbag') + for bag in bags: + if datetime.datetime.now() - bag.timeadded > datetime.timedelta(minutes=6000): + print(datetime.datetime.now() - bag.timeadded) + print(datetime.timedelta(hours=1)) + print("Fuck") + product = getproduct(bag.product) + try: + print('found a bag at door! goddamit, got to put ' + str(bag.quantity) + ' x ' + product.name + ' back on the shelf') + if product.available > 1: + q = product.available + bag.quantity + else: + q = bag.quantity + db.update('products', where="id='"+str(bag.product)+"'", available=str(q)) + db.query("DELETE FROM customerbag WHERE sessionkey='" + bag.sessionkey + "'") + except: + pass + +def checkavailable(): + print('check items from availability') + bag = db.query("SELECT * FROM customerbag WHERE sessionkey='" + session.sessionkey + "'") + for i in bag: + q = getavailable(i.product) + soldout = q - i.quantity + if soldout < 0: + web.seeother('/?error=soldout&prod='+str(i.product)) + else: + return + +def sold(): + print('remove items from availability') + bag = db.query("SELECT * FROM customerbag WHERE sessionkey='" + session.sessionkey + "'") + for i in bag: + q = getavailable(i.product) + soldout = q - i.quantity + if soldout < 0: + web.seeother('/?error=soldout') + else: + db.update('products', where="id='"+str(i.product)+"'", available=str(q - i.quantity)) + + +def organizepics(product): + imgdir = basedir+'public_html/static/img/' + str(product) + '/' + imgdirlist = [imgdir, imgdir + 'web/', imgdir + 'thumb/'] + for d in imgdirlist: + pics = next(os.walk(d))[2] + organized_nr = 0 + for s in sorted(pics): + if '.jpeg' in s: + #print(s) + unorganized_nr = int(s[0:3]) + if organized_nr == unorganized_nr: + print('correcto pic numbering') + pass + if organized_nr != unorganized_nr: + print('false, correcting pic from ' + str(unorganized_nr) + ' to ' + str(organized_nr)) + mv = 'mv ' + d + str(unorganized_nr).zfill(3) + '.jpeg' + mv2 = ' ' + d + str(organized_nr).zfill(3) + '.jpeg' + os.system(mv + mv2) + organized_nr += 1 + +def getpendinginfo(): + try: + pendinginfo = db.select('pending', where="invoice_key='" + session.sessionkey + "'", what='country, firstname, lastname, address, town, postalcode, email')[0] + except: + pendinginfo = '' + return pendinginfo + +class index(): + def GET(self): + ip = web.ctx['ip'] + referer = web.ctx.env.get('HTTP_REFERER', 'none') + environ = web.ctx.env.get('HTTP_USER_AGENT', 'dunno') + visitorlog(ip,referer,environ) + checkforoldbags() + i = web.input(dropitem=None, putinbag=None,error=None,prod=None,category=None) + if session.sessionkey == 'empty': + session.sessionkey = hashlib.sha256(str(random.getrandbits(256)).encode('utf-8')).hexdigest()[15:35] + if i.dropitem != None: + session.bag = dropitems(i.dropitem) + print(session.bag) + if i.putinbag != None: + addtobag(i.putinbag) + return web.seeother('/shop#' + i.putinbag) + print('Cyberpunk cafe') + #print(session.bag) + products = db.query("SELECT * FROM products ORDER BY priority DESC") + try: + bag = db.query("SELECT * FROM customerbag WHERE sessionkey='" + session.sessionkey +"';") + except: + bag = None + try: + inbag = db.query("SELECT COUNT(*) AS inbag FROM customerbag where sessionkey='" + session.sessionkey +"';")[0] + inbag = int(inbag.inbag) + except: + inbag = None + if inbag < 1: + session.sessionkey = 'empty' + return render.index(products,bag,session.sessionkey,productname,inbag,db,getprice,getrate,i.category, markdown) + +class almost(): + def GET(self): + ip = web.ctx['ip'] + referer = web.ctx.env.get('HTTP_REFERER', 'none') + environ = web.ctx.env.get('HTTP_USER_AGENT', 'dunno') + visitorlog(ip,referer,environ) + visitors, total, unique = getvisits() + checkforoldbags() + i = web.input(dropitem=None, putinbag=None,error=None,prod=None,category=None,show=None) + if session.sessionkey == 'empty': + session.sessionkey = hashlib.sha256(str(random.getrandbits(256)).encode('utf-8')).hexdigest()[15:35] + if i.dropitem != None: + session.bag = dropitems(i.dropitem) + print(session.bag) + if i.putinbag != None: + addtobag(i.putinbag) + return web.seeother('/#' + i.putinbag) + print('Cyberpunk cafe') + #print(session.bag) + products = db.query("SELECT * FROM products ORDER BY priority DESC") + try: + bag = db.query("SELECT * FROM customerbag WHERE sessionkey='" + session.sessionkey +"';") + except: + bag = None + try: + inbag = db.query("SELECT COUNT(*) AS inbag FROM customerbag where sessionkey='" + session.sessionkey +"';")[0] + inbag = int(inbag.inbag) + except: + inbag = None + if inbag < 1: + session.sessionkey = 'empty' + return rendersplash.almost(products,bag,session.sessionkey,productname,inbag,db,getprice,getrate,i.category, markdown, visitors, total, unique, i.show) + +def visitorlog(ip, referer, environ): + last = db.query('SELECT ip AS ip FROM visitors WHERE id=(SELECT MAX(id) FROM visitors)') + try: + lastip = last[0].ip + except: + lastip = 'none' + if lastip != ip: + country = '' + country = os.popen('geoiplookup '+ip).read() + #print(soundtype) + countrycode = country.split(':')[1].split(',')[0].lower().strip() + country = country.split(':')[1].split(',')[1].strip() + #print('fuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu: '+ country) + try: + db.insert('visitors', ip=ip, referer=referer, environ=environ, country=country, countrycode=countrycode, time=datetime.datetime.now()) + except: + pass + print("added to visitor log") + return + +def getvisitors(): + #visitors = db.select('visitors') + visitors = db.query('SELECT * FROM visitors ORDER BY time DESC LIMIT 10000') + total = db.query('SELECT COUNT(*) AS total_visits FROM visitors') + unique = db.query('SELECT COUNT(DISTINCT ip) AS unique_visits FROM visitors') + return visitors, total[0].total_visits, unique[0].unique_visits + +def getvisits(): + limit=100 + visits = db.query("SELECT * FROM visitors ORDER BY time DESC LIMIT " + str(limit)) + visitors = db.select('visitors') + total = db.query('SELECT COUNT(*) AS total_visits FROM visitors') + unique = db.query('SELECT COUNT(DISTINCT ip) AS unique_visits FROM visitors') + countrylist=[] + for i in visits: + if i.countrycode not in countrylist: + countrylist.append(i.countrycode) + #print('fuuuuuuuuuuuuuuu: '+i.countrycode) + return countrylist, total[0].total_visits, unique[0].unique_visits + +class stats: + def GET(self): + p = web.input(logfilter=None) + visitors, total, unique = getvisitors() + return rendersplash.stats(visitors, total, unique, p.logfilter) + +class putinbag: + def GET(self, p): + addtobag(p) + raise web.seeother('/') + +class dropitem(): + def GET(self, d): + referer = web.ctx.env.get('HTTP_REFERER', 'none') + p = web.input() + i = 0 + empty=dropitems(d) + if empty=='empty': + return web.seeother('/shop?#'+d) + return web.seeother(referer) + +class bigpic(): + def GET(self, i): + print('faaaakyeee ' + i) + p = web.input(pic=None) + name=productname(i) + goodies = db.query("SELECT * FROM soundlink WHERE id='"+i+"';") + #if p.pic != None: + return render.bigpic(i,name,goodies) + +class checkout(): + t = [] + shippingcountries = db.select('shipping', what='country', order='country ASC') + shippingcountries = list(shippingcountries) + #t.append('Finland') + for i in shippingcountries: + if i.country != 'NO-SHIPPING': + t.append(i.country) + shipping = web.form.Form( + web.form.Textbox('email', web.form.notnull, description="Email:"), + web.form.Dropdown('country', t, web.form.notnull, description="Country"), + web.form.Textbox('firstname', web.form.notnull, description="First Name:"), + web.form.Textbox('lastname', web.form.notnull, description="Last Name:"), + web.form.Textbox('address', web.form.notnull, description="Shipping Address:"), + web.form.Textbox('town', web.form.notnull, description="Town / City:"), + web.form.Textbox('postalcode', web.form.notnull, description="Postalcode / zip"), + web.form.Button('Calculate shipping cost')) + email = web.form.Form( + web.form.Textbox('email', web.form.notnull, description="Email:"), + web.form.Button('Okey, lets do it!')) + def GET(self): + i = web.input(error=None) + pendinginfo = getpendinginfo() + if ordertype()=='digital': + checkoutform = self.email() + if pendinginfo: + checkoutform.fill(email=pendinginfo.email) + if ordertype()=='physical': + checkoutform = self.shipping() + if pendinginfo: + checkoutform.fill(country=pendinginfo.country, firstname=pendinginfo.firstname, lastname=pendinginfo.lastname, address=pendinginfo.address, town=pendinginfo.town, postalcode=pendinginfo.postalcode, email=pendinginfo.email) + errormsg='' + if i.error == 'mail': + errormsg = 'Check your mail!' + if i.error == 'shipping': + errormsg = 'Check your shipping address!' + bag = db.query("SELECT * FROM customerbag WHERE sessionkey='" + session.sessionkey +"';") + return render.checkout(checkoutform,bag,productname,errormsg,db,getprice) + def POST(self): + physical=False + bag = db.query("SELECT * FROM customerbag WHERE sessionkey='" + session.sessionkey +"';") + checkoutform = self.email() + for b in bag: + if b.type=='physical': + checkoutform = self.shipping() + physical=True + break + errormsg='' + pendinginfo = getpendinginfo() + i = web.input() + if pendinginfo: + if physical==True: + db.update('pending', where="invoice_key='"+session.sessionkey+"'", invoice_key=session.sessionkey, country=i.country, firstname=i.firstname, lastname=i.lastname, address=i.address, town=i.town, postalcode=str(i.postalcode), email=i.email, dateadded=datetime.datetime.now()) + else: + db.update('pending', where="invoice_key='"+session.sessionkey+"'", invoice_key=session.sessionkey, email=i.email, dateadded=datetime.datetime.now()) + else: + if physical==True: + db.insert('pending', invoice_key=session.sessionkey, country=i.country, firstname=i.firstname, lastname=i.lastname, address=i.address, town=i.town, postalcode=str(i.postalcode), email=i.email, dateadded=datetime.datetime.now()) + else: + db.insert('pending', invoice_key=session.sessionkey, email=i.email, dateadded=datetime.datetime.now()) + if '@' not in i.email: + web.seeother('/checkout?error=mail') + elif not checkoutform.validates(): + return web.seeother('/checkout?error=shipping') + else: + return web.seeother('/pending') + +class pending: + #form = web.form.Form( + #web.form.Dropdown('payment', ['Bitcoin Lightning', 'Bitcoin'], web.form.notnull, description="Select payment method"), + #web.form.Button('Pay')) + form = web.form.Form( + web.form.Button('Pay')) + def GET(self): + pendingform = self.form() + pendinginfo = getpendinginfo() + bag = db.query("SELECT * FROM customerbag WHERE sessionkey='" + session.sessionkey +"';") + return render.pending(session.sessionkey,pendingform,pendinginfo,bag,productname,db,getprice,eur_to_sat,ordertype) + def POST(self): + pendingform = self.form() + pendinginfo = getpendinginfo() + i = web.input() + + #Calculate total amount of bag + totalamount = 0 + description = '' + bag = db.query("SELECT * FROM customerbag WHERE sessionkey='" + session.sessionkey +"';") + comma = '' + for s in bag: + totalamount += getprice(s.product)[0] * s.quantity + description += comma + str(s.quantity) + ' x ' + productname(s.product) + comma = ', ' + if ordertype()=='physical': + shippinginfo = db.select('shipping', where="country='" + pendinginfo.country + "'", what='price, days')[0] + totalamount += eur_to_sat(shippinginfo.price) + totsats=totalamount + totbtc=totsats/100000000 + + #make lightning invoice + + #print(str(totalamount) + ' | ' + description) + #print(str(totsats) + ' | ' + description) + #label = hashlib.sha256(str(random.getrandbits(64)).encode('utf-8')).hexdigest()[15:35] + #invoice = createinvoice(totsats, description, label) + #time.sleep(1) + + #print(invoice) + #callsubprocess('qrencode -s 3 -o '+ staticdir + 'qr/' + session.sessionkey+'.png '+invoice['bolt11']) + #make bitcoin address + #bitcoinrpc = AuthServiceProxy(rpcauth) + #newaddress = bitcoinrpc.getnewaddress('Tarina Shop Butik') + #bitcoinrpc = None + #btcuri = 'bitcoin:' + newaddress + '?amount=' + str(totbtc) + '&label=' + description + #callsubprocess('qrencode -s 5 -o '+ staticdir + 'qr/' + newaddress +'.png ' + btcuri) + #try: + # db.query("DELETE FROM invoices WHERE invoice_key='"+session.sessionkey+"';") + #except: + # print('no old invoices to delete') + db.insert('invoices', invoice_key=session.sessionkey, products=description, amount=totalamount, totsats=totsats, status='unpaid', timestamp=time.strftime('%Y-%m-%d %H:%M:%S')) + msg="sup Robin? wowoweewaa! someone made an order." + sendmail('me@robinbackman.com', 'A message from Robins webshop', msg) + return web.seeother('/paymobile/' + session.sessionkey) + +class paymobile: + def GET(self, invoice_key): + digitalkey = None + invoice = db.select('invoices', where="invoice_key='"+invoice_key+"'")[0] + lninvoice='' + #lninvoice = getinvoice(invoice['ln']) + if invoice.status == 'paid' and session.sessionkey != 'empty': + bag = db.query("SELECT * FROM customerbag WHERE sessionkey='"+invoice_key+"';") + customer = db.select('pending', where="invoice_key='"+invoice_key+"'")[0] + db.query("INSERT INTO paidbags SELECT * FROM customerbag WHERE sessionkey='" + invoice_key + "'") + db.query("DELETE FROM customerbag WHERE sessionkey='" + invoice_key + "'") + db.update("invoices",where='invoice_key="'+invoice_key+'"', status='paid') + digitalkey=hashlib.sha256(str(random.getrandbits(256)).encode('utf-8')).hexdigest()[15:35] + db.insert('digitalkey', invoice_key=invoice_key, digitalkey=digitalkey, email=customer.email) + session.sessionkey = 'empty' + # send mail to op + if ordertype()=='physical': + msg = 'You got a new order, from ' + customer.firstname + ' ' + customer.lastname + ' from ' + customer.country + ' email: ' + customer.email + ' this dude wantz ' + invoice.products + else: + msg='sup?' + sendmail(webmaster, 'Robs Shop', msg) + # send mail to customer + if ordertype()=='physical': + msg = "Thank you for order " + invoice.products + " at Robins webshop, we'll be processing your order as soon as possible and send it to " + customer.firstname + ' ' + customer.lastname + ', ' + customer.address + ', ' + str(customer.postalcode) + ', ' + customer.town + ', ' + customer.country + '. To pay/view status or take a look at the digital goodies of your order please visit ' + baseurl + '/goodies/'+digitalkey + else: + msg="sup? thanks! here's a link to the digital goodies "+baseurl+'/goodies/'+digitalkey + sendmail(customer.email, 'A message from Robins webshop', msg) + web.seeother('/paymobile/'+invoice_key) + elif invoice.status == 'paid': + bag = db.query("SELECT * FROM paidbags WHERE sessionkey='"+invoice_key+"';") + digitalkey = db.select('digitalkey', where="invoice_key='"+invoice_key+"'")[0] + elif invoice.status != 'paid': + bag = db.query("SELECT * FROM customerbag WHERE sessionkey='"+invoice_key+"';") + pendinginfo = getpendinginfo() + return render.paymobile(lninvoice,invoice,bag,productname,digitalkey,db,getprice,getrate,ordertype,pendinginfo,eur_to_sat) + +class payln: + def GET(self, invoice_key): + digitalkey = None + invoice = db.select('invoices', where="invoice_key='"+invoice_key+"'")[0] + lninvoice = getinvoice(invoice['ln']) + if lninvoice['status'] == 'paid' and session.sessionkey != 'empty': + bag = db.query("SELECT * FROM customerbag WHERE sessionkey='"+invoice_key+"';") + customer = db.select('pending', where="invoice_key='"+invoice_key+"'")[0] + db.query("INSERT INTO paidbags SELECT * FROM customerbag WHERE sessionkey='" + invoice_key + "'") + db.query("DELETE FROM customerbag WHERE sessionkey='" + invoice_key + "'") + db.update("invoices",where='invoice_key="'+invoice_key+'"', status='paid') + digitalkey=hashlib.sha256(str(random.getrandbits(256)).encode('utf-8')).hexdigest()[15:35] + db.insert('digitalkey', invoice_key=invoice_key, digitalkey=digitalkey, email=customer.email) + session.sessionkey = 'empty' + # send mail to op + if ordertype()=='physical': + msg = 'You got a new order, from ' + customer.firstname + ' ' + customer.lastname + ' from ' + customer.country + ' email: ' + customer.email + ' this dude wantz ' + lninvoice['description'] + else: + msg='sup?' + sendmail(webmaster, 'Robs Shop', msg) + # send mail to customer + if ordertype()=='physical': + msg = "Thank you for order " + lninvoice['description'] + " at Robins webshop, we'll be processing your order as soon as possible and send it to " + customer.firstname + ' ' + customer.lastname + ', ' + customer.address + ', ' + str(customer.postalcode) + ', ' + customer.town + ', ' + customer.country + '. To pay/view status or take a look at the digital goodies of your order please visit ' + baseurl + '/goodies/'+digitalkey + else: + msg="sup? thanks! here's a link to the digital goodies "+baseurl+'/goodies/'+digitalkey + sendmail(customer.email, 'A message from Robins webshop', msg) + web.seeother('/payln/'+invoice_key) + if lninvoice['status'] == 'paid': + bag = db.query("SELECT * FROM paidbags WHERE sessionkey='"+invoice_key+"';") + digitalkey = db.select('digitalkey', where="invoice_key='"+invoice_key+"'")[0] + if lninvoice['status'] != 'paid': + bag = db.query("SELECT * FROM customerbag WHERE sessionkey='"+invoice_key+"';") + pendinginfo = getpendinginfo() + return render.payln(lninvoice,invoice,bag,productname,digitalkey,db,getprice,getrate,ordertype,pendinginfo,eur_to_sat) + +class goodies(): + def GET(self, digitalkey): + digitalkey = db.select('digitalkey', where="digitalkey='"+digitalkey+"'")[0] + #digitalkeys = db.select('digitalkey', where="email='"+digitalkey.email+"'") + digitalkeys = db.query("SELECT * FROM digitalkey WHERE email='"+digitalkey.email+"' ORDER BY timeadded DESC;") + return render.goodies(digitalkey,digitalkeys,productname,db,getprice) + #check all puraches with same email fuck ye + +class paybtc: + def GET(self, invoice_key): + invoice = db.select('invoices', where="invoice_key='" + invoice_key + "'", what='invoice_key, btc, ln, products, payment, amount, totsats, timestamp, status, datepaid, dateshipped')[0] + totbtc = float(invoice.totsats * 0.00000001) + btcaddress = invoice.btc + btcuri = 'bitcoin:' + btcaddress + '?amount=' + str(totbtc) + '&label=' + invoice.products + bitcoinrpc = AuthServiceProxy(rpcauth) + showpayment = bitcoinrpc.listreceivedbyaddress(0, True, True, btcaddress) + bitcoinrpc = None + if showpayment: + for i in showpayment: + confirmations = int(i['confirmations']) + print(str(confirmations)) + if invoice.datepaid == None and confirmations > 6: + msg = 'Robins webshop order update! someone sent you Bitcoin! ' + baseurl + '/paybtc/' + invoice.invoice_key + print(msg) + sendmail(webmaster, 'Robs Shop', msg) + db.update('invoices', where="invoice_key='" + invoice.invoice_key + "'", status='paid', datepaid=time.strftime('%Y-%m-%d %H:%M:%S')) + pendinginfo = getpendinginfo() + bag = db.query("SELECT * FROM customerbag WHERE sessionkey='"+invoice_key+"';") + return render.paybtc(invoice, btcaddress, btcuri, showpayment, bag, productname, db, getprice, getrate, ordertype, pendinginfo, eur_to_sat) + +class orders(): + def GET(self): + if logged(): + referer = web.ctx.env.get('HTTP_REFERER', 'none') + listpayments=[] + i=web.input(key=None,status=None) + if i.key != None and i.status != None: + db.update('invoices', where="invoice_key='" + i.key + "'", status=i.status) + #get the right invoice send mail + customer = db.select('pending', where="invoice_key='" + i.key + "'", what='country, firstname, lastname, address, town, postalcode, email')[0] + payment = db.select('invoices', where="invoice_key='" + i.key + "'", what='btc, ln, invoice_key, products, payment, amount, totsats, timestamp, status, datepaid, dateshipped')[0] + if payment.payment == 'Bitcoin': + paylink = 'paybtc/' + elif payment.payment == 'Bitcoin Lightning': + paylink = 'payln/' + elif payment.payment == 'Mobile Pay': + paylink = 'paymobile/' + if i.status == 'thankyou': + msg="Hi " + customer.email + ", thank you for your order! You can track the status of your order at "+baseurl+'/'+paylink+i.key + sendmail(customer.email, 'Robs Shop, a thank you!', msg) + elif i.status == 'shipped': + digitalkey = db.query("SELECT * FROM digitalkey WHERE email='"+customer.email+"' ORDER BY timeadded ASC;")[0] + # send mail to customer + try: + msg = "Your order at Robins webshop has been shipped to " + customer.firstname + ' ' + customer.lastname + ', ' + customer.address + ', ' + str(customer.postalcode) + ', ' + customer.town + ', ' + customer.country + '. To pay/view status or take a look at the digital goodies of your order please visit ' + baseurl + '/goodies/'+digitalkey.digitalkey + except: + msg = "Hi " + customer.email + ". To pay/view status or take a look at the digital goodies of your order please visit " + baseurl + '/goodies/'+digitalkey.digitalkey + sendmail(customer.email, 'Rob Shop, your order has been shipped!', msg) + elif i.status == 'paynotice': + msg="Hi " + customer.email + ", we noticed you have an unpaid order in our shop, thank you. You can track the status of your order at " + baseurl + paylink + payment.invoice_key + sendmail(customer.email, 'Rob Shop, order waiting for payment!', msg) + elif i.status == 'paid': + digitalkey = db.query("SELECT * FROM digitalkey WHERE email='"+customer.email+"' ORDER BY timeadded ASC;")[0] + # send mail to customer + msg="Hi " + customer.email + ", thank you! payment received. You can track the status of your order and view the status or take a look at the digital goodies of your order at " + baseurl + '/goodies/'+digitalkey.digitalkey + sendmail(customer.email, 'Rob Shop, order payment received', msg) + raise web.seeother(referer) + payments = db.select('invoices', what='btc, ln, invoice_key, products, payment, amount, totsats, timestamp, status, datepaid, dateshipped', order='timestamp DESC') + if i.key == None and i.status != None: + status = i.status + else: + status = '' + totsats = 0 + paid = 0 + unpaid = 0 + shipped = 0 + nonshipped = 0 + pickup = 0 + removed=0 + thankyou=0 + for i in payments: + if i.status == 'paid': + paid=paid+1 + nonshipped=nonshipped+1 + elif i.status == 'unpaid': + unpaid=unpaid+1 + nonshipped=nonshipped+1 + elif i.status == 'shipped': + shipped=shipped+1 + elif i.status == 'paid': + nonshipped=nonshipped+1 + elif i.status == 'pickup': + pickup=pickup+1 + elif i.status == "removed": + removed=removed+1 + elif i.status != "thankyou": + thankyou=thankyou+1 + payments = db.select('invoices', order='timestamp DESC') + return renderop.orders(payments,db,getinvoice,totsats,status,paid,unpaid,shipped,nonshipped,pickup,removed,thankyou,productname,getprice) + else: + raise web.seeother('/login') + +class ordersbtcold(): + def GET(self): + referer = web.ctx.env.get('HTTP_REFERER', 'none') + listpayments=[] + i=web.input(key=None,status=None) + if i.key != None and i.status != None: + db.update('invoices', where="invoice_key='" + i.key + "'", status=i.status) + #get the right invoice send mail + customer = db.select('pending', where="invoice_key='" + i.key + "'", what='country, firstname, lastname, address, town, postalcode, email')[0] + payment = db.select('invoices', where="invoice_key='" + i.key + "'", what='btc, ln, invoice_key, products, payment, amount, totsats, timestamp, status, datepaid, dateshipped')[0] + if payment.payment == 'Bitcoin': + paylink = 'paybtc/' + elif payment.payment == 'Bitcoin Lightning': + paylink = 'payln/' + if i.status == 'thankyou': + msg="Hi " + customer.email + ", thank you for your order! You can track the status of your order at "+baseurl+'/'+paylink+i.key + sendmail(customer.email, 'Robs Shop, a thank you!', msg) + elif i.status == 'shipped': + msg="Hi " + customer.email + ", your order has been shipped!. You can track the status of your order at "+baseurl+'/'+paylink+i.key + sendmail(customer.email, 'Rob Shop, your order has been shipped!', msg) + elif i.status == 'paynotice': + msg="Hi " + customer.email + ", we noticed you have an unpaid order in our shop, thank you. You can track the status of your order at " + baseurl + paylink + payment.invoice_key + sendmail(customer.email, 'Rob Shop, order waiting for payment!', msg) + elif i.status == 'paid': + msg="Hi " + customer.email + ", thank you! payment received. You can track the status of your order at " + baseurl + paylink + payment.invoice_key + sendmail(customer.email, 'Rob Shop, order payment received', msg) + raise web.seeother(referer) + payments = db.select('invoices', what='btc, ln, invoice_key, products, payment, amount, totsats, timestamp, status, datepaid, dateshipped', order='timestamp DESC') + if i.key == None and i.status != None: + status = i.status + else: + status = '' + totsats = 0 + paid = 0 + unpaid = 0 + shipped = 0 + nonshipped = 0 + pickup = 0 + removed=0 + for i in payments: + ln = getinvoice(i.ln) + print(ln) + if ln['status'] == 'paid': + totsats=totsats+ln['amount_msat'] + paid=paid+1 + s = db.select('invoices', where="invoice_key='"+i.invoice_key+"'", what='status')[0] + if s.status == None: + db.update('invoices', where="invoice_key='"+i.invoice_key+"'", status='paid', datepaid=time.strftime('%Y-%m-%d %H:%M:%S')) + if i.status == 'shipped': + shipped=shipped+1 + if i.status == 'paid': + nonshipped=nonshipped+1 + if i.status == 'pickup': + pickup=pickup+1 + if i.status == "removed": + removed=removed+1 + else: + s = db.select('invoices', where="invoice_key='"+i.invoice_key+"'", what='status')[0] + if s.status == None: + db.update('invoices', where="invoice_key='"+i.invoice_key+"'", status='unpaid', datepaid=time.strftime('%Y-%m-%d %H:%M:%S')) + if i.status != "removed": + unpaid=unpaid+1 + if i.status == "removed": + removed=removed+1 + payments = db.select('invoices', order='timestamp DESC') + return renderop.orders(payments,db,getinvoice,totsats,status,paid,unpaid,shipped,nonshipped,pickup,removed,productname,getprice) + +class payment: + def GET(self, invoice_key): + id = db.where('invoices', invoice_key=invoice_key)[0]['ln'] + invoice = getinvoice(id) + return render.payment(invoice) + +class thankyou: + def GET(self, id): + return render.thankyou(id) + +class loginold: + form = web.form.Form( + web.form.Textbox('user', web.form.notnull, description="User"), + web.form.Password('password', web.form.notnull, description="Passcode"), + web.form.Button('Login')) + def GET(self): + if not logged(): + loginform = self.form() + return render.login(loginform) + else: + raise web.seeother('/op') + def POST(self): + loginform = self.form() + if not loginform.validates(): + return render.login(loginform) + else: + i = web.input() + if (i.user,i.password) in allowed: + session.login = 1 + raise web.seeother('/op') + else: + return render.login(loginform) + +class logout: + def GET(self): + session.login = 0 + session.user = None + raise web.seeother('/heartranked') + +class op: + def GET(self): + if logged(): + return renderop.operator() + else: + raise web.seeother('/login') + +class propaganda: + form = web.form.Form( + web.form.Textbox('name', web.form.notnull, description="site name"), + web.form.Textarea('description', web.form.notnull, description="write here"), + web.form.Textarea('description2', web.form.notnull, description="write more here"), + web.form.Button('Save')) + picform = web.form.Form( + web.form.Textbox('name', web.form.notnull, description="upload images"), + web.form.Textarea('description', web.form.notnull, description="write even more here"), + web.form.Textarea('description2', web.form.notnull, description="write even here more"), + web.form.Textarea('id', web.form.notnull, description="id:"), + web.form.Button('Save')) + def GET(self): + if logged(): + i = web.input(cmd=None,soundname=None) + nocache = hashlib.sha256(str(random.getrandbits(256)).encode('utf-8')).hexdigest()[11:15] + story = None + if i.cmd == 'remove' and i.soundname != None: + try: + os.remove(staticdir+'/img/thumb/'+i.soundname) + os.remove(staticdir+'/img/web/'+i.soundname) + except: + print('notin to delete') + goodies = db.query("DELETE FROM propagandapics WHERE soundname='"+i.soundname+"';") + raise web.seeother('/propaganda') + elif i.cmd == 'flipright' and i.soundname != None: + original_thumb = Image.open(staticdir+'/img/thumb/'+i.soundname) + original_web = Image.open(staticdir+'/img/web/'+i.soundname) + o_thumb=original_thumb.rotate(270) + o_web=original_web.rotate(270) + o_thumb.save(staticdir+'/img/thumb/'+i.soundname) + o_web.save(staticdir+'/img/web/'+i.soundname) + raise web.seeother('/propaganda') + elif i.cmd == 'flipleft' and i.soundname != None: + original_thumb = Image.open(staticdir+'/img/thumb/'+i.soundname) + original_web = Image.open(staticdir+'/img/web/'+i.soundname) + o_thumb=original_thumb.rotate(90) + o_web=original_web.rotate(90) + o_thumb.save(staticdir+'/img/thumb/'+i.soundname) + o_web.save(staticdir+'/img/web/'+i.soundname) + raise web.seeother('/propaganda') + elif i.soundname != None: + story = db.query("SELECT * FROM propagandapics WHERE soundlink='"+i.soundname+"';") + goodies = db.query("SELECT * FROM propagandapics;") + configsite = self.form() + picturetext = self.picform() + try: + oldsiteconfig = db.select('propaganda', what='id, name, description, description2')[0] + configsite.fill(name=oldsiteconfig.name, description=oldsiteconfig.description, description2=oldsiteconfig.description2) + except: + print('no non no') + bilder_totalt = db.query("SELECT COUNT(*) AS stories FROM propagandapics")[0] + return renderop.propaganda(configsite, picturetext, goodies, nocache, story) + else: + raise web.seeother('/login') + def POST(self): + addcategory = self.form() + i = web.input(imgfile={}, name=None, id=None) + if i.id != None: + db.update('propagandapics', where='soundlink="'+i.id+'"', name=i.name, description=i.description, description2=i.description2, soundlink=i.id) + raise web.seeother('/propaganda') + if i.name != None: + #db.insert('propaganda', name=i.name, description=i.description, description2=i.description2 ) + db.update('propaganda', where='id=1', name=i.name, description=i.description, description2=i.description2 ) + if i.imgfile != {}: + if i.imgfile.filename == '': + print('hmmm... no image to upload') + raise web.seeother('/config/') + print('YEAH, Upload image!') + ##---------- UPLOAD IMAGE ---------- + filepath=i.imgfile.filename.replace('\\','/') # replaces the windows-style slashes with linux ones. + #split and only take the filename with extension + #soundpath=filepath.split('/')[-1] + #if soundpath == '': + # return render.nope("strange, no filename found!") + #get filetype, last three + imgname=filepath.split('/')[-1] # splits the and chooses the last part (the filename with extension) + filetype = imgname.split('.')[-1].lower() + if filetype == 'jpg': + filetype = 'jpeg' + soundname = imgname.split('.')[0] + #lets remove unwanted characters yes please! + sound = '' + for p in soundname.lower(): + if p in allowedchar: + sound = sound + p + if sound == '': + raise web.seeother('/upload?fail=wierdname') + soundname = sound + '_Gonzo_Pi.' + filetype + print(soundname) + print("filename is " + imgname + " filetype is " + filetype + " soundname is " + soundname + " trying to upload file from: " + filepath) + #if filetype != 'wav' or 'ogg' or 'flac' or 'jpeg' or 'jpg' or 'mp3': + # web.seeother('/upload?fail=notsupported') + #imghash = hashlib.md5(str(random.getrandbits(256)).encode('utf-8')).hexdigest() + #imgname = imghash + #imgname = str(len(os.listdir(imgdir))).zfill(3) + '.jpeg' + soundlink = hashlib.sha256(str(random.getrandbits(256)).encode('utf-8')).hexdigest()[9:36] + imgdir = staticdir+'upload/'+soundlink+'/' + os.system('mkdir -p ' + imgdir) + fout = open(imgdir + soundname,'wb') # creates the file where the uploaded file should be stored + fout.write(i.imgfile.file.read()) # writes the uploaded file to the newly created file. + fout.close() # closes the file, upload complete. + db.insert('propagandapics', soundlink=soundlink, soundname=soundname, name='', description='', description2='',timeadded=datetime.datetime.now()) + if filetype == 'jpeg' or filetype == 'png': + ##---------- OPEN FILE & CHEKC IF JPEG -------- + image = Image.open(imgdir + soundname) + #if image.format != 'JPEG': + # os.remove(imgdir +'/'+ soundname) + # raise web.seeother('/products/' + idvalue) + + ##---------- RESIZE IMAGE SAVE TO PRODUCT----------- + imgdir=staticdir+'img' + try: + os.makedirs(imgdir + '/web/', exist_ok=True) + os.makedirs(imgdir + '/thumb/', exist_ok=True) + except: + print('Folders is') + image.resize((1500,1500), Image.LANCZOS) + image.save(imgdir + '/web/'+soundname) + image.resize((500,500), Image.LANCZOS) + image.save(imgdir + '/thumb/'+soundname) + raise web.seeother('/propaganda') + +def word_break(text: str, width: int = 140) -> str: + """ + Breaks text into lines at word boundaries, with max line length = width. + Returns a single string with '\n' inserted. + """ + if not text: + return "" + + words = text.split() + if not words: + return "" + + lines = [] + current_line = [] + current_length = 0 + + for word in words: + # Length if we add this word (+ space if not first word in line) + word_len = len(word) + if current_line: + added_len = word_len + 1 # +1 for space + else: + added_len = word_len + + if current_length + added_len > width: + # Finish current line and start new one + lines.append(" ".join(current_line)) + current_line = [word] + current_length = word_len + else: + current_line.append(word) + current_length += added_len + + # Don't forget the last line + if current_line: + lines.append(" ".join(current_line)) + + return "\n".join(lines) + +def getlikes(postid, user): + user_likes = False + l = db.query("SELECT Count(*) AS likes FROM likes WHERE bild='"+postid+"';")[0] + db.update('published', where='soundlink="'+postid+'"', hearts=l.likes) + if user: + m = db.query("SELECT * FROM likes WHERE bild='"+postid+"' AND user='"+user+"';") + if m: + user_likes = True + else: + user_likes = False + if l.likes >= 0: + if user_likes: + likes = "❤️ " + str(l.likes) + else: + if l.likes > 0: + likes = "🤍 " + str(l.likes) + else: + likes = "🤍 " + return likes + +def postexist(postid): + return False + try: + l = db.select('published', where="soundlink='"+postid+"'")[0] + except: + return False + try: + if l.soundname != None: + return True + else: + return False + except: + return False + return False + +def getcombines(postid): + l = db.query("SELECT Count(*) AS combines FROM published WHERE combine='"+postid+"';")[0] + #m = db.query("SELECT * FROM likes WHERE bild='"+postid+"' AND user='"+user+"';") + #db.update('published', where='soundlink="'+postid+'"', combines=0) + if l.combines > 0: + return "⚭ " + str(l.combines) + else: + return '' + +def pushcombines(postid): + l = db.query("SELECT Count(*) AS combines FROM published WHERE soundlink='"+postid+"';")[0] + #m = db.query("SELECT * FROM likes WHERE bild='"+postid+"' AND user='"+user+"';") + db.update('published', where='soundlink="'+postid+'"', combines=l.combines) + if l.combines >= 0: + return "⚭ " + str(l.combines) + else: + return '' + +def formattime(timeadded): + return timeadded.strftime("%Y-%m-%d %H:%M:%S") + +def getfeed(): + timebase=session.timebase + feedbase=session.feedbase + if feedbase == '': + feedbase = 'time' + now = datetime.datetime.now() + #HEARTS + if feedbase == "heart" and timebase == "today": + now = datetime.datetime.now() + one_day_before = now - datetime.timedelta(days=1) + now = now.strftime('%Y-%m-%d %H:%M:%S') + one_day_before=one_day_before.strftime('%Y-%m-%d %H:%M:%S') + goodies = db.query("SELECT * FROM published WHERE timeadded BETWEEN '"+one_day_before+"' AND '"+now+"' ORDER BY hearts DESC LIMIT 1000;") + elif feedbase == "heart" and timebase == "week": + now = datetime.datetime.now() + one_day_before = now - datetime.timedelta(weeks=1) + now = now.strftime('%Y-%m-%d %H:%M:%S') + one_day_before=one_day_before.strftime('%Y-%m-%d %H:%M:%S') + goodies = db.query("SELECT * FROM published WHERE timeadded BETWEEN '"+one_day_before+"' AND '"+now+"' ORDER BY hearts DESC LIMIT 1000;") + elif feedbase == "heart" and timebase == "month": + now = datetime.datetime.now() + one_day_before = now - datetime.timedelta(weeks=4) + now = now.strftime('%Y-%m-%d %H:%M:%S') + one_day_before=one_day_before.strftime('%Y-%m-%d %H:%M:%S') + goodies = db.query("SELECT * FROM published WHERE timeadded BETWEEN '"+one_day_before+"' AND '"+now+"' ORDER BY hearts DESC LIMIT 1000;") + elif feedbase == "heart" and timebase == "year": + now = datetime.datetime.now() + one_day_before = now - datetime.timedelta(weeks=54) + now = now.strftime('%Y-%m-%d %H:%M:%S') + one_day_before=one_day_before.strftime('%Y-%m-%d %H:%M:%S') + goodies = db.query("SELECT * FROM published WHERE timeadded BETWEEN '"+one_day_before+"' AND '"+now+"' ORDER BY hearts DESC LIMIT 1000;") + elif feedbase == "heart" and timebase == "" or feedbase == "heart" and timebase == "all": + goodies = db.query("SELECT * FROM published ORDER BY hearts DESC LIMIT 1000;") + #TIME + elif feedbase == "time" and timebase == "today": + one_day_before = now - datetime.timedelta(days=1) + now = now.strftime('%Y-%m-%d %H:%M:%S') + one_day_before=one_day_before.strftime('%Y-%m-%d %H:%M:%S') + goodies = db.query("SELECT * FROM published WHERE timeadded BETWEEN '"+one_day_before+"' AND '"+now+"' ORDER BY ID DESC LIMIT 1000;") + elif feedbase == "time" and timebase == "week": + now = datetime.datetime.now() + one_day_before = now - datetime.timedelta(weeks=1) + now = now.strftime('%Y-%m-%d %H:%M:%S') + one_day_before=one_day_before.strftime('%Y-%m-%d %H:%M:%S') + goodies = db.query("SELECT * FROM published WHERE timeadded BETWEEN '"+one_day_before+"' AND '"+now+"' ORDER BY ID DESC LIMIT 1000;") + elif feedbase == "time" and timebase == "month": + now = datetime.datetime.now() + one_day_before = now - datetime.timedelta(weeks=4) + now = now.strftime('%Y-%m-%d %H:%M:%S') + one_day_before=one_day_before.strftime('%Y-%m-%d %H:%M:%S') + goodies = db.query("SELECT * FROM published WHERE timeadded BETWEEN '"+one_day_before+"' AND '"+now+"' ORDER BY ID DESC LIMIT 1000;") + elif feedbase == "time" and timebase == "year": + now = datetime.datetime.now() + one_day_before = now - datetime.timedelta(weeks=54) + now = now.strftime('%Y-%m-%d %H:%M:%S') + one_day_before=one_day_before.strftime('%Y-%m-%d %H:%M:%S') + goodies = db.query("SELECT * FROM published WHERE timeadded BETWEEN '"+one_day_before+"' AND '"+now+"' ORDER BY ID DESC LIMIT 1000;") + elif feedbase == "time" and timebase == "" or feedbase == "time" and timebase == "all": + goodies = db.query("SELECT * FROM published ORDER BY ID DESC LIMIT 1000;") + #COMBO + elif feedbase == "combo" and timebase == "today": + one_day_before = now - datetime.timedelta(days=1) + now = now.strftime('%Y-%m-%d %H:%M:%S') + one_day_before=one_day_before.strftime('%Y-%m-%d %H:%M:%S') + goodies = db.query("SELECT * FROM published WHERE timeadded BETWEEN '"+one_day_before+"' AND '"+now+"' ORDER BY combines DESC LIMIT 1000;") + elif feedbase == "combo" and timebase == "week": + now = datetime.datetime.now() + one_day_before = now - datetime.timedelta(weeks=1) + now = now.strftime('%Y-%m-%d %H:%M:%S') + one_day_before=one_day_before.strftime('%Y-%m-%d %H:%M:%S') + goodies = db.query("SELECT * FROM published WHERE timeadded BETWEEN '"+one_day_before+"' AND '"+now+"' ORDER BY combines DESC LIMIT 1000;") + elif feedbase == "combo" and timebase == "month": + now = datetime.datetime.now() + one_day_before = now - datetime.timedelta(weeks=4) + now = now.strftime('%Y-%m-%d %H:%M:%S') + one_day_before=one_day_before.strftime('%Y-%m-%d %H:%M:%S') + goodies = db.query("SELECT * FROM published WHERE timeadded BETWEEN '"+one_day_before+"' AND '"+now+"' ORDER BY combines DESC LIMIT 1000;") + elif feedbase == "combo" and timebase == "year": + now = datetime.datetime.now() + one_day_before = now - datetime.timedelta(weeks=54) + now = now.strftime('%Y-%m-%d %H:%M:%S') + one_day_before=one_day_before.strftime('%Y-%m-%d %H:%M:%S') + goodies = db.query("SELECT * FROM published WHERE timeadded BETWEEN '"+one_day_before+"' AND '"+now+"' ORDER BY combines DESC LIMIT 1000;") + elif feedbase == "combo" and timebase == "" or feedbase == "combo" and timebase == "all": + goodies = db.query("SELECT * FROM published ORDER BY combines DESC LIMIT 1000;") + elif feedbase == "Idontevenknow": + goodies = db.query("SELECT * FROM published ORDER BY combines DESC LIMIT 1000;") + else: + goodies = db.query("SELECT * FROM published ORDER BY ID DESC LIMIT 1000;") + return goodies + +def getcombofeed(show): + timebase=session.timebase + feedbase=session.feedbase + if feedbase == "heart": + comboposts = db.query("SELECT * FROM published WHERE combine='"+show+"' ORDER BY hearts DESC LIMIT 1000;") + elif feedbase == "combo": + comboposts = db.query("SELECT * FROM published WHERE combine='"+show+"' ORDER BY combines DESC LIMIT 1000;") + elif feedbase == "idontknow": + comboposts = db.query("SELECT * FROM published WHERE combine='"+show+"' ORDER BY hearts DESC LIMIT 1000;") + else: + comboposts = db.query("SELECT * FROM published WHERE combine='"+show+"' ORDER BY ID DESC LIMIT 1000;") + return comboposts + +def userimage(user): + usrimg = '' + i = staticdir+'users/'+user+'/images/thumb/'+user + print(i) + if os.path.isfile(i+'.jpeg'): + usrimg='/static/users/'+user+'/images/thumb/'+user+'.jpeg' + elif os.path.isfile(i+'.jpg'): + usrimg='/static/users/'+user+'/images/thumb/'+user+'.jpg' + elif os.path.isfile(i+'.png'): + usrimg='/static/users/'+user+'/images/thumb/'+user+'.png' + elif os.path.isfile(i+'.gif'): + usrimg='/static/users/'+user+'/images/thumb/'+user+'.gif' + if usrimg != '': + imghtml='<img class="usrimg" src="'+usrimg+'">' + return imghtml + else: + print('FUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU') + return + +class heartranked: + form = web.form.Form(web.form.Textbox('search', web.form.notnull, description="or search")) + def GET(self): + searchform = self.form() + bildpersida = 1000 + session.search = '' + session.bildsida = 0 + i = web.input(publised=None, public=None, show=None, remove=None, edit=None, feedbase=None, timebase=None) + #search + try: + bilder_totalt = db.query("SELECT COUNT(*) AS sound FROM published")[0] + tot = int(bilder_totalt.sound) + print('bilder alltsomallt: ' + str(tot)) + except: + print("inga bilder") + tot = 0 + #print('session search: ' + session.search) + try: + if i.search == '': + session.search = '' + session.bildsida = 0 + elif i.search != "": + session.search = urllib.parse.unquote_plus(i.search) + session.bildsida = 0 + except: + pass + if session.search != '': + search_result = [] + tot = 0 + b1, b2, b3 = 0,0,0 + try: + search_result.append(db.query("SELECT * FROM published WHERE creator LIKE '%"+session.search+"%' ORDER BY ID DESC LIMIT 1000;")) + tot = db.query("SELECT Count(*) AS sound FROM published WHERE creator LIKE '%"+session.search+"%';")[0] + b1 = tot.sound + except: + pass + try: + search_result.append(db.query("SELECT * FROM published WHERE description LIKE '%"+session.search+"%' ORDER BY ID DESC LIMIT 1000;")) + tot = db.query("SELECT Count(*) AS sound FROM published WHERE description LIKE '%"+session.search+"%';")[0] + b2 = tot.sound + except: + pass + try: + search_result.append(db.query("SELECT * FROM published WHERE description2 LIKE '%"+session.search+"%' ORDER BY ID DESC LIMIT 1000;")) + tot = db.query("SELECT Count(*) AS sound FROM published WHERE description2 LIKE '%"+session.search+"%';")[0] + b3 = tot.sound + except: + pass + tot = b1 + b2 + b3 + try: + print(search_result) + print('sökta bilder: ' + str(tot)) + except: + pass + try: + if i.page == "next": + if session.bildsida < tot: + session.bildsida += bildpersida + if i.page == "back": + if session.bildsida > bildpersida: + session.bildsida -= bildpersida + else: + session.bildsida = 0 + except: + pass + limit = session.bildsida + bildpersida + offset = session.bildsida + #EOF search + print(session.bildsida) + if session.search == '': + bilder = db.query("SELECT * FROM published ORDER BY id DESC LIMIT " + str(limit) + " OFFSET " + str(offset)) + else: + bilder = search_result + if i.feedbase == None: + feedbase = '' + else: + feedbase = i.feedbase + session.feedbase = feedbase + if i.timebase == None: + timebase = '' + else: + timebase = i.timebase + session.timebase = timebase + if session.user=='': + free_hash_for_user = hashlib.md5(str(random.getrandbits(256)).encode('utf-8')).hexdigest()[:4] + #session.user = 'rocker_'+free_hash_for_user + session.user = None + ip = web.ctx['ip'] + referer = web.ctx.env.get('HTTP_REFERER', 'none') + environ = web.ctx.env.get('HTTP_USER_AGENT', 'dunno') + visitorlog(ip,referer,environ) + visitors, total, unique = getvisits() + if i.edit != None: + session.soundlink=i.edit + raise web.seeother('/editor?public=yes') + if i.remove != None: + try: + user = db.select('published', where="soundlink='"+i.remove+"'")[0] + except: + pass + try: + user = user.creator + except: + user = '' + if user == session.user: + db.query("INSERT INTO deleted SELECT * FROM published WHERE soundlink = '"+i.remove+"'") + db.delete('published', where='soundlink="' + i.remove + '"') + #db.query("DELETE * FROM published WHERE soundlink ="+i.remove) + if session.login > 3: + try: + if i.delete != '': + return web.seeother('/remove/' + i.delete) + except: + pass + rights = 'admin' + elif session.login > 2: + rights = 'mod' + else: + rights = 'spacer' + return rendersplash.heartranked(db,markdown, visitors, total, unique, i.show, logged(), rights, session.user, getlikes, formattime, feedbase, tot, limit, offset, bildpersida, session.search, bilder, searchform, getcombines, timebase, getfeed, getcombofeed, userimage, postexist) + def POST(self): + searchform = self.form() + i = web.input() + if i.search != '': + raise web.seeother('/heartranked?search='+i.search) + +storage = {"content": ""} +class editor: + def GET(self): + if logged(): + i = web.input(publish=None, public=None, new=None, combine=None, remix=None) + if i.combine != None: + if session.user: + session.soundlink = hashlib.sha256(str(random.getrandbits(256)).encode('utf-8')).hexdigest()[9:36] + db.insert('unpublished', soundlink=session.soundlink, description='', description2='', timeadded=datetime.datetime.now(), creator=session.user, combine=i.combine) + if i.remix != None: + if session.user: + text='' + text2='' + try: + olduser = db.select('unpublished', where="soundlink='"+i.remix+"'")[0] + text = db.select('unpublished', where="soundlink='"+i.remix+"'")[0] + text2 = db.select('unpublished', where="soundlink='"+i.remix+"'")[0] + except: + pass + try: + olduser = olduser.creator + text = text.description + text2 = text2.description2 + except: + olduser = '' + if olduser != '': + allcreators = olduser+','+session.user + else: + allcreators = session.user + session.soundlink = hashlib.sha256(str(random.getrandbits(256)).encode('utf-8')).hexdigest()[9:36] + db.insert('unpublished', soundlink=session.soundlink, description=text, description2=text2, timeadded=datetime.datetime.now(), creator=allcreators, remix=i.remix) + if session.soundlink != '': + if i.public=='yes': + try: + text = db.select('published', where="soundlink='"+session.soundlink+"'")[0] + except: + session.soundlink = '' + else: + try: + text = db.select('unpublished', where="soundlink='"+session.soundlink+"'")[0] + except: + pass + try: + text = text.description + except: + text = '' + if i.public=='yes': + try: + text2 = db.select('published', where="soundlink='"+session.soundlink+"'")[0] + except: + session.soundlink = '' + else: + try: + text2 = db.select('unpublished', where="soundlink='"+session.soundlink+"'")[0] + except: + pass + try: + text2 = text2.description2 + except: + text2 = '' + else: + text = '' + text2 = '' + + if i.new == 'yes': + session.soundlink = '' + raise web.seeother('/editor') + if i.publish == 'yes' and text != '' and i.public == None and logged() and len(text) < 256: + description1 = text + description2 = text2 + soundname = safe_filename(description1[0:27]) + #session.soundlink = hashlib.sha256(str(random.getrandbits(256)).encode('utf-8')).hexdigest()[9:36] + createpost=True + try: + iftext = db.select('published', where="soundlink='"+session.soundlink+"'")[0] + iftext = iftext.description + createpost=False + except: + iftext = '' + if createpost == False: + db.update('published', where='soundlink="'+session.soundlink+'"', soundlink=session.soundlink, soundname=soundname, description=description1, description2=description2, timeadded=datetime.datetime.now(), creator=session.user) + raise web.seeother('/editor?public=yes') + else: + print('make a new post') + try: + db.update('unpublished', where='soundlink="'+session.soundlink+'"', soundlink=session.soundlink, soundname=soundname, description=description1, description2=description2, timeadded=datetime.datetime.now(), creator=session.user) + except: + print('update unpublished') + if createpost == True: + try: + combine = db.select('unpublished', where="soundlink='"+session.soundlink+"'")[0] + except: + pass + try: + combine = combine.combine + except: + combine = '' + try: + remix = db.select('unpublished', where="soundlink='"+session.soundlink+"'")[0] + except: + pass + try: + remix = remix.remix + except: + remix = '' + db.insert('published', soundlink=session.soundlink, soundname=soundname, description=description1, description2=description2, timeadded=datetime.datetime.now(), creator=session.user, combine=combine, remix=remix) + try: + l = db.query("SELECT Count(*) AS combines FROM published WHERE combine='"+combine+"';")[0] + #m = db.query("SELECT * FROM likes WHERE bild='"+postid+"' AND user='"+user+"';") + db.update('published', where='soundlink="'+combine+'"', combines=l.combines) + except: + print('fuuuuuuuuuuuuuuuuuuuuuuu COMBINES NOT UPDATING! WARNING WARNING!') + pass + raise web.seeother('/editor?public=yes') + raise web.seeother('/editor?public=yes') + #db.insert('pawning', pawning=i.remix, name=session.user, timeadded=datetime.datetime.now()) + return rendersplash.editor(storage, text, text2, markdown, safe_filename, session.soundlink, i.public, logged(), session.user, i.combine, i.remix) + +class save: + def POST(self): + data = json.loads(web.data()) + text = data.get("text", "") + text2 = data.get("text2", "") + print(text) + print(text2 +'fuuuuuuuuuuuuu') + if session.soundlink == '': + session.soundlink = hashlib.sha256(str(random.getrandbits(256)).encode('utf-8')).hexdigest()[9:36] + db.insert('unpublished', soundlink=session.soundlink, description=text, description2=text2, timeadded=datetime.datetime.now(), creator=session.user) + else: + iftext = '' + try: + iftext = db.select('unpublished', where="soundlink='"+session.soundlink+"'")[0] + iftext = iftext.soundlink + except: + iftext = '' + if iftext != '': + db.update('unpublished', where='soundlink="'+session.soundlink+'"', description=text, description2=text2, timeadded=datetime.datetime.now(), creator=session.user) + else: + db.insert('unpublished', soundlink=session.soundlink, description=text, description2=text2, timeadded=datetime.datetime.now(), creator=session.user) + return "ok" # simple response + +class imageapi: + def POST(self): + action = '' + data = json.loads(web.data()) + image = data.get("image", "") + action = data.get("action", "") + original_thumb = Image.open(staticdir+'users/'+session.user+'/images/thumb/'+image) + original_web = Image.open(staticdir+'users/'+session.user+'/images/web/'+image) + if action != '': + if action == 'rotateright' and image != None: + o_thumb=original_thumb.rotate(270) + o_web=original_web.rotate(270) + if action == 'rotateleft' and image != None: + o_thumb=original_thumb.rotate(90) + o_web=original_web.rotate(90) + o_thumb.save(staticdir+'users/'+session.user+'/images/thumb/'+image) + o_web.save(staticdir+'users/'+session.user+'/images/web/'+image) + return # simple response + +class rendered: + def GET(self): + i = web.input(public=None) + if session.soundlink != '': + if i.public == None: + try: + unpublished = db.select('unpublished', where='soundlink="'+session.soundlink+'"')[0] + if unpublished.description == None: + return '' + except: + print('can not find any post') + else: + return markdown.markdown(unpublished.description+'\n\n---\n\n'+unpublished.description2) + elif i.public == 'yes': + published = db.select('published', where='soundlink="'+session.soundlink+'"')[0] + if published.description1 == None: + return '' + else: + return markdown.markdown(published.description1+'\n\n---\n\n'+published.description2) + else: + return '' + +def resize_gif(input_path, output_path, max_size): + input_image = Image.open(input_path) + frames = list(_thumbnail_frames(input_image,max_size)) + output_image = frames[0] + output_image.save( + output_path, + save_all=True, + append_images=frames[1:], + disposal=input_image.disposal_method, + **input_image.info, + ) + +def _thumbnail_frames(image,max_size): + for frame in ImageSequence.Iterator(image): + new_frame = frame.copy() + new_frame.thumbnail(max_size, Image.Resampling.LANCZOS) + yield new_frame + +def scale_gif(path, scale, new_path=None): + gif = Image.open(path) + if not new_path: + new_path = path + old_gif_information = { + 'loop': bool(gif.info.get('loop', 1)), + 'duration': gif.info.get('duration', 40), + 'background': gif.info.get('background', 223), + 'extension': gif.info.get('extension', (b'NETSCAPE2.0')), + 'transparency': gif.info.get('transparency', 223) + } + new_frames = get_new_frames(gif, scale) + save_new_gif(new_frames, old_gif_information, new_path) + +def get_new_frames(gif, scale): + new_frames = [] + actual_frames = gif.n_frames + for frame in range(actual_frames): + gif.seek(frame) + new_frame = Image.new('RGBA', gif.size) + new_frame.paste(gif) + new_frame.thumbnail(scale, Image.Resampling.LANCZOS) + new_frames.append(new_frame) + return new_frames + +def save_new_gif(new_frames, old_gif_information, new_path): + new_frames[0].save(new_path, + save_all = True, + append_images = new_frames[1:], + duration = old_gif_information['duration'], + loop = old_gif_information['loop'], + background = old_gif_information['background'], + extension = old_gif_information['extension'] , + transparency = old_gif_information['transparency']) + +class upload: + def POST(self): + if logged(): + saved_files = [] + + try: + # Best way for multiple files in web.py + input_data = web.webapi.rawinput() + uploaded = input_data.get('files') + + # Make sure it's always a list + if not isinstance(uploaded, list): + uploaded = [uploaded] if uploaded else [] + + for f in uploaded: + if f and hasattr(f, 'filename') and f.filename: + # Sanitize filename a bit + imgdir = staticdir + 'users/' + session.user + '/temp/' + os.system('mkdir -p ' + imgdir) + safe_name = safe_filename(os.path.basename(f.filename)) + filepath = os.path.join(imgdir, safe_name) + + with open(filepath, 'wb') as out: + out.write(f.file.read()) # Important: use .file.read() + + saved_files.append(safe_name) + + ##---------- UPLOAD SOUND ---------- + imgname=filepath.split('/')[-1] # splits the and chooses the last part (the filename with extension) + filetype = imgname.split('.')[-1].lower() + soundfile=safe_name + if filetype == 'pdf' or filetype == 'txt' or filetype == 'md': + usersound = staticdir + 'users/' + session.user + '/docs/' + os.system('mkdir -p ' + usersound) + os.system('mv ' + imgdir + soundfile + ' ' + usersound + soundfile) + elif filetype == 'mp4': + usersound = staticdir + 'users/' + session.user + '/films/' + os.system('mkdir -p ' + usersound) + os.system('mv ' + imgdir + soundfile + ' ' + usersound + soundfile) + elif filetype == 'jpeg' or filetype == 'jpg' or filetype == 'png' or filetype == 'gif': + userpics = staticdir + 'users/' + session.user + '/images/' + os.system('mkdir -p ' + userpics) + os.system('mv ' + imgdir + soundfile + ' ' + userpics + soundfile) + if filetype == 'gif': + scale_gif(userpics+soundfile, [900,900], userpics+'web/'+soundfile) + scale_gif(userpics+soundfile, [300,300], userpics+'thumb/'+soundfile) + else: + ##---------- OPEN FILE & CHEKC IF JPEG -------- + image = Image.open(userpics + soundfile) + try: + os.makedirs(userpics + 'web/', exist_ok=True) + os.makedirs(userpics + 'thumb/', exist_ok=True) + except: + print('Folders is') + + ##---------- RESIZE IMAGE ----------- + image.thumbnail((900,900), Image.Resampling.LANCZOS) + image.save(userpics + 'web/' + soundfile) + image.thumbnail((300,300), Image.Resampling.LANCZOS) + image.save(userpics + 'thumb/' + soundfile) + + elif filetype == 'wav' or filetype == 'flac' or filetype == 'mp3' or filetype == 'ogg': + usersound = staticdir + 'users/' + session.user + '/sounds/' + os.system('mkdir -p ' + usersound) + os.system('mv ' + imgdir + soundfile + ' ' + usersound + soundfile) + soundlenght = os.popen('mediainfo --Inform="General;%Duration%" ' + usersound + soundfile).read() + print('sound lenght:' + str(soundlenght)) + soundtype = os.popen('mediainfo --Inform="General;%Format%" ' + usersound + soundfile).read() + print(soundtype) + if 'Ogg' in soundtype: + #os.system('ffmpeg -i '+usersound+soundfile+' '+usersound+soundname+'.wav') + print('ogg file found, converting to flac') + os.system('ffmpeg -i ' + usersound + soundfile +' '+ usersound + soundname + '.flac') + print('converting to mp3') + os.system('ffmpeg -y -loglevel 1 -i ' + usersound + soundname + '.flac -c:a libmp3lame -b:a 192k ' + usersound + soundname + '.mp3') + if 'MPEG Audio' in soundtype: + print('mp3 file found, converting to flac') + os.system('ffmpeg -i ' + usersound + soundfile + ' ' + usersound + soundname + '.flac') + print('converting to ogg') + os.system('ffmpeg -i ' + usersound + soundname +'.flac '+ usersound + soundname + '.ogg') + print('Wave file found, converting to flac') + if 'Wave' in soundtype: + print('Wave file found, converting to flac') + os.system('flac ' + usersound + soundfile + ' ' + usersound + soundname + '.flac') + os.system('sox -V1 ' + usersound + soundfile + ' ' + usersound + soundname + '.ogg') + os.system('ffmpeg -y -loglevel 1 -i ' + usersound + soundfile + ' -c:a libmp3lame -b:a 192k ' + usersound + soundname + '.mp3') + if 'FLAC' in soundtype: + print('FLAC file found, converting to mp3 and ogg') + os.system('sox -V1 ' + usersound + soundfile + ' ' + usersound + soundname + '.ogg') + os.system('ffmpeg -y -loglevel 1 -i ' + usersound + soundfile + ' -c:a libmp3lame -b:a 192k ' + usersound + soundname + '.mp3') + saved_files.append(safe_name) + print(f"✅ Saved: {safe_name}") # This will show in console for debugging + else: + print("⚠️ Skipped invalid file object") + + except Exception as e: + print("Upload error:", str(e)) + return f"❌ Error: {str(e)}" + + if saved_files: + return f"✅ Successfully uploaded {len(saved_files)} file(s): {', '.join(saved_files)}" + else: + return "❌ No files received. Check console for details." + +class uploads: + def GET(self): + if logged(): + uploaded = getfiles(staticdir+'upload/') + return render.uploads(uploaded) + +class config: + form = web.form.Form( + web.form.Textbox('name', web.form.notnull, description="Site name:"), + web.form.Textarea('description', web.form.notnull, description="Slogan:"), + web.form.Textarea('description2', web.form.notnull, description="Description:"), + web.form.Button('Save')) + def GET(self): + if logged(): + configsite = self.form() + try: + oldsiteconfig = db.select('siteconfig', what='id, name, description, description2')[0] + configsite.fill(name=oldsiteconfig.name, description=oldsiteconfig.description, description2=oldsiteconfig.description2) + except: + print('no non no') + return renderop.config(configsite) + else: + raise web.seeother('/login') + def POST(self): + if logged(): + addcategory = self.form() + i = web.input(imgfile={}, name=None) + if i.name != None: + db.update('siteconfig', where='id=1', name=i.name, description=i.description, description2=i.description2 ) + if i.imgfile != {}: + if i.imgfile.filename == '': + print('hmmm... no image to upload') + raise web.seeother('/config/') + print('YEAH, Upload image!') + + ##---------- UPLOAD IMAGE ---------- + + filepath=i.imgfile.filename.replace('\\','/') # replaces the windows-style slashes with linux ones. + #split and only take the filename with extension + #soundpath=filepath.split('/')[-1] + #if soundpath == '': + # return render.nope("strange, no filename found!") + #get filetype, last three + imgname=filepath.split('/')[-1] # splits the and chooses the last part (the filename with extension) + filetype = imgname.split('.')[-1].lower() + if filetype == 'jpg': + filetype = 'jpeg' + soundname = imgname.split('.')[0] + #lets remove unwanted characters yes please! + sound = '' + for p in soundname.lower(): + if p in allowedchar: + sound = sound + p + if sound == '': + raise web.seeother('/upload?fail=wierdname') + soundname = 'logo.' + filetype + print(soundname) + print("filename is " + imgname + " filetype is " + filetype + " soundname is " + soundname + " trying to upload file from: " + filepath) + #if filetype != 'wav' or 'ogg' or 'flac' or 'jpeg' or 'jpg' or 'mp3': + # web.seeother('/upload?fail=notsupported') + #imghash = hashlib.md5(str(random.getrandbits(256)).encode('utf-8')).hexdigest() + #imgname = imghash + #imgname = str(len(os.listdir(imgdir))).zfill(3) + '.jpeg' + soundlink = hashlib.sha256(str(random.getrandbits(256)).encode('utf-8')).hexdigest()[9:36] + imgdir = staticdir+'upload/' + os.system('mkdir -p ' + imgdir) + fout = open(imgdir + soundname,'wb') # creates the file where the uploaded file should be stored + fout.write(i.imgfile.file.read()) # writes the uploaded file to the newly created file. + fout.close() # closes the file, upload complete. + + if filetype == 'jpeg' or filetype == 'png': + ##---------- OPEN FILE & CHEKC IF JPEG -------- + + image = Image.open(imgdir + soundname) + #if image.format != 'JPEG': + # os.remove(imgdir +'/'+ soundname) + # raise web.seeother('/products/' + idvalue) + + ##---------- RESIZE IMAGE SAVE TO PRODUCT----------- + + imgdir=staticdir+'img' + try: + os.makedirs(imgdir + '/web/', exist_ok=True) + os.makedirs(imgdir + '/thumb/', exist_ok=True) + except: + print('Folders is') + image.resize((900,900), Image.LANCZOS) + image.save(imgdir + '/web/'+soundname) + image.resize((300,300), Image.LANCZOS) + image.save(imgdir + '/thumb/'+soundname) + raise web.seeother('/config') + else: + raise web.seeother('/login') + +class categories: + form = web.form.Form( + web.form.Textbox('category', web.form.notnull, description="Add Category:"), + web.form.Button('Add')) + def GET(self): + if logged(): + i = web.input(delete=None) + if i.delete: + db.delete('categories', where='id='+i.delete) + listcategories = db.query("SELECT * FROM categories ORDER BY id DESC") + addcategory = self.form() + return renderop.categories(listcategories,addcategory) + else: + raise web.seeother('/login') + def POST(self): + addcategory = self.form() + i = web.input() + db.insert('categories', category=i.category) + raise web.seeother('/categories') + + +class products: + listcategories = db.query("SELECT * FROM categories ORDER BY id DESC") + p = [] + for i in listcategories: + p.append(i.category) + #p = listcategories[0] + form = web.form.Form( + web.form.Dropdown('category', p, web.form.notnull, description="Category:"), + web.form.Textbox('name', web.form.notnull, description="Name:"), + web.form.Textarea('description', web.form.notnull, description="Description:"), + web.form.Radio('type', ['digital', 'physical'],description="Type:"), + web.form.Radio('currency', ['euro', 'bitcoin'],description="Currency:"), + web.form.Textbox('price', web.form.notnull, description="Price:"), + web.form.Textbox('available', web.form.notnull, web.form.regexp(r'\d+', 'number dumbass!'), description="Available"), + web.form.Textbox('priority', web.form.notnull, web.form.regexp(r'\d+', 'number dumbass!'), description="Priority (high value more priority)"), + web.form.Button('Save')) + def GET(self, idvalue): + if logged(): + i = web.input(cmd=None,soundname=None) + nocache = hashlib.sha256(str(random.getrandbits(256)).encode('utf-8')).hexdigest()[11:15] + if i.cmd == 'del': + db.delete('products', where='id="'+idvalue+'"') + imgdir = staticdir + 'img/' + idvalue + try: + shutil.rmtree(imgdir,ignore_errors=True,onerror=None) + except: + print('no picture folder, nothing to remove...') + pass + raise web.seeother('/products/') + if i.cmd == 'remove' and i.soundname != None: + try: + os.remove(staticdir+'/img/thumb/'+i.soundname) + os.remove(staticdir+'/img/web/'+i.soundname) + except: + print('notin to delete') + goodies = db.query("DELETE FROM soundlink WHERE id='"+idvalue+"' AND soundname='"+i.soundname+"';") + raise web.seeother('/products/' + idvalue) + if i.cmd == 'flipright' and i.soundname != None: + original_thumb = Image.open(staticdir+'/img/thumb/'+i.soundname) + original_web = Image.open(staticdir+'/img/web/'+i.soundname) + o_thumb=original_thumb.rotate(270) + o_web=original_web.rotate(270) + o_thumb.save(staticdir+'/img/thumb/'+i.soundname) + o_web.save(staticdir+'/img/web/'+i.soundname) + raise web.seeother('/products/' + idvalue) + if i.cmd == 'flipleft' and i.soundname != None: + original_thumb = Image.open(staticdir+'/img/thumb/'+i.soundname) + original_web = Image.open(staticdir+'/img/web/'+i.soundname) + o_thumb=original_thumb.rotate(90) + o_web=original_web.rotate(90) + o_thumb.save(staticdir+'/img/thumb/'+i.soundname) + o_web.save(staticdir+'/img/web/'+i.soundname) + raise web.seeother('/products/' + idvalue) + addproduct = self.form() + addproduct.fill(available='1', priority='1', type='physical',currency='euro') + goodies = None + if idvalue: + oldinfo = db.query("SELECT * FROM products WHERE id='"+idvalue+"';")[0] + addproduct.fill(name=oldinfo.name, description=oldinfo.description, type=oldinfo.type, currency=oldinfo.currency, price=oldinfo.price, available=oldinfo.available, priority=oldinfo.priority, category=oldinfo.category) + goodies = db.query("SELECT * FROM soundlink WHERE id='"+idvalue+"';") + listproducts = db.query("SELECT * FROM products ORDER BY priority DESC") + return renderop.products(addproduct, listproducts, goodies, idvalue, nocache) + else: + raise web.seeother('/login') + def POST(self, idvalue): + listproducts = db.query("SELECT * FROM products ORDER BY priority DESC") + addproduct = self.form() + if logged(): + i = web.input(imgfile={},name=None,description=None,price=1,available=1) + #for p in i:q + # print(p) + if i.name != None: + if idvalue: + db.update('products', where='id="'+idvalue+'"', category=i.category,name=i.name,description=i.description,type=i.type,currency=i.currency,price=i.price,available=i.available,priority=i.priority,dateadded=datetime.datetime.now()) + else: + idvalue = hashlib.sha256(str(random.getrandbits(256)).encode('utf-8')).hexdigest()[11:36] + db.insert('products', id=idvalue, category=i.category, name=i.name, description=i.description, type=i.type,currency=i.currency, price=i.price, available=i.available, sold=0, priority=i.priority, dateadded=datetime.datetime.now()) + if i.imgfile != {}: + if idvalue == '': + print('cant upload a picture to a non existing product') + raise web.seeother('/products/') + print(i.imgfile.filename) + if i.imgfile.filename == '': + print('hmmm... no image to upload') + raise web.seeother('/products/' + idvalue) + print('YEAH, Upload image!') + + ##---------- UPLOAD IMAGE ---------- + + filepath=i.imgfile.filename.replace('\\','/') # replaces the windows-style slashes with linux ones. + #split and only take the filename with extension + #soundpath=filepath.split('/')[-1] + #if soundpath == '': + # return render.nope("strange, no filename found!") + #get filetype, last three + imgname=filepath.split('/')[-1] # splits the and chooses the last part (the filename with extension) + filetype = imgname.split('.')[-1].lower() + if filetype == 'jpg': + filetype = 'jpeg' + soundname = imgname.split('.')[0] + #lets remove unwanted characters yes please! + sound = '' + for p in soundname.lower(): + if p in allowedchar: + sound = sound + p + if sound == '': + raise web.seeother('/upload?fail=wierdname') + soundname = sound + '.' + filetype + print(soundname) + print("filename is " + imgname + " filetype is " + filetype + " soundname is " + soundname + " trying to upload file from: " + filepath) + #if filetype != 'wav' or 'ogg' or 'flac' or 'jpeg' or 'jpg' or 'mp3': + # web.seeother('/upload?fail=notsupported') + #imghash = hashlib.md5(str(random.getrandbits(256)).encode('utf-8')).hexdigest() + #imgname = imghash + #imgname = str(len(os.listdir(imgdir))).zfill(3) + '.jpeg' + soundlink = hashlib.sha256(str(random.getrandbits(256)).encode('utf-8')).hexdigest()[9:36] + imgdir = staticdir+'upload/'+soundlink+'/' + os.system('mkdir -p ' + imgdir) + fout = open(imgdir + soundname,'wb') # creates the file where the uploaded file should be stored + fout.write(i.imgfile.file.read()) # writes the uploaded file to the newly created file. + fout.close() # closes the file, upload complete. + + ##----------CHECK IF SAME NAME THEN UPDATE------- + slink = db.query("SELECT * FROM soundlink WHERE id='"+idvalue+"' AND soundname='"+soundname+"';") + if slink: + db.update('soundlink', where='"id='+idvalue+'"', soundlink=soundlink, soundname=soundname, timeadded=datetime.datetime.now()) + else: + db.insert('soundlink', id=idvalue, soundlink=soundlink, soundname=soundname, timeadded=datetime.datetime.now()) + + if filetype == 'jpeg' or filetype == 'png': + ##---------- OPEN FILE & CHEKC IF JPEG -------- + + image = Image.open(imgdir +'/'+ soundname) + #if image.format != 'JPEG': + # os.remove(imgdir +'/'+ soundname) + # raise web.seeother('/products/' + idvalue) + + ##---------- RESIZE IMAGE SAVE TO PRODUCT----------- + + imgdir=staticdir+'img' + try: + os.makedirs(imgdir + '/web/', exist_ok=True) + os.makedirs(imgdir + '/thumb/', exist_ok=True) + except: + print('Folders is') + image.resize((900,900), Image.LANCZOS) + image.save(imgdir + '/web/'+soundname) + image.resize((300,300), Image.LANCZOS) + image.save(imgdir + '/thumb/'+soundname) + + return web.seeother('/products/' + idvalue) + else: + return web.seeother('/login') + +class shipping: + form = web.form.Form( + web.form.Textbox('country', web.form.notnull, description="Country:"), + web.form.Textbox('price', web.form.regexp(r'\d+', 'number thanx!'), web.form.notnull, description="Price in cents"), + web.form.Textbox('days', web.form.regexp(r'\d+', 'number thanx!'), web.form.notnull, description="Shipping in days"), + web.form.Button('Add shipping country')) + def GET(self, idvalue): + if logged(): + addcountry = self.form() + if idvalue: + oldinfo = db.select('shipping', where="id='"+idvalue+"'", what='country, price, days') + oldinfo = oldinfo[0] + addcountry.fill(country=oldinfo.country, price=oldinfo.price, days=oldinfo.days) + listcountries = db.query("SELECT * FROM shipping ORDER BY country DESC") + return renderop.shipping(addcountry, listcountries) + else: + raise web.seeother('/login') + def POST(self, idvalue): + if logged(): + addcountry = self.form() + if not addcountry.validates(): + listcountries = db.query("SELECT * FROM shipping ORDER BY country DESC") + return renderop.shipping(addcountry, listcountries) + else: + i = web.input() + if idvalue: + db.update('shipping', where='id="'+idvalue+'"', country=i.country, price=i.price, days=i.days) + else: + db.insert('shipping', country=i.country, price=i.price, days=i.days) + raise web.seeother('/shipping/') + else: + raise web.seeother('/login') + +class cv: + def GET(self): + return render.cv() + +class bitcoin: + def GET(self): + if logged(): + bitcoinrpc = AuthServiceProxy(rpcauth) + wallet = bitcoinrpc.getwalletinfo() + bitcoinrpc = None + return renderop.bitcoin(wallet) + + +application = app.wsgifunc() diff --git a/settings.py b/settings.py @@ -0,0 +1,20 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- + +#rpcauth +rpcauth = "http://madbaker:lkjd21089cn348hfejb5412783fbhj9232i4fdwq12g465gFSF@172.168.27.108:8332" +rtl="https://172.168.27.108:3002/v1/" + +#mail to webmaster +webmaster = "me@robinbackman.com" + +baseurl = "https://robinbackman.com" + +#op +allowed = (("rbckman", "l33thax0rz"),) + +postadmin="me@robinbackman.com" +postadmin_signature="\n-~-\nGreetings\nKing Robin\nHEART RANKED\nPeace!\nhttps://robinbackman.com/heartranked\nme@robinbackman.com\n" + + + diff --git a/settings.py.sample b/settings.py.sample @@ -0,0 +1,17 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- + +# Make your settings here and change filename to settings.py + +#rpcauth +rpcauth = "http://rpcserver:secrethash@ip:port" +rtl="https://ip:port/v1/" + +#mail to webmaster +webmaster = "your@mail.com" + +baseurl = "https://url.com" + +#op +allowed = (("admin", "secretpasscode"),) +