commit 1c45c7f7cd6a60f074c9f6608c3b6ac2133d0473 Author: Jake Paul Date: Sun Nov 23 00:01:12 2025 -0600 reupload diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..2e028ca --- /dev/null +++ b/.env.example @@ -0,0 +1,3 @@ +PROXY=wsrv.nl +RULES=./jurisdiction.txt +DATABASE="./posts.json" \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a7d4056 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +__pycache__/ +testing.json +templates/test.html +.env \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..3f59a95 --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# buddyboard +An imageboard for friends written in Flask. Uses a flatfile (json) database, and strongly encourages hotlinking of images. + +# Caveats +- No admin panel/way to delete posts autonomously (yet) +- jQuery functions are partially wonky +- No one's going to use this crap +- Written in Flask + - *Novice* Flask, may I add + +# How to install +*Don't!* + +- `pip install -r requirements.txt` +- `py -u ./main.py` or deployable equivalent + - *Again, never deploy this code!* + +# How to contribute +*Don't!* + +# Credits +- Stack Overflow +- AI for tips on how to refactor the stupid ass reply route +- Early testers who Shall Not Be Named \ No newline at end of file diff --git a/jurisdiction.txt b/jurisdiction.txt new file mode 100644 index 0000000..c913bd1 --- /dev/null +++ b/jurisdiction.txt @@ -0,0 +1,3 @@ +No slurs +No prejudice +Be nice \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..50438d5 --- /dev/null +++ b/main.py @@ -0,0 +1,117 @@ + +from flask import Flask, render_template, request, redirect, url_for +from markupsafe import escape +import os +import json +import uuid +from dotenv import load_dotenv, dotenv_values +# from werkzeug.routing import IntegerConverter +from flask_limiter import Limiter +from flask_limiter.util import get_remote_address + +app = Flask(__name__) +limiter = Limiter(get_remote_address, app=app) +load_dotenv() + +database = os.getenv("DATABASE") + +def postsExist(): + try: + with open(os.getenv("DATABASE"), 'a') as f: + pass + except IOError as e: + print(f"Error ensuring posts exist: {e}") + +@app.before_request +def before_request(): + postsExist() + +@app.route('/', methods=['GET']) +def index(): + try: + with open(database, "r", encoding='utf-8') as data: + posts = json.load(data) + except FileNotFoundError: + print("posts.json not found, starting fresh.") + except Exception as e: + print(f"Error reading posts.json: {e}") + return "An error occurred while loading posts. Please try again later.", 500 + + return render_template("main.html", posts=posts, proxy=os.getenv("PROXY")) + +@app.route('/reply/', methods=['GET']) +def replyIndex(post_id): + try: + with open(database, "r", encoding='utf-8') as data: + replies = json.load(data) + except FileNotFoundError: + print("posts.json not found, starting fresh.") + except Exception as e: + print(f"Error reading posts.json: {e}") + return "An error occurred while loading posts. Please try again later.", 500 + + parent_post = next((p for p in replies if p.get('id') == post_id), None) + if parent_post is None: + return "Post not found", 404 + + return render_template('reply.html', post=parent_post, replies=replies, proxy=os.getenv("PROXY")) + +@app.route('/vote//', methods=['POST']) +@limiter.limit("8/day", key_func=get_remote_address) +def rate(post, rating): + try: + with open(database, "r+", encoding='utf-8') as data: + posts = json.load(data) + found = False + for i in posts: + if i['id'] == post: + i['yeahs'] += rating + found = True + break + + if not found: + data = { + "status": 404 + } + return data + + data.seek(0) + json.dump(posts, data, indent=4) + data = { + "status": 200 + } + return data + except Exception as e: + print(f"Error reading posts.json: {e}") + return "An error occurred while loading posts. Please try again later.", 500 + +@app.route('/reply/', methods=['POST']) +@app.route('/', methods=['POST']) +def add_data(post_id=None): + + post = {} + post['id'] = str(uuid.uuid1()) + post['user'] = request.form.get('user', '').strip() or 'anon' + post['content'] = escape(request.form.get('data', '')) + post['yeahs'] = 0 + post['replying'] = post_id or None + post['image'] = request.form.get('image', '') or None + + if not post: + return "Say something!", 400 + + + final_user_name = post['user'] if post['user'] else 'anon' + try: + with open(database, "r+", encoding='utf-8') as read: + file = json.load(read) + file.append(post) + with open(database, "w", encoding='utf-8') as write: + json.dump(file, write, indent=4) + return redirect(request.path) + except Exception as e: + print(f"Error writing to posts.json: {e}") + return "An error occurred while saving your post. Please try again.", 500 + +if __name__ == '__main__': + app.run(host='0.0.0.0', port=8000, debug=True) diff --git a/posts.json b/posts.json new file mode 100644 index 0000000..3d8018d --- /dev/null +++ b/posts.json @@ -0,0 +1,10 @@ +[ + { + "id": "34282e73-c446-11f0-a6b9-30d0421378ab", + "user": "zav", + "content": "Buddyboard is (partially) back in business!\r\n\r\nFrom testing database:\r\n"Fixes include:- less crappy reply function (sorry)- 50% less AI code (also sorry)- Actual image linking! No more bullshit syntax! (also also ALSO sorry)"\r\n\r\nHave fun!", + "yeahs": 0, + "replying": null, + "image": "https://snootbooru.com/data/posts/73546_b28e019fcffbd588.png" + } +] \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..87c9cab Binary files /dev/null and b/requirements.txt differ diff --git a/static/jquery-3.7.1.slim.min.js b/static/jquery-3.7.1.slim.min.js new file mode 100644 index 0000000..35906b9 --- /dev/null +++ b/static/jquery-3.7.1.slim.min.js @@ -0,0 +1,2 @@ +/*! jQuery v3.7.1 -ajax,-ajax/jsonp,-ajax/load,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-deprecated/ajax-event-alias,-effects,-effects/animatedSelector,-effects/Tween | (c) OpenJS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(ie,e){"use strict";var oe=[],r=Object.getPrototypeOf,ae=oe.slice,g=oe.flat?function(e){return oe.flat.call(e)}:function(e){return oe.concat.apply([],e)},s=oe.push,se=oe.indexOf,n={},i=n.toString,ue=n.hasOwnProperty,o=ue.toString,a=o.call(Object),le={},v=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},y=function(e){return null!=e&&e===e.window},m=ie.document,u={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||m).createElement("script");if(o.text=e,t)for(r in u)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[i.call(e)]||"object":typeof e}var t="3.7.1 -ajax,-ajax/jsonp,-ajax/load,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-deprecated/ajax-event-alias,-effects,-effects/animatedSelector,-effects/Tween",l=/HTML$/i,ce=function(e,t){return new ce.fn.init(e,t)};function c(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!v(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+ge+")"+ge+"*"),b=new RegExp(ge+"|>"),A=new RegExp(g),D=new RegExp("^"+t+"$"),N={ID:new RegExp("^#("+t+")"),CLASS:new RegExp("^\\.("+t+")"),TAG:new RegExp("^("+t+"|[*])"),ATTR:new RegExp("^"+d),PSEUDO:new RegExp("^"+g),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ge+"*(even|odd|(([+-]|)(\\d*)n|)"+ge+"*(?:([+-]|)"+ge+"*(\\d+)|))"+ge+"*\\)|)","i"),bool:new RegExp("^(?:"+f+")$","i"),needsContext:new RegExp("^"+ge+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ge+"*((?:-\\d)?\\d*)"+ge+"*\\)|)(?=[^-]|$)","i")},L=/^(?:input|select|textarea|button)$/i,j=/^h\d$/i,O=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,P=/[+~]/,H=new RegExp("\\\\[\\da-fA-F]{1,6}"+ge+"?|\\\\([^\\r\\n\\f])","g"),q=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},R=function(){V()},M=K(function(e){return!0===e.disabled&&fe(e,"fieldset")},{dir:"parentNode",next:"legend"});try{E.apply(oe=ae.call(ye.childNodes),ye.childNodes),oe[ye.childNodes.length].nodeType}catch(e){E={apply:function(e,t){me.apply(e,ae.call(t))},call:function(e){me.apply(e,ae.call(arguments,1))}}}function I(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,d=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==d&&9!==d&&11!==d)return n;if(!r&&(V(e),e=e||C,T)){if(11!==d&&(u=O.exec(t)))if(i=u[1]){if(9===d){if(!(a=e.getElementById(i)))return n;if(a.id===i)return E.call(n,a),n}else if(f&&(a=f.getElementById(i))&&I.contains(e,a)&&a.id===i)return E.call(n,a),n}else{if(u[2])return E.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&e.getElementsByClassName)return E.apply(n,e.getElementsByClassName(i)),n}if(!(h[t+" "]||p&&p.test(t))){if(c=t,f=e,1===d&&(b.test(t)||m.test(t))){(f=P.test(t)&&X(e.parentNode)||e)==e&&le.scope||((s=e.getAttribute("id"))?s=ce.escapeSelector(s):e.setAttribute("id",s=k)),o=(l=Y(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+G(l[o]);c=l.join(",")}try{return E.apply(n,f.querySelectorAll(c)),n}catch(e){h(t,!0)}finally{s===k&&e.removeAttribute("id")}}}return re(t.replace(ve,"$1"),e,n,r)}function W(){var r=[];return function e(t,n){return r.push(t+" ")>x.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function B(e){return e[k]=!0,e}function F(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function $(t){return function(e){return fe(e,"input")&&e.type===t}}function _(t){return function(e){return(fe(e,"input")||fe(e,"button"))&&e.type===t}}function z(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&M(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function U(a){return B(function(o){return o=+o,B(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function X(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function V(e){var t,n=e?e.ownerDocument||e:ye;return n!=C&&9===n.nodeType&&n.documentElement&&(r=(C=n).documentElement,T=!ce.isXMLDoc(C),i=r.matches||r.webkitMatchesSelector||r.msMatchesSelector,r.msMatchesSelector&&ye!=C&&(t=C.defaultView)&&t.top!==t&&t.addEventListener("unload",R),le.getById=F(function(e){return r.appendChild(e).id=ce.expando,!C.getElementsByName||!C.getElementsByName(ce.expando).length}),le.disconnectedMatch=F(function(e){return i.call(e,"*")}),le.scope=F(function(){return C.querySelectorAll(":scope")}),le.cssHas=F(function(){try{return C.querySelector(":has(*,:jqfake)"),!1}catch(e){return!0}}),le.getById?(x.filter.ID=function(e){var t=e.replace(H,q);return function(e){return e.getAttribute("id")===t}},x.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&T){var n=t.getElementById(e);return n?[n]:[]}}):(x.filter.ID=function(e){var n=e.replace(H,q);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},x.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&T){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),x.find.TAG=function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):t.querySelectorAll(e)},x.find.CLASS=function(e,t){if("undefined"!=typeof t.getElementsByClassName&&T)return t.getElementsByClassName(e)},p=[],F(function(e){var t;r.appendChild(e).innerHTML="",e.querySelectorAll("[selected]").length||p.push("\\["+ge+"*(?:value|"+f+")"),e.querySelectorAll("[id~="+k+"-]").length||p.push("~="),e.querySelectorAll("a#"+k+"+*").length||p.push(".#.+[+~]"),e.querySelectorAll(":checked").length||p.push(":checked"),(t=C.createElement("input")).setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),r.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&p.push(":enabled",":disabled"),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||p.push("\\["+ge+"*name"+ge+"*="+ge+"*(?:''|\"\")")}),le.cssHas||p.push(":has"),p=p.length&&new RegExp(p.join("|")),l=function(e,t){if(e===t)return a=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!le.sortDetached&&t.compareDocumentPosition(e)===n?e===C||e.ownerDocument==ye&&I.contains(ye,e)?-1:t===C||t.ownerDocument==ye&&I.contains(ye,t)?1:o?se.call(o,e)-se.call(o,t):0:4&n?-1:1)}),C}for(e in I.matches=function(e,t){return I(e,null,null,t)},I.matchesSelector=function(e,t){if(V(e),T&&!h[t+" "]&&(!p||!p.test(t)))try{var n=i.call(e,t);if(n||le.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){h(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(H,q),e[3]=(e[3]||e[4]||e[5]||"").replace(H,q),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||I.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&I.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return N.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&A.test(n)&&(t=Y(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(H,q).toLowerCase();return"*"===e?function(){return!0}:function(e){return fe(e,t)}},CLASS:function(e){var t=s[e+" "];return t||(t=new RegExp("(^|"+ge+")"+e+"("+ge+"|$)"))&&s(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=I.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function T(e,n,r){return v(n)?ce.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?ce.grep(e,function(e){return e===n!==r}):"string"!=typeof n?ce.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(ce.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||E,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:k.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof ce?t[0]:t,ce.merge(this,ce.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:m,!0)),C.test(r[1])&&ce.isPlainObject(t))for(r in t)v(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=m.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):v(e)?void 0!==n.ready?n.ready(e):e(ce):ce.makeArray(e,this)}).prototype=ce.fn,E=ce(m);var S=/^(?:parents|prev(?:Until|All))/,A={children:!0,contents:!0,next:!0,prev:!0};function D(e,t){while((e=e[t])&&1!==e.nodeType);return e}ce.fn.extend({has:function(e){var t=ce(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,Ce=/^$|^module$|\/(?:java|ecma)script/i;re=m.createDocumentFragment().appendChild(m.createElement("div")),(be=m.createElement("input")).setAttribute("type","radio"),be.setAttribute("checked","checked"),be.setAttribute("name","t"),re.appendChild(be),le.checkClone=re.cloneNode(!0).cloneNode(!0).lastChild.checked,re.innerHTML="",le.noCloneChecked=!!re.cloneNode(!0).lastChild.defaultValue,re.innerHTML="",le.option=!!re.lastChild;var Te={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function Ee(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&fe(e,t)?ce.merge([e],n):n}function ke(e,t){for(var n=0,r=e.length;n",""]);var Se=/<|&#?\w+;/;function Ae(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),d=[],p=0,h=e.length;p\s*$/g;function Re(e,t){return fe(e,"table")&&fe(11!==t.nodeType?t:t.firstChild,"tr")&&ce(e).children("tbody")[0]||e}function Me(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Ie(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function We(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(_.hasData(e)&&(s=_.get(e).events))for(i in _.remove(t,"handle events"),s)for(n=0,r=s[i].length;n
",2===yt.childNodes.length),ce.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(le.createHTMLDocument?((r=(t=m.implementation.createHTMLDocument("")).createElement("base")).href=m.location.href,t.head.appendChild(r)):t=m),o=!n&&[],(i=C.exec(e))?[t.createElement(i[1])]:(i=Ae([e],t,o),o&&o.length&&ce(o).remove(),ce.merge([],i.childNodes)));var r,i,o},ce.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=ce.css(e,"position"),c=ce(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=ce.css(e,"top"),u=ce.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),v(t)&&(t=t.call(e,n,ce.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},ce.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){ce.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===ce.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===ce.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=ce(e).offset()).top+=ce.css(e,"borderTopWidth",!0),i.left+=ce.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-ce.css(r,"marginTop",!0),left:t.left-i.left-ce.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===ce.css(e,"position"))e=e.offsetParent;return e||K})}}),ce.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;ce.fn[t]=function(e){return R(this,function(e,t,n){var r;if(y(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),ce.each(["top","left"],function(e,n){ce.cssHooks[n]=Qe(le.pixelPosition,function(e,t){if(t)return t=Ve(e,n),$e.test(t)?ce(e).position()[n]+"px":t})}),ce.each({Height:"height",Width:"width"},function(a,s){ce.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){ce.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return R(this,function(e,t,n){var r;return y(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?ce.css(e,t,i):ce.style(e,t,n,i)},s,n?e:void 0,n)}})}),ce.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.on("mouseenter",e).on("mouseleave",t||e)}}),ce.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){ce.fn[n]=function(e,t){return 0 { + if (messageContainer && messageContainer.parentNode) { + messageContainer.parentNode.removeChild(messageContainer); + } + }, 1500); +} \ No newline at end of file diff --git a/static/nah.png b/static/nah.png new file mode 100644 index 0000000..9a5de29 Binary files /dev/null and b/static/nah.png differ diff --git a/static/style.css b/static/style.css new file mode 100644 index 0000000..7e5f660 --- /dev/null +++ b/static/style.css @@ -0,0 +1,57 @@ +/* woekwewe */ +html { background:#595656; color: white;} +textarea { resize: none; border: 1px Solid;} +h1 { display: inline; margin: 0; padding: 0;} +.container { width: 60%; margin: auto; } +.nav { padding-left: 0px !important; padding:5px; } +.overlay::after {position: fixed; top: 10%; left: 10%; font-size: 24px; color: white; content: "Click away to exit...";} +.overlay { + position: fixed; + top: 0; + left: 0; + width: 100vw; + height: 100vh; + background-color: rgba(0, 0, 0, 0.85); + z-index: 9999; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + padding: 20px; + box-sizing: border-box; +} +.mod { + color: rgb(182, 0, 0); +} + +img:hover { + cursor: pointer; +} + +a { + color:blueviolet; +} + +textarea[disabled] { + background: darkgrey; +} +.replies { + margin: 2em; +} + +#notification { + font-size: 24px; +} + +.replies { + margin-left: 10px; +} + + +th { + text-align: left; +} + +a { + color: rgb(161, 161, 161); +} \ No newline at end of file diff --git a/static/threads.js b/static/threads.js new file mode 100644 index 0000000..a92aeab --- /dev/null +++ b/static/threads.js @@ -0,0 +1,9 @@ +// threads.js +// by lua (zav@tbdpowered.net) + +function toggleContent(contentId, toggleElement) { + $("." + contentId).toggle(); + + var $toggle = $(toggleElement); + $toggle.text( ($toggle.text() == '[-]' ? '[+]' : '[-]') ); +} \ No newline at end of file diff --git a/static/yeah.png b/static/yeah.png new file mode 100644 index 0000000..5c914af Binary files /dev/null and b/static/yeah.png differ diff --git a/templates/header.html b/templates/header.html new file mode 100644 index 0000000..bdbcb37 --- /dev/null +++ b/templates/header.html @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/templates/main.html b/templates/main.html new file mode 100644 index 0000000..aaee686 --- /dev/null +++ b/templates/main.html @@ -0,0 +1,75 @@ + + + + + + /buddy/ + + + + + +
+ {% include 'header.html' %} +
+ + + + + + + + + + + + + + +
Name
Image
Content
+
+ +
+ {% for post in posts | reverse %} + {% if post.replying == "pin" %} +
+
+ [-] [Pinned] + {% if post.ip == "127.0.0.1" and post.user == "*" %}{{ mod }} [M]{% else %}{{ post.user }}{% endif %} • + {{post.yeahs}} Reply +
+
+ {% if post.image %} + Embedded image from {{ post.image }} + {% endif %} +

