From 8ec6c425a0133d59e895ccaf2087e10de0ceeb6b Mon Sep 17 00:00:00 2001 From: Alfred Perlstein Date: Sat, 17 Oct 2015 20:54:03 -0700 Subject: [PATCH 1/9] Make /bin/sh compat --- setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.sh b/setup.sh index 5bd8794..69a9de9 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 @@ -27,5 +27,5 @@ source env/bin/activate && pip install -r $cwd/requirements.txt echo "Setup is done!" echo "Starting up..." -source env/bin/activate && python website/site.py +. env/bin/activate && python website/site.py From 251472d13e3bf08cbbfcaaeb140253df0274a023 Mon Sep 17 00:00:00 2001 From: Alfred Perlstein Date: Sat, 17 Oct 2015 20:55:20 -0700 Subject: [PATCH 2/9] Spelling, no need for bash(1) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8759c43..5005534 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ Redesign To Run: ```bash git clone https://github.com/claudiay/freesbd.git -cd freebsdorg/ -bash setup.sh +cd freesbd/ +sh setup.sh ``` Translations: From b42d705c4107e0114dae988717724a8069a9efcf Mon Sep 17 00:00:00 2001 From: Alfred Perlstein Date: Sat, 17 Oct 2015 21:10:00 -0700 Subject: [PATCH 3/9] Split things up to allow binding to different ports/addresses. --- runsite.sh | 5 +++++ setup.sh | 3 +-- website/site.py | 10 +++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 runsite.sh diff --git a/runsite.sh b/runsite.sh new file mode 100644 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 69a9de9..4ac34b6 100644 --- a/setup.sh +++ b/setup.sh @@ -26,6 +26,5 @@ fi #fi echo "Setup is done!" -echo "Starting up..." -. env/bin/activate && python website/site.py +echo "Now run ./runsite.sh to run the website" diff --git a/website/site.py b/website/site.py index 8ad79ec..208e581 100644 --- a/website/site.py +++ b/website/site.py @@ -63,5 +63,13 @@ 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('--bindhost', default='127.0.0.1', help='what ip to bind to') + parser.add_argument('--bindport', type=int, default=5000, help='what port to bind to') + args = parser.parse_args() + + app.run(debug=args.debug, host=args.bindhost, port=args.bindport) From a2194850e6afa76892e04621b5271b94273b9dbe Mon Sep 17 00:00:00 2001 From: Alfred Perlstein Date: Sat, 17 Oct 2015 21:20:42 -0700 Subject: [PATCH 4/9] Cleanup args for binding hosts --- website/site.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/website/site.py b/website/site.py index 208e581..578f504 100644 --- a/website/site.py +++ b/website/site.py @@ -67,9 +67,11 @@ def simple_install(distro=None): parser = argparse.ArgumentParser(description='run website.') parser.add_argument('--debug', action='store_true', help='run in debug mode') - parser.add_argument('--bindhost', default='127.0.0.1', help='what ip to bind to') - parser.add_argument('--bindport', type=int, default=5000, help='what port to bind to') + 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.bindhost, port=args.bindport) + app.run(debug=args.debug, host=args.host, port=args.port) From cd3d224c20952e865584d749c6f0f44181898544 Mon Sep 17 00:00:00 2001 From: Alfred Perlstein Date: Sat, 17 Oct 2015 21:27:01 -0700 Subject: [PATCH 5/9] remove include of placeholders, we don't need it for now --- website/site.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/site.py b/website/site.py index 578f504..679f7bd 100644 --- a/website/site.py +++ b/website/site.py @@ -27,7 +27,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], From 97edbffdb5721f90e895d14967e1f7a900299f1e Mon Sep 17 00:00:00 2001 From: Alfred Perlstein Date: Sat, 17 Oct 2015 21:35:45 -0700 Subject: [PATCH 6/9] Cleaup readme --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5005534..c960390 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,19 @@ Redesign ============ -To Run: +To build: ```bash git clone https://github.com/claudiay/freesbd.git cd freesbd/ sh setup.sh ``` +To run the site: +```bash +cd freesbd/ +sh runsite.sh --debug [--host '*'] [--port 8080] +``` + Translations: To compile for use (for new git clones, or after changes): From 321996a69c1db7b18c7a46adb09f4a7a361dabd9 Mon Sep 17 00:00:00 2001 From: Alfred Perlstein Date: Sat, 17 Oct 2015 22:49:45 -0700 Subject: [PATCH 7/9] WIP --- website/static/img/favicon.ico | Bin 0 -> 5430 bytes website/templates/base.html | 2 +- website/templates/index.html | 25 ++++++++++++------ .../es_ES.ISO8859-1/LC_MESSAGES/messages.po | 14 +++++----- 4 files changed, 25 insertions(+), 16 deletions(-) create mode 100644 website/static/img/favicon.ico diff --git a/website/static/img/favicon.ico b/website/static/img/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..78a95684db3c93cdc5477f013ca1864682ee0829 GIT binary patch literal 5430 zcmb_g2~?Cv67KnDU^pC5E-wxdLB#_E0(c}4jkhszbLg7qYSvv%)R=h3XjDjyM^s`o zh{jdHc;Ib}2c9SxL_{K}AfliGDj*Uq}2_f3Gd-i=N`&Y5A6Z_cYh-dw*L@4`Tw5WuzRV%_ntr8tLM=te3 zMc2&SuS?ef>pFJ{%jnp3!$YsWJ0G?izy50bp(DR%9ZISrZ? zIZ#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I;&sUQzQVi6xyN(@ty%7deU5_VE>KIp;A2WV!-1`vRzNzFt z01h1H`}^IyP?_(6nb{gRIxdtsK(_{N=0e)Oj8#SQ-mp`TE*972 z=NHf-e=SlX(@R#$RBuGyooZaqtimtpmDsnp2#HBmIC-V`>Dlz+r&2Z5HNc^xHSp_s zk?-5@pjIy{=j(bX`DM;Weyf2(wYbdAX*XuiyN_!;{?(f+^dax8OK9mH@ae#T{pUwV zZ%NF_xm9j7O7`cAo*V{~KtM@JVa3rS2hRU_)VuSYJp*PAAGh*!%)Zj6Svkx>zbl7* zOBpM^s$v>Cyn$cFAP$jIHXv9a+-j~z>mi;GL$w{OqcjT<-Y`~36yE8c$ltZ0i zP`SFgYQ4R^ZMb&pfPetcz`#JC;GiI%pr9Zxw%hdR(Zi-wr%vX)M}&oioNg-8zU2CR z+lwxQjJxd!`L=6%2g$bNYud-J&linGBXl~QXwjkt|7&b+s_pFTOl@;>^XCWu{@d?3 zApdBPe=zV*1)~rlwT#6y4% - + The FreeBSD Project diff --git a/website/templates/index.html b/website/templates/index.html index a1556dd..c9a3179 100644 --- a/website/templates/index.html +++ b/website/templates/index.html @@ -29,22 +29,31 @@

