Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
5 changes: 5 additions & 0 deletions runsite.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

echo "Starting up..."
. env/bin/activate && python website/site.py "$@"

5 changes: 2 additions & 3 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"

14 changes: 10 additions & 4 deletions website/distros_installs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
},
]
},
Expand Down
35 changes: 33 additions & 2 deletions website/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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],
Expand Down Expand Up @@ -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)

Binary file added website/static/img/favicon.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion website/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="static/assets/ico/favicon.ico">
<link rel="shortcut icon" href="static/img/favicon.ico">

<title>The FreeBSD Project</title>

Expand Down
25 changes: 17 additions & 8 deletions website/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,31 @@ <h4><a href="">{% trans %}Latest releases{% endtrans %}</a></h4>
<div class ="row main-products">
<div class="col-md-3">
<div class="details">
<h2><a href="{{ url_for('simple_install', distro='pcbsd') }}">{% trans %}Desktop{% endtrans %}<span class="pull-right glyphicon glyphicon-chevron-right"></span></a></h2>
<p>{% 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 %}</p>
<h2>{% trans %}Desktop{% endtrans %}</h2>
<p><h3><a href="{{ url_for('simple_install', distro='pcbsd') }}">PC-BSD<span class="pull-right glyphicon glyphicon-chevron-right"></span></a></h3>{% 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 %}</p>
<hr>
<p><a href="{{ url_for('simple_install', distro='midnightbsd') }}"><h3>MightnightBSD<span class="pull-right glyphicon glyphicon-chevron-right"></span></h3></a>{% 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%}</p>
</div>
</div>
<div class="col-md-3">
<div class="details">
<h2><a href="{{ url_for('simple_install', distro='freebsd10-0') }}">{% trans %}Server{% endtrans %}<span class="pull-right glyphicon glyphicon-chevron-right"></span></a></h2>
<p>{% trans %}Its advanced networking, security and storage features have made FreeBSD the platform of choice for many of the busiest web sites.{% endtrans %}</p>
<p>{% 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 %}</p>
<h2>{% trans %}Server{% endtrans %}</h2>
{# comment %}<p>{% trans %}Get the base FreeBSD system YOU get to customize.{% endtrans %}</p>{% endcomment #}
<h3><a href="{{ url_for('simple_install', distro='freebsd-hw') }}">{% trans %}Hardware{% endtrans %}<span class="pull-right glyphicon glyphicon-chevron-right"></span></a></h2>
<p>{% trans %}Install this on a hardware system and then customize it to your specific requirements.{% endtrans %}</p>
<hr>
<h3><a href="{{ url_for('simple_install', distro='freebsd-vm') }}">{% trans %}Virtual{% endtrans %}<span class="pull-right glyphicon glyphicon-chevron-right"></span></a></h2>
<p>{% trans %}Pick your virtual environment, ESXi, Virtualbox, Xen or other.{% endtrans %}</p>
<hr>

</div>
</div>
<div class="col-md-3">
<div class="details">
<h2><a href="{{ url_for('simple_install', distro='freenas') }}">{% trans %}Appliance{% endtrans %}<span class="pull-right glyphicon glyphicon-chevron-right"></span></a></h2>
<p>{% trans %}FreeNAS is really cool, but I have no idea why they decided to use dojango.{% endtrans %}</p>
<p>{% trans %}Probably for the same reason the FreeBSD.org website looks the way it does.{% endtrans%}</p>
<h2>{% trans %}Appliances{% endtrans %}</h2>
<p><a href="{{ url_for('simple_install', distro='freenas') }}"><h3>FreeNAS<span class="pull-right glyphicon glyphicon-chevron-right"></span></h3></a>{% trans %} is a powerful NAS solution that supports NFS, CIFS, VMware.{% endtrans%}</p>
<hr>
<p><a href="{{ url_for('simple_install', distro='pfsense') }}"><h3>pfSense<span class="pull-right glyphicon glyphicon-chevron-right"></span></h3></a>{% trans %} is a powerful firewall and VPN that is available free to download{% endtrans%}</p>
</div>
</div>
<div class="col-md-3 last">
Expand Down
11 changes: 8 additions & 3 deletions website/templates/simple_install.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@ <h2>{{ distro.distroname }}</h2>
<p>{{ distro.about }}</p>
</div>
<div class="col-md-4">
<form class="form" role="form">
<form class="form" role="form" method="post">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<div class="form-group">
<select class="form-control" name="download_url">
<select id="download_select" class="form-control" name="download_url">
{% for download in distro.downloads %}
{{donwload}}
<option value="{{ download.url }}">{{ download.name }}</option>
{% endfor %}
</select>
</div>
<div class="form-group">
<button type="submit" class="btn btn-default btn-lg btn-block">Download</button>
<button id="download_button" type="submit" class="btn btn-default btn-lg btn-block">Download</button>
</div>
</form>
</div>
Expand Down Expand Up @@ -79,6 +80,10 @@ <h4 class="panel-title">
{% block js %}
<script type="text/javascript">
$('.collapse').collapse()
$('#download_button').click(function(e) {
e.preventDefault(); //stop the browser from following
window.location.href = $( "#download_select" ).val();
});
</script>
{% endblock %}

14 changes: 7 additions & 7 deletions website/translations/es_ES.ISO8859-1/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down