{{ post.content | replace('\n', '
') | safe }}

+
+
+ {% endif %} + {% endfor %} + {% for post in posts | reverse %} + {% if post.replying == None %} +
+
+ [-] + {% if post.ip == "127.0.0.1" and post.user == "*" %}{{ mod }} [M]{% else %}{{ post.user }}{% endif %} • + {{post.yeahs}} Reply +
+
+ {% if post.image %} + Embedded image from {{ post.image }} + {% endif %} +

{{ post.content | replace('\n', '
') | safe }}

+
+
+ {% endif %} + {% else %} +

No messages yet. Be the first to post!

+ {% endfor %} +
+
+ This service is ran on buddyboard • source code +
+ + + \ No newline at end of file diff --git a/templates/reply.html b/templates/reply.html new file mode 100644 index 0000000..182c308 --- /dev/null +++ b/templates/reply.html @@ -0,0 +1,76 @@ + + + + + + /buddy/ + + + + + +
+ {% include 'header.html' %} +
+ + + + + + + + + + + + + + + +
Name
Image
Content
+
+ +
+
+
+ [-] + {% if post.ip == "127.0.0.1" and post.user == "*" %}{{ mod }} [M]{% else %}{{ post.user }}{% endif %} • + {{post.yeahs}} Reply +
+
+ {% if post.image %} + Embedded image from {{ post.image }} + {% endif %} +

{{ post.content | replace('\n', '
') | safe }}

+
+
+ [-] {{ replies|count - 1}} replies... +
+ {% for p in replies | reverse %} + {% if p.replying == post.id %} +
+
+ [-] + {{p.user}} • + {{p.yeahs}} Reply +
+
+ {% if p.image %} + Embedded image from {{ p.image }} + {% endif %} +

{{ p.content | replace('\n', '
') | safe }}

+
+
+ {% endif %} + {% else %} +

No messages yet. Be the first to post!

+ {% endfor %} +
+ +
+
+ This service is ran on buddyboard • source code +
+ + + \ No newline at end of file