Browse Source

i dunno database stuff maybe

master
Nabla 4 months ago
parent
commit
3cad1c3e7d
Signed by: nablachi GPG Key ID: 8B4F90E9D76DCD8B
  1. 41
      nekoct.py
  2. BIN
      static/spincat/images/fade.png
  3. 59
      static/spincat/style.css
  4. 14
      views/create.tpl

41
nekoct.py

@ -14,20 +14,43 @@ from argparse import ArgumentParser
app = Bottle()
@app.get('/')
def index():
def prepare(db):
db.execute('CREATE TABLE IF NOT EXISTS textcache (hash INTEGER PRIMARY KEY, data TEXT) WITHOUT ROWID')
db.execute('''CREATE TABLE IF NOT EXISTS boards (
id INTEGER PRIMARY KEY,
titlece INTEGER NOT NULL,
count INTEGER
) WITHOUT ROWID''')
db.execute('''CREATE TABLE IF NOT EXISTS posts (
board INTEGER NOT NULL,
postid INTEGER NOT NULL,
replyto INTEGER NOT NULL,
date INTEGER NOT NULL,
unamece INTEGER NOT NULL,
uuid INTEGER NOT NULL,
ptextce INTEGER NOT NULL,
PRIMARY KEY(board, postid, replyto)
) WITHOUT ROWID''')
db.execute('CREATE INDEX IF NOT EXISTS idx_posts_date ON posts (date)')
return
@app.get('/c')
def boardcreate():
return template("create.tpl")
@app.route('/')
def index(db):
prepare(db)
return
@app.post('/c')
def boardcreatea():
redirect("/")
@app.route('/c')
def boardcreate(db):
prepare(db)
return template("create.tpl")
@app.route('/b/<gbid:int>')
def boardview(gbid: int):
def boardview(gbid: int, db):
prepare(db)
return
@app.route('/static/<filename:path>')

BIN
static/spincat/images/fade.png

After

Width: 1  |  Height: 200  |  Size: 5.2 KiB

59
static/spincat/style.css

@ -0,0 +1,59 @@
/* Basic body configuration with some neat styling */
body {
background: #fef8ff url('images/fade.png') top center repeat-x;
text-rendering: optimizeSpeed;
font-family: verdana,arial,helvetica,sans-serif;
font-size: 12px;
color: #000;
padding: 0px;
margin: 0px;
}
/* Sane defaults */
* {
overflow-wrap: break-word;
}
input {
-moz-appearance: none;
-webkit-appearance: none;
appearance: none;
}
/* Input form box configuration */
.fbox {
position: relative;
margin: 16px;
border: 1px solid #4e00a5;
border-radius: 4px;
padding: 16px;
}
.fbox .btitle {
position: absolute;
top: -9px;
left: 16px;
padding: 2px 8px 2px 8px;
font-weight: bold;
border-radius: 4px;
background: repeating-linear-gradient(45deg, transparent, transparent 10px,#6100aa 10px, #6100aa 20px), linear-gradient(to bottom, #4e00a5, #330061);
color: #fff;
}
p {
margin: 0px 0px 8px 0px;
}

14
views/create.tpl

@ -1,6 +1,12 @@
% include('header.tpl')
<form method="POST">
<input type="text" name="bname" placeholder="Board name..."></input>
<input type="submit" value="Create"></input>
</form>
<div class="fbox">
<span class="btitle">Create a board</span>
<p>Creating a comment board is an irreversible procedure. The name chosen here is permanent. Upon creation, a random, unique identifier will be created for the board.</p>
<form method="GET">
<input type="text" name="bname" placeholder="Board name..."></input>
<input type="submit" value="Create"></input>
</form>
</div>
% include('footer.tpl')
Loading…
Cancel
Save