diff --git a/contrib/static/captcha.js b/contrib/static/captcha.js new file mode 100644 index 0000000..c769207 --- /dev/null +++ b/contrib/static/captcha.js @@ -0,0 +1,25 @@ +// +// sorry I can't think of any better way to do captcha ;~; +// + +window.addEventListener('load', function() { + // get new captcha + var ajax = new XMLHttpRequest(); + // get form elements for captcha + var elem_input = document.getElementById("captcha_input"); + var elem_img = document.getElementById("captcha_img"); + // prepare ajax + ajax.onreadystatechange = function(ev) { + if ( ajax.readyState == XMLHttpRequest.DONE && ajax.status == 200 ) { + // we succeeded + var captcha_id = ajax.responseText; + // set captcha id + elem_input.value = captcha_id; + // set captcha image + elem_img.src = "captcha/" + captcha_id + ".png"; + } + }; + // open and send the ajax request + ajax.open("GET", "captcha/new"); + ajax.send(); +}); diff --git a/contrib/static/mod.js b/contrib/static/mod.js new file mode 100644 index 0000000..0fcaae6 --- /dev/null +++ b/contrib/static/mod.js @@ -0,0 +1,74 @@ +/* + * mod.js, moderator page js stuff + */ + + +// TODO: implement mod panel all the way + +document.onload = function(ev) { + // populate the mod page with stuff +} + +function get_longhash(str) { + var idx = str.indexOf("#") + 1; + if ( idx > 0 ) { + str = str.substr(idx); + } + console.log(str); + return str; +} + +// handle delete command +function nntpchan_delete() { + // get the element + var input = document.getElementById("nntpchan_mod_delete"); + // get the long hash + var longhash = get_longhash(input.value); + // TODO: check long hash + + + var elem = document.getElementById("nntpchan_mod_result"); + // clear old results + while( elem.firstChild ) { + elem.removeChild(elem.firstChild); + } + // fire off ajax + var ajax = new XMLHttpRequest(); + ajax.onreadystatechange = function() { + if (ajax.readyState == XMLHttpRequest.DONE) { + var status = ajax.status; + // we gud? + if (status == 200) { + // yah + var txt = ajax.responseText; + var j = JSON.parse(txt); + if (j.error) { + var e = document.createTextNode(j.error); + elem.appendChild(e); + } else { + if ( j.deleted ) { + for ( var idx = 0 ; idx < j.deleted.length ; idx ++ ) { + var deltxt = "deleted " + j.deleted[idx]; + var e = document.createTextNode(deltxt); + elem.appendChild(e); + } + } + if ( j.notdeleted ) { + for ( var idx = 0 ; idx < j.notdeleted.length ; idx ++ ) { + var deltxt = "failed to delete " + j.notdeleted[idx]; + var e = document.createTextNode(deltxt); + elem.appendChild(e); + } + } + } + } else { + // nah + // http error + elem.innerHTML = "error: HTTP "+status; + } + input.value = ""; + } + } + ajax.open("GET", "del/"+longhash); + ajax.send(); +} diff --git a/contrib/static/site.css b/contrib/static/site.css new file mode 100644 index 0000000..3233be3 --- /dev/null +++ b/contrib/static/site.css @@ -0,0 +1,59 @@ +.thread { + margin_right: 20px; + margin_bottom: 5px; +} + +.frontend , .subject { + color: #0f0d2d; +} + +.name { + color: #117743; +} + + +.name , .subject { + font-weight: bold; +} + +.post { + background: #d6daf0; + padding: 10px; +} + +body { + background: #eef2ff; +} + +.reply { + margin-left: 1.8em; + display: inline-block; +} + +.frontend { + margin-top: 0px; + background: #e0f0f0; + display: inline-block; +} + +.op { + background: #eef2ff; + margin-right: 20px; + margin-bottom: 10px; +} + +.post, .post_body { + margin-top: 5px; + margin-bottom: 5px; + padding-right: 3em; + padding-bottom: 0.3em; +} + + +.tripcode { + color: #de04ef; +} + +.memearrows { + color: green; +} \ No newline at end of file diff --git a/contrib/static/user.css b/contrib/static/user.css new file mode 100644 index 0000000..e69de29 diff --git a/contrib/templates/default/attachment.mustache b/contrib/templates/default/attachment.mustache new file mode 100644 index 0000000..e69de29 diff --git a/contrib/templates/default/board.mustache b/contrib/templates/default/board.mustache new file mode 100644 index 0000000..c2e49fb --- /dev/null +++ b/contrib/templates/default/board.mustache @@ -0,0 +1,34 @@ + + + + + + {{board.Board}} + + + + {{{board.RenderNavbar}}} + + + +
+ {{{form}}} +
+
+
+ {{#board.Threads}} +
+
+
+ {{{OP.RenderPost}}} + {{#Replies}} + {{{RenderPost}}} +
+ {{/Replies}} +
+
+
+ {{/board.Threads}} +
+ + diff --git a/contrib/templates/default/keygen.mustache b/contrib/templates/default/keygen.mustache new file mode 100644 index 0000000..c9765f0 --- /dev/null +++ b/contrib/templates/default/keygen.mustache @@ -0,0 +1,12 @@ + + + + + here is a new tripcode + + +
New Tripcode:
+      
secret: {{secret}}
public: {{public}}
tripcode: {{{tripcode}}}
+
+ + \ No newline at end of file diff --git a/contrib/templates/default/modlogin.mustache b/contrib/templates/default/modlogin.mustache new file mode 100644 index 0000000..9d06df8 --- /dev/null +++ b/contrib/templates/default/modlogin.mustache @@ -0,0 +1,13 @@ + + + + login + + +
+ + + +
+ + diff --git a/contrib/templates/default/modlogin_result.mustache b/contrib/templates/default/modlogin_result.mustache new file mode 100644 index 0000000..e422b75 --- /dev/null +++ b/contrib/templates/default/modlogin_result.mustache @@ -0,0 +1,10 @@ + + + + + login + + +

{{message}}

+ + \ No newline at end of file diff --git a/contrib/templates/default/modpage.mustache b/contrib/templates/default/modpage.mustache new file mode 100644 index 0000000..2084838 --- /dev/null +++ b/contrib/templates/default/modpage.mustache @@ -0,0 +1,23 @@ + + + + + + nntpchan mod page + + +
+
post actions
+
+
+ + +
+ + +
+ + + diff --git a/contrib/templates/default/navbar.mustache b/contrib/templates/default/navbar.mustache new file mode 100644 index 0000000..9e453da --- /dev/null +++ b/contrib/templates/default/navbar.mustache @@ -0,0 +1,7 @@ +
+
+ {{{board.Name}}} + on + {{{board.Frontend}}} +
+
\ No newline at end of file diff --git a/contrib/templates/default/op.mustache b/contrib/templates/default/op.mustache new file mode 100644 index 0000000..e69de29 diff --git a/contrib/templates/default/post.mustache b/contrib/templates/default/post.mustache new file mode 100644 index 0000000..9686845 --- /dev/null +++ b/contrib/templates/default/post.mustache @@ -0,0 +1,37 @@ +
+

+ + No. {{ShortHash}} + {{#OP}} + [reply] + {{/OP}} +

+

+ [[ {{Frontend}} ]] +

+
+ {{#Attachments}} + + {{Filename}} + + {{/Attachments}} +
+
{{{RenderBody}}}
+
\ No newline at end of file diff --git a/contrib/templates/default/post_fail.mustache b/contrib/templates/default/post_fail.mustache new file mode 100644 index 0000000..36c63ca --- /dev/null +++ b/contrib/templates/default/post_fail.mustache @@ -0,0 +1,6 @@ + + + +

post failed: {{reason}}

+ + \ No newline at end of file diff --git a/contrib/templates/default/post_success.mustache b/contrib/templates/default/post_success.mustache new file mode 100644 index 0000000..5f0718f --- /dev/null +++ b/contrib/templates/default/post_success.mustache @@ -0,0 +1,6 @@ + + + +
posted as {{message_id}}
+ + \ No newline at end of file diff --git a/contrib/templates/default/postform.mustache b/contrib/templates/default/postform.mustache new file mode 100644 index 0000000..cb27660 --- /dev/null +++ b/contrib/templates/default/postform.mustache @@ -0,0 +1,64 @@ +{{! + postform.mustache + template parameters: + - post_url ( the url of the post form ) + - reference ( the post we are replying to, or empty string if it's an op ) + - button ( the text for the reply button ) + }} +

posting

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Name + + +
+ Subject + + + +
+ Comment + + +
+ File + + +
+ Captcha + + captcha +
+ + +
+
diff --git a/contrib/templates/default/postreply.mustache b/contrib/templates/default/postreply.mustache new file mode 100644 index 0000000..6f566c0 --- /dev/null +++ b/contrib/templates/default/postreply.mustache @@ -0,0 +1,33 @@ +
+

+

+
+ {{#Image}} + + + + {{/Image}} +
+
+ {{{RenderBody}}} +
+
\ No newline at end of file diff --git a/contrib/templates/default/static_base.mustache b/contrib/templates/default/static_base.mustache new file mode 100644 index 0000000..1d5d67d --- /dev/null +++ b/contrib/templates/default/static_base.mustache @@ -0,0 +1,9 @@ + + + + {{title}} + + + {{{content}}} + + \ No newline at end of file diff --git a/contrib/templates/default/thread.mustache b/contrib/templates/default/thread.mustache new file mode 100644 index 0000000..ab972e9 --- /dev/null +++ b/contrib/templates/default/thread.mustache @@ -0,0 +1,26 @@ + + + + + + {{thread.OP.Subject}} + + + +
+ {{{form}}} +
+
+
+
+
+ {{{thread.OP.RenderPost}}} + {{# repls}} + {{{RenderPost}}} +
+ {{/ repls}} +
+
+
+ + \ No newline at end of file diff --git a/contrib/templates/default/ukko.mustache b/contrib/templates/default/ukko.mustache new file mode 100644 index 0000000..ccfb984 --- /dev/null +++ b/contrib/templates/default/ukko.mustache @@ -0,0 +1,26 @@ + + + ukko + + + + +
+ {{#threads}} +
+

Posted on {{OP.Board}}

+
+
+
+
+ {{{OP.RenderPost}}} + {{#Replies}} + {{{RenderPost}}} +
+ {{/Replies}} +
+
+ {{/threads}} +
+ + diff --git a/contrib/templates/keygen.mustache b/contrib/templates/keygen.mustache new file mode 100644 index 0000000..5624825 --- /dev/null +++ b/contrib/templates/keygen.mustache @@ -0,0 +1,13 @@ + + + + here is a new tripcode + + +
New Tripcode:
+      secret: {{secret}}
+      public: {{public}}
+      tripcode: {{tripcode}}
+    
+ + \ No newline at end of file