Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit ee8d86eb80b653b9179e627493838e747ce4721e @k3d3 committed Jan 21, 2012
Showing with 830 additions and 0 deletions.
  1. +413 −0 3d3paste.py
  2. +40 −0 README.md
  3. +239 −0 static/main.css
  4. +11 −0 views/error.tpl
  5. +30 −0 views/frontpage.tpl
  6. +10 −0 views/paste.tpl
  7. +29 −0 views/pasteauth.tpl
  8. +15 −0 views/topbar.tpl
  9. +29 −0 views/urlauth.tpl
  10. +14 −0 views/urlsub.tpl

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,40 @@
+# 3d3Paste
+3d3Paste is a simple, basic pastebin solution. It provides syntax highlighting and the ability to protect pastes with passwords.
+Paste URLs are also encded with base58 to ensure the URLs are short and memorable
+
+# Technologies
+We use Python 2, Bottlepy (transitioning to Flask), Pygments for syntax highlighting, and currently Fapws3 as a web server.
+For the storage of pastes and URLs, we use memcachedb and memcached with the cmemcached python plugin, however we are working to make this more modular.
+All pastes and URLs are serialized with MsgPack.
+
+# Installation and configuration
+Currently you need Python 2.7 along with the Bottlepy, Pygments, MsgPack, cmemcached and FapWS3 modules. FapWS3 can be replaced with any WSGI server given some work. The majority of these, if not all of them, can be installed through pip.
+Along with those modules, you need memcached and memcachedb servers running. Again, we are working to make this more modular.
+
+We have a configuration that load balances among 4 instances, therefore we have included 3 scripts, start_3d3p.sh, kill_3d3p.sh and watch_3d3p.sh, as examples of how to use 3d3Paste.
+You may also need to create an http user and group.
+
+# Demo
+We have a live 3d3Paste running at http://3d3.ca/
+
+# Usage
+Usage for 3d3Paste is simple. You can visit the website, enter a URL or paste, set the desired settings, and submit. That paste will now be available to anyone you give the link to, unless you set a password.
+
+In addition to the web interface, it's also possible to submit pastes via cURL. To submit a paste:
+`$ cat testing.txt | curl http://3d3.ca/ -F "paste=<-" -F "format=text" -F "p=mypassword" -F "title=mytitle"`
+`http://3d3.ca/rpa`
+This will return a link to the paste in raw form. You may also remove the initial r to access the web version of the paste, for example `http://3d3.ca/pa`
+The format, password and title are all optional. You may also remove the initial r to access the web version of the paste.
+
+To submit a URL to shorten:
+`$ echo http://www.example.com | curl http://3d3.ca -F "url=<-" -F "p=mypassword"`
+`http://3d3.ca/ruv`
+This will return a shortened link in raw form. A URL in raw form will be returned in plaintext rather than automatically forwarding.
+You can be redirected by removing the initial r, for example `http://3d3.ca/uv`
+
+# Additional Features
+We have also included a simple page to show your IP and reverse DNS, at `http://3d3.ca/i`
+You may remove this in the code if you feel the need.
+
+# License
+3d3Paste is released under the GPLv2. Absolutely no warranty, explicit or implied, is available. Read the header in 3d3paste.py for more information.
@@ -0,0 +1,239 @@
+.code { width:100%; margin:0px; padding:0px}
+.linenosdiv { background-color:#EEE }
+.linenos { border-right:1px solid #000; padding-right:5px }
+.linenos a { text-decoration: none }
+.highlighttable { margin:0px 10px 10px 10px; border:1px solid #000; background-color:#E8E8E8 }
+.highlight .hll { background-color: #EEE; padding:0px;margin:0px}
+.highlight { }
+.highlight .c { color: #408080; font-style: italic } /* Comment */
+.highlight .err { border: 1px solid #FF0000 } /* Error */
+.highlight .k { color: #008000; font-weight: bold } /* Keyword */
+.highlight .o { color: #666666 } /* Operator */
+.highlight .cm { color: #408080; font-style: italic } /* Comment.Multiline */
+.highlight .cp { color: #BC7A00 } /* Comment.Preproc */
+.highlight .c1 { color: #408080; font-style: italic } /* Comment.Single */
+.highlight .cs { color: #408080; font-style: italic } /* Comment.Special */
+.highlight .gd { color: #A00000 } /* Generic.Deleted */
+.highlight .ge { font-style: italic } /* Generic.Emph */
+.highlight .gr { color: #FF0000 } /* Generic.Error */
+.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
+.highlight .gi { color: #00A000 } /* Generic.Inserted */
+.highlight .go { color: #808080 } /* Generic.Output */
+.highlight .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
+.highlight .gs { font-weight: bold } /* Generic.Strong */
+.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
+.highlight .gt { color: #0040D0 } /* Generic.Traceback */
+.highlight .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
+.highlight .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
+.highlight .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
+.highlight .kp { color: #008000 } /* Keyword.Pseudo */
+.highlight .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
+.highlight .kt { color: #B00040 } /* Keyword.Type */
+.highlight .m { color: #666666 } /* Literal.Number */
+.highlight .s { color: #BA2121 } /* Literal.String */
+.highlight .na { color: #7D9029 } /* Name.Attribute */
+.highlight .nb { color: #008000 } /* Name.Builtin */
+.highlight .nc { color: #0000FF; font-weight: bold } /* Name.Class */
+.highlight .no { color: #880000 } /* Name.Constant */
+.highlight .nd { color: #AA22FF } /* Name.Decorator */
+.highlight .ni { color: #999999; font-weight: bold } /* Name.Entity */
+.highlight .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
+.highlight .nf { color: #0000FF } /* Name.Function */
+.highlight .nl { color: #A0A000 } /* Name.Label */
+.highlight .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
+.highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */
+.highlight .nv { color: #19177C } /* Name.Variable */
+.highlight .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
+.highlight .w { color: #bbbbbb } /* Text.Whitespace */
+.highlight .mf { color: #666666 } /* Literal.Number.Float */
+.highlight .mh { color: #666666 } /* Literal.Number.Hex */
+.highlight .mi { color: #666666 } /* Literal.Number.Integer */
+.highlight .mo { color: #666666 } /* Literal.Number.Oct */
+.highlight .sb { color: #BA2121 } /* Literal.String.Backtick */
+.highlight .sc { color: #BA2121 } /* Literal.String.Char */
+.highlight .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
+.highlight .s2 { color: #BA2121 } /* Literal.String.Double */
+.highlight .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
+.highlight .sh { color: #BA2121 } /* Literal.String.Heredoc */
+.highlight .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
+.highlight .sx { color: #008000 } /* Literal.String.Other */
+.highlight .sr { color: #BB6688 } /* Literal.String.Regex */
+.highlight .s1 { color: #BA2121 } /* Literal.String.Single */
+.highlight .ss { color: #19177C } /* Literal.String.Symbol */
+.highlight .bp { color: #008000 } /* Name.Builtin.Pseudo */
+.highlight .vc { color: #19177C } /* Name.Variable.Class */
+.highlight .vg { color: #19177C } /* Name.Variable.Global */
+.highlight .vi { color: #19177C } /* Name.Variable.Instance */
+.highlight .il { color: #666666 } /* Literal.Number.Integer.Long */
+
+body {
+ background-color: #DDD;
+}
+
+.topbar {
+ top:0px;
+ left:0px;
+ position:absolute;
+ border-bottom:1px solid #000;
+ background-color:#FFF;
+ width:100%;
+ vertical-align:text-center;
+ height: 25px;
+}
+
+.topbar a {
+ text-decoration: none
+}
+
+.topbar .tbtable {
+ margin:auto;
+ width:98%;
+ white-space:nowrap;
+}
+
+.topbar .tbtable .l {
+ text-align:left;
+ font-weight:bold;
+ width:34%;
+}
+
+.topbar .tbtable .m {
+ text-align:center;
+ font-weight:bold;
+ margin:auto;
+ width:34%;
+}
+
+.topbar .tbtable .r{
+ text-align:right;
+ font-size:12px;
+ width:34%;
+}
+
+.topbar .spacing {
+ position:relative;
+ height:10px;
+}
+
+.authbox {
+ position:relative;
+ border:1px solid #000;
+ text-align:center;
+ vertical-align:text-center;
+ margin: 20px auto;
+/* height:120px; */
+ width:400px;
+ padding:5px;
+}
+
+.authbox .bottom {
+ position:relative;
+ border:1px solid #000;
+ height:40px;
+ width:388px;
+ background:#DDD;
+ margin:5px 5px 5px 5px;
+ vertical-align:bottom;
+ vertical-align:text-bottom;
+}
+
+.authbox .bottom .input {
+ width:100%;
+}
+
+.authbox .bottom input {
+ border:1px solid #000;
+ background:#EEE;
+ height:25px;
+ margin:5px;
+ padding:0px;
+}
+
+.authbox .bottom .pwbox {
+ width:100%;
+}
+
+.authbox .bottom input:focus {
+ background:#FFF;
+}
+
+.authbox .bottom input:hover {
+ background:#FFF;
+}
+
+.submiturl {
+ background:#FFF;
+ border:1px solid #000;
+ margin:5px;
+ padding:0px;
+ height:70px;
+}
+
+.submiturl .urltable {
+ margin:5px 0px;
+ padding:0px 5px;
+ border-spacing:5px;
+}
+
+.submitpaste {
+ background:#FFF;
+ border:1px solid #000;
+ margin:5px;
+ padding:0px;
+}
+
+.submitpaste .pastetable {
+ margin:5px 0px;
+ padding:0px 5px;
+ border-spacing:5px;
+}
+
+.longtd {
+ width:100%;
+ font-weight:bold;
+}
+
+.longinput {
+ width:100%;
+ font-weight:bold;
+}
+
+input {
+ border:1px solid #000;
+ background:#EEE;
+ height:25px;
+ margin:5px 0px;
+ padding:2px;
+}
+
+input:focus {
+ background:#FFF;
+}
+
+input:hover {
+ background:#FFF;
+}
+
+textarea {
+ border:1px solid #000;
+ background:#EEE;
+ margin:5px 0px;
+ padding:2px;
+ width:100%;
+ height:300px;
+}
+
+textarea:focus {
+ background:#FFF;
+}
+
+.separate {
+ font-size:15px;
+ text-align:center;
+ font-weight:bold;
+}
+
+.url {
+ font-weight:bold;
+ font-style:italic;
+}
@@ -0,0 +1,11 @@
+<html>
+<head>
+ <link href="/static/main.css" rel="stylesheet" type="text/css">
+</head>
+<body>
+ %include topbar title=title, url=url, rurl=rurl
+ <div class="authbox" style="background-color:#FDD">
+ {{reason}}
+ </div>
+</body>
+</html>
@@ -0,0 +1,30 @@
+<html>
+<head>
+ <link href="/static/main.css" rel="stylesheet" type="text/css">
+</head>
+<body onLoad="document.urlpost.url.focus();document.urlpost.url.value=document.urlpost.url.value">
+ %include topbar title="3d3.ca Short URLs and Pastebin", url="http://3d3.ca/", rurl=None, passwd=None
+ <div class="separate">shorten a url</div>
+ <div class="submiturl">
+ <form name="urlpost" method="POST"><table class="urltable"><tr>
+ <td class="longtd">Shorten URL<br /><input class="longinput" type="text" name="url" value="http://"></td>
+ <td>Password<br /><input type="password" name="p"></td>
+ <td><br /><input type="submit" name="button" value="Shorten"></td>
+ </tr></table></form>
+ </div><br />
+ <div class="separate">or submit a paste</div>
+ <div class="submitpaste">
+ <form method="POST"><table class="pastetable">
+ <tr>
+ <td class="longtd">Paste Title<br /><input class="longinput" type="text" name="title"></td>
+ <td>Highlight As<br /><input type="text" name="format"></td>
+ <td>Password<br /><input type="password" name="p"></td>
+ <td><br /><input type="submit" name="button" value="Paste"></td>
+ </tr>
+ <tr>
+ <td colspan="4" class="longtd">Paste Contents<br /><textarea class="pastetext" name="paste"></textarea></tr>
+ </tr>
+ </table></form>
+ </div>
+</body>
+</html>
@@ -0,0 +1,10 @@
+<html>
+<head>
+ <link href="/static/main.css" rel="stylesheet" type="text/css">
+ <title> {{title}} ({{lexmode}})</title>
+</head>
+<body>
+ %include topbar title=title, url=url, rurl=rurl, passwd=passwd
+ {{!paste}}
+</body>
+</html>
@@ -0,0 +1,29 @@
+<html>
+<head>
+ <link href="/static/main.css" rel="stylesheet" type="text/css">
+</head>
+<body onLoad="document.pwbox.p.focus();">
+ %include topbar title="Password Protected", url=url, rurl=rurl, passwd=None
+ % if incorrect:
+ <div class="authbox" style="background-color:#FDD">
+ Password Incorrect.<br />
+ % else:
+ <div class="authbox" style="background-color:#FFF">
+ % end
+ Please enter the paste password
+ <div class="bottom">
+ <form name="pwbox" method="GET">
+ <table>
+ <tr>
+ <td class="input"><input class="pwbox" type="password" name="p"></td>
+ <td align="right"><input type="submit" value="Continue"></td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ % if incorrect:
+ </div>
+ % end
+ </div>
+</body>
+</html>
@@ -0,0 +1,15 @@
+<div class="topbar">
+ <table class="tbtable">
+ <tr>
+ <td class="l"><a href="http://3d3.ca/">3d3</a></td>
+ <td class="m">{{title}}</td>
+ <td class="r"><a href="{{url}}">{{url}}</a> \\
+ % if rurl and passwd:
+ <a href="{{rurl}}?p={{passwd}}">(raw)</a>\\
+ % elif rurl:
+ <a href="{{rurl}}">(raw)</a>\\
+ % end
+ </td></tr>
+ </table>
+ <div class="spacing"/>
+</div>
Oops, something went wrong.

0 comments on commit ee8d86e

Please sign in to comment.