{% trans %}Latest releases{% endtrans %}

-

{% trans %}Desktop{% endtrans %}

-

{% 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 %}

+

{% trans %}Desktop{% endtrans %}

+

PC-BSD

{% trans %} 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 %}Server{% 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 %}Server{% endtrans %}

+

{% trans %}Get the base FreeBSD system YOU get to customize.{% endtrans %}

+

{% trans %}Hardware{% endtrans %}

+

{% trans %}Install this on a hardware system and then customize it to your specific requirements.{% endtrans %}

+
+

{% trans %}Virtual{% endtrans %}

+

{% trans %}Pick your virtual environment, ESXi, Virtualbox, Xen or other.{% endtrans %}

+
+
-

{% trans %}Appliance{% 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%}

+

{% trans %}Appliances{% 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%}

diff --git a/website/translations/es_ES.ISO8859-1/LC_MESSAGES/messages.po b/website/translations/es_ES.ISO8859-1/LC_MESSAGES/messages.po index 1516004..695396f 100644 --- a/website/translations/es_ES.ISO8859-1/LC_MESSAGES/messages.po +++ b/website/translations/es_ES.ISO8859-1/LC_MESSAGES/messages.po @@ -28,10 +28,12 @@ msgid "" " UNIX® developed at the University of California, Berkeley. It is " "developed and maintained by a large community." msgstr "" -"FreeBSD es un avanzado sistema operativo para arquitecturas x86 compatibles " -"(como Pentium® y Athlon™), amd64 compatibles (como Opteron™, Athlon™64 EM64T), " -"UltraSPARC®, IA-64, PC-98 y ARM. FreeBSD es un derivado de BSD, la versión de UNIX® desarrollada en " -"la Universidad de California, Berkeley. FreeBSD es desarrollado y mantenido por un numeroso equipo de personas." +"FreeBSD es un avanzado sistema operativo para arquitecturas x86 " +"compatibles (como Pentium® y Athlon™), amd64 compatibles (como Opteron™, " +"Athlon™64 EM64T), UltraSPARC®, IA-64, PC-98 y ARM. FreeBSD es un derivado" +" de BSD, la versión de UNIX® desarrollada en la Universidad de " +"California, Berkeley. FreeBSD es desarrollado y mantenido por un numeroso" +" equipo de personas." #: website/templates/index.html:11 msgid "Get Involved" @@ -100,9 +102,7 @@ msgstr "" msgid "" "Probably for the same reason the FreeBSD.org website looks the way it " "does." -msgstr "" -"Pero debo pedir " -"pizza." +msgstr "Pero debo pedir pizza." #: website/templates/index.html:52 msgid "Custom" From d603ccb9b0b4020b3569649d9e6b933c23c3ca1d Mon Sep 17 00:00:00 2001 From: Alfred Perlstein Date: Sun, 18 Oct 2015 06:06:55 +0000 Subject: [PATCH 8/9] +x script --- runsite.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 runsite.sh diff --git a/runsite.sh b/runsite.sh old mode 100644 new mode 100755 From 164fb024c012175bdd39145373b93bae56451ab1 Mon Sep 17 00:00:00 2001 From: Alfred Perlstein Date: Sat, 17 Oct 2015 23:48:56 -0700 Subject: [PATCH 9/9] Downloads working for PCBSD --- website/distros_installs.py | 14 ++++++++++---- website/site.py | 21 +++++++++++++++++++++ website/templates/index.html | 2 +- website/templates/simple_install.html | 11 ++++++++--- 4 files changed, 40 insertions(+), 8 deletions(-) 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 679f7bd..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(): diff --git a/website/templates/index.html b/website/templates/index.html index c9a3179..4519b44 100644 --- a/website/templates/index.html +++ b/website/templates/index.html @@ -38,7 +38,7 @@

{% trans %}Desktop{% endtrans %}

{% trans %}Server{% endtrans %}

-

{% trans %}Get the base FreeBSD system YOU get to customize.{% endtrans %}

+ {# comment %}

{% trans %}Get the base FreeBSD system YOU get to customize.{% endtrans %}

{% endcomment #}

{% trans %}Hardware{% endtrans %}

{% trans %}Install this on a hardware system and then customize it to your specific requirements.{% endtrans %}


diff --git a/website/templates/simple_install.html b/website/templates/simple_install.html index e404c5a..3a5da16 100644 --- a/website/templates/simple_install.html +++ b/website/templates/simple_install.html @@ -16,9 +16,10 @@

{{ distro.distroname }}

{{ distro.about }}

-
+ +
- {% for download in distro.downloads %} {{donwload}} @@ -26,7 +27,7 @@

{{ distro.distroname }}

- +
@@ -79,6 +80,10 @@

{% block js %} {% endblock %}