diff --git a/README.md b/README.md index 8759c43..c960390 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,17 @@ Redesign ============ -To Run: +To build: ```bash git clone https://github.com/claudiay/freesbd.git -cd freebsdorg/ -bash setup.sh +cd freesbd/ +sh setup.sh +``` + +To run the site: +```bash +cd freesbd/ +sh runsite.sh --debug [--host '*'] [--port 8080] ``` Translations: diff --git a/runsite.sh b/runsite.sh new file mode 100755 index 0000000..99b2d77 --- /dev/null +++ b/runsite.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +echo "Starting up..." +. env/bin/activate && python website/site.py "$@" + diff --git a/setup.sh b/setup.sh index 5bd8794..4ac34b6 100644 --- a/setup.sh +++ b/setup.sh @@ -14,7 +14,7 @@ else fi # Install all dependencies in the virtual environment. -source env/bin/activate && pip install -r $cwd/requirements.txt +. env/bin/activate && pip install -r $cwd/requirements.txt # Set up database. #if [ ! -f "$cwd/something.db" ]; then @@ -26,6 +26,5 @@ source env/bin/activate && pip install -r $cwd/requirements.txt #fi echo "Setup is done!" -echo "Starting up..." -source env/bin/activate && python website/site.py +echo "Now run ./runsite.sh to run the website" diff --git a/website/distros_installs.py b/website/distros_installs.py index 9be7e12..96b0efd 100644 --- a/website/distros_installs.py +++ b/website/distros_installs.py @@ -30,10 +30,16 @@ ], 'downloads' : [ { - 'url': "http://www.pcbsd.org/en/about/", - 'name': 'PCBSD 1000', - 'version': '1000', - 'date': '07/03/14' + 'url': "http://download.pcbsd.org/iso/10.2-RELEASE/amd64/PCBSD10.2-RELEASE-08-19-2015-x64-DVD-USB.iso", + 'name': 'PCBSD ISO Direct Download', + 'version': '10.2-RELEASE', + 'date': '08/19/15' + }, + { + 'url': "http://download.pcbsd.org/iso/10.2-RELEASE/amd64/PCBSD10.2-RELEASE-08-19-2015-x64-DVD-USB.iso.torrent", + 'name': 'PCBSD ISO Torrent', + 'version': '10.2-RELEASE', + 'date': '08/19/15' }, ] }, diff --git a/website/site.py b/website/site.py index 8ad79ec..2f2535b 100644 --- a/website/site.py +++ b/website/site.py @@ -17,6 +17,27 @@ from events import get_rss +from flask_wtf.csrf import CsrfProtect + +CsrfProtect(app) + + +''' +@app.before_request +def csrf_protect(): + if request.method == "POST": + token = session.pop('_csrf_token', None) + if not token or token != request.form.get('_csrf_token'): + abort(403) + +def generate_csrf_token(): + if '_csrf_token' not in session: + session['_csrf_token'] = some_random_string() + return session['_csrf_token'] + +app.jinja_env.globals['csrf_token'] = generate_csrf_token +''' + @babel.localeselector def get_locale(): @@ -27,7 +48,7 @@ def get_locale(): @app.route('/') def index(): - from placeholders import news, events, press, security + #from placeholders import news, events, press, security return render_template('index.html', news=get_rss('news')[:5], events=get_rss('upcoming')[:5], @@ -63,5 +84,15 @@ def simple_install(distro=None): if __name__ == '__main__': - app.run(debug=True) + import argparse + + parser = argparse.ArgumentParser(description='run website.') + parser.add_argument('--debug', action='store_true', help='run in debug mode') + parser.add_argument('--host', default='127.0.0.1', help='what ip to bind to') + parser.add_argument('--port', type=int, default=5000, help='what port to bind to') + args = parser.parse_args() + if args.host == '*': + args.host = '0.0.0.0' + + app.run(debug=args.debug, host=args.host, port=args.port) diff --git a/website/static/img/favicon.ico b/website/static/img/favicon.ico new file mode 100644 index 0000000..78a9568 Binary files /dev/null and b/website/static/img/favicon.ico differ diff --git a/website/templates/base.html b/website/templates/base.html index 0d0ff64..a3e21d6 100644 --- a/website/templates/base.html +++ b/website/templates/base.html @@ -6,7 +6,7 @@ - +
{% trans %}PC-BSD is a user-friendly operating system based on FreeBSD. Harnessing all the tools powerful tools of FreeBSD into an easy to use and install system.{% endtrans %}
+MightnightBSD
{% trans %} MidnightBSD is a new BSD-derived operating system developed with desktop users in mind. It includes all the software you'd expect for your daily tasks - email, web browsing, word processing, gaming, and much more.{% endtrans%}
{% trans %}Its advanced networking, security and storage features have made FreeBSD the platform of choice for many of the busiest web sites.{% endtrans %}
-{% trans %}It is easy to setup and running on your personal hardware, or even skipping that step by hosting your web applications in the cloud.{% endtrans %}
+{% trans %}Get the base FreeBSD system YOU get to customize.{% endtrans %}
{% endcomment #} +{% trans %}Install this on a hardware system and then customize it to your specific requirements.{% endtrans %}
+{% trans %}Pick your virtual environment, ESXi, Virtualbox, Xen or other.{% endtrans %}
+{% trans %}FreeNAS is really cool, but I have no idea why they decided to use dojango.{% endtrans %}
-{% trans %}Probably for the same reason the FreeBSD.org website looks the way it does.{% endtrans%}
+FreeNAS
{% trans %} is a powerful NAS solution that supports NFS, CIFS, VMware.{% endtrans%}
pfSense
{% trans %} is a powerful firewall and VPN that is available free to download{% endtrans%}
{{ distro.about }}