Coder Social home page Coder Social logo

landonpowell / seafour Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 7.0 26.7 MB

[Copyright (c) 2015 Landon Powell]

Home Page: http://seafour.pro/

License: Other

JavaScript 95.85% CSS 2.61% HTML 1.12% Makefile 0.18% Shell 0.06% Perl 0.18%
chat websocket cryptography asymmetric sea four seafour c4

seafour's Introduction

SeaFour

Running instance at https://seafour.pro/

Powered by Node.js

Depends Upon

  • Node.JS
  • Express
  • MongoDB
  • ImageMagick
  • WS & HTTP

Donate Bitcoin at 1Bmo74LBR6PFBtdsMnFms1rLqYFVDXCyvG

Developer Notes

The key files responsible for the functionality of the site are server.js and public/client.js.

Indents should be done in the Stroustrup variant of K&R style using 4-space indents like so:

if (x) {
    console.log("Ja!");
}
else {
    console.log("Nein!");
}

Whenver possible, fuctions should be defined like so:

function funcName(args) {
    return args + 1;
}

To Run

  • First, change directory to the location of your SeaFour folder. For me, this would be

    cd ~/Prog/WebDev/SeaFour/

  • Next, npm install the dependencies in package.json.

    npm install package.json

  • Finally, run node's server.js file.

    node server.js

  • You're now running SeaFour.

Copyright (c) 2015 Landon Powell

seafour's People

Contributors

jwts avatar landonpowell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

seafour's Issues

Parser location

The parser is located in client.js, which can be modified and then used to inject HTML. I've managed to inject anchors and iframes successfully on a local session by modifying the client.js.

"listening on *:undefined"

When starting server.js, it listens on a random port because of its use of environment variables.
i.e. http.listen(process.env.PORT, function(){. This means PORT must be declared when running server.js (PORT=8080 node server.js), otherwise a random port will be chosen.

unban me

can you unban me (here is some copy and pasting for proof):
Type your message here.
Account Users - 0
Log In
Handle

Passphrase
Log into SeaFour
Sign Up
Handle

Passphrase

Confirm it
Sign Up for SeaFour
Continue as a Guest

Parser is simply .replace()

The problem with the current setup is that one can't do things such as (*(%this is bold and italics)).
So instead I recommend writing a grammar for something such as PEG.js and using that.

Example:

sentence = s:(basic / .)* { return s.join('') }
inside = s:(basic / [^)] )+ { return s.join(''); }
basic = extra / escaped / styled / href / html

extra = '\n' { return '<br />'; }
escaped = '\\' c:(special / html / .) { return c; }

special = newline / tab
tab = 't' { return '&nbsp;&nbsp;&nbsp;&nbsp;'; }
newline = 'n' { return '<br />'; }

html = amp / lt / gt / space / apos / quot / bsol
amp = '&' { return '&amp;' }
lt = '<' { return '&lt;' }
gt = '>' { return '&gt;' }
space = ' ' { return '&nbsp;' }
apos = "'" { return '&apos;' }
quot = '"' { return '&quot;' }
bsol = '\\' { return '&bsol;' }

styled = '(' s:(bold / italic / meme / spoiler / ghost / big / rainbow / color / link) ')' { return s; }

bold = '*' ' '? s:inside { return '<strong>' + s + '</strong>'; } 
italic = '%' ' '? s:inside { return '<em>' + s + '</em>'; }
meme = 'meme ' s:inside { return '<span class="quote">' + s + '</span>'; }
spoiler = '$' ' '? s:inside { return '<span class="spoiler">' + s + '</span>'; }
ghost = '@' ' '? s:inside { return '<span class="ghost">' + s + '</span>'; }
big = '^' ' '? s:inside { return '<span class="big">' + s + '</span>'; }
rainbow = '~' ' '? s:inside { return '<span class="rainbow">' + s + '</span>'; }
color = '#' c:[0-9a-fA-F]+ ' ' s:inside { return '<span color="#' + c.join('') + '">' + s + '</span>'; }
link = url:url ' ' s:inside { return '<a href="' + url + '">' + s + '</a>'; }

href = url:url { return '<a href="' + url + '">' + url + '</a>'; }
url = u:(scheme '://' login? site port? path? query? hash?) { return u.join(''); }
scheme = 'http' / 'https' / 'ftp' / 'ftps' / 'gopher' / 'irc'
login = s:([^:@ \t\n\r\\]+ (':' [^@ \t\n\r\\]+)? '@') { return s.join('') }
site = s:[^/@: \t\n\r\\]+ { return s.join('') }
port = ':' n:[0-9]+ { return ':' + n.join('') }
path = '/' s:[^ \t\n\r?\\]+ { return '/' + s.join('') }
query = '?' s:[^ \t\n\r#\\]+ { return '?' + s.join('') }
hash = '#' s:[^ \t\n\r\\]+ { return '#' + s.join('') }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.