Skip to content

Commit

Permalink
Merge pull request #105 from google/104-release-polish
Browse files Browse the repository at this point in the history
104 release polish
  • Loading branch information
berggren committed Jul 15, 2015
2 parents d620374 + 6db9781 commit ea38d15
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 82 deletions.
35 changes: 24 additions & 11 deletions timesketch.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,58 @@
#
# $ tsctl -c /path/to/this/timesketch.conf runserver

# Turn off debugging.
# It is a security risk to have this enabled in production.
# Show debug information.
#
# Note: It is a security risk to have this enabled in production.
DEBUG = False

# Key for signing cookies and for CSRF protection.
#
# This should be a unique random string. Don't share this with anyone.
# The key is used for signing cookies and for CSRF protection.
# To generate a key, you can for example use openssl:
# $ openssl rand -base64 32
# If the key is not set the server will not start.
SECRET_KEY = u''

# Setup the database. For more options, see the official documentation:
# Setup the database.
#
# For more options, see the official documentation:
# https://pythonhosted.org/Flask-SQLAlchemy/config.html
# By default sqlite is used.
SQLALCHEMY_DATABASE_URI = u'sqlite:////tmp/database.db'

# Configure where your Elasticsearch server is located.
#
# Make sure that the Elasticsearch server is properly secured and not accessible
# from the internet. See the following link for more information:
# http://www.elasticsearch.org/blog/scripting-security/
ELASTIC_HOST = u'127.0.0.1'
ELASTIC_PORT = 9200

#-------------------------------------------------------------------------------

# Single Sign On (SSO) configuration.
#
# Your web server can handle authentication for you by setting a environment
# variable when the user is successfully authenticated. The standard environment
# variable is REMOTE_USER and this is the default, but if your SSO system uses
# another name you can configure that here.
SSO_ENABLED = False
SSO_USER_ENV_VARIABLE = u'REMOTE_USER'

# Upload Plaso storage file feature.
#-------------------------------------------------------------------------------

# Upload and processing of Plaso storage files.
#
# To enable this feature you need to configure an upload directory and
# how to reach the Redis database used by the distributed task queue Celery.
# how to reach the Redis database used by the distributed task queue.

UPLOAD_ENABLED = False

# Folder for temporarily storage of Plaso dump files before being processed and
# inserted into the datastore.
#UPLOAD_FOLDER = u'/tmp/'
UPLOAD_FOLDER = u'/tmp'

# Celery broker configuration.
#CELERY_BROKER_URL='redis://ip:port',
#CELERY_RESULT_BACKEND='redis://ip:port'
# Celery broker configuration. You need to change ip/port to where your Redis
# server is running.
CELERY_BROKER_URL='redis://ip:port',
CELERY_RESULT_BACKEND='redis://ip:port'
3 changes: 2 additions & 1 deletion timesketch/api/v1/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,10 +497,11 @@ def post(self):
Raises:
ApiHTTPError
"""
UPLOAD_ENABLED = current_app.config[u'UPLOAD_ENABLED']
UPLOAD_FOLDER = current_app.config[u'UPLOAD_FOLDER']

form = UploadFileForm()
if form.validate_on_submit() and UPLOAD_FOLDER:
if form.validate_on_submit() and UPLOAD_ENABLED:
from timesketch.lib.tasks import run_plaso
file_storage = form.file.data
timeline_name = form.name.data
Expand Down
1 change: 1 addition & 0 deletions timesketch/lib/testlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class TestConfig(object):
WTF_CSRF_ENABLED = False
ELASTIC_HOST = None
ELASTIC_PORT = None
UPLOAD_ENABLED = False


class MockDataStore(datastore.DataStore):
Expand Down
18 changes: 10 additions & 8 deletions timesketch/ui/static/css/ts.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ body {

header {
width: 100%;
height: 65px;
height: 55px;
background: #428bca;
position: fixed;
top:0;
z-index:9998;
padding:11px 21px 11px 11px;
box-shadow: 0 -3px 30px rgba(0, 0, 0, 0.3)
box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.3)
}

table {
Expand All @@ -35,18 +35,19 @@ table {
}

#main {
margin:100px 35px 35px 235px;
margin:90px 35px 35px 245px;
}

#logo {
width:200px;
height:65px;
width:210px;
height:55px;
padding:20px;
padding-top:15px;
background: #428bca;
position: fixed;
top:0;
z-index:9999;
box-shadow: 0 -3px 30px rgba(0, 0, 0, 0.3)
box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.3)
}

#logo img {
Expand All @@ -56,13 +57,13 @@ table {
}

#navigation {
width: 200px;
width: 210px;
overflow: hidden;
position: fixed;
left: 0;
height: 100%;
background: #f1f1f1;
top:65px;
top:55px;
z-index:9998;
box-shadow: 0 0 15px rgba(0, 0, 0, 0.3)
}
Expand Down Expand Up @@ -290,6 +291,7 @@ table {
.btn-uppercase {
text-transform: uppercase;
font-size: 0.9em;
letter-spacing: 1.0px;
}

.comment-wrapper {
Expand Down
2 changes: 1 addition & 1 deletion timesketch/ui/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<header>
<div ts-butterbar id="butterbar">Loading..</div>

<div class="pull-right" style="margin-top:10px;margin-right:30px;">
<div class="pull-right" style="margin-top:5px;margin-right:30px;">
{% block header_left %}{% endblock %}
<span style="color:#fff;margin-right:20px;">{{ current_user.username }}</span>
<a style="color:#fff;" href="/logout/">Logout</a>
Expand Down
108 changes: 60 additions & 48 deletions timesketch/ui/templates/home/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,61 +16,73 @@
-->

{% block header_left %}
{% if upload_enabled %}
<ts-core-upload class="pull-left" style="margin-right:20px;margin-top: -6px;"></ts-core-upload>
{% endif %}
{% if upload_enabled %}
<ts-core-upload class="pull-left" style="margin-right:20px;margin-top: -6px;"></ts-core-upload>
{% endif %}
{% endblock %}

{% block sidenav %}
<div id="navigation">
<div class="leftnav-title">
<form action="{{ url_for('home_views.home') }}" method="post">
{{ form.name }}
{{ form.description }}
<button type="submit" class="btn btn-default btn-block"><i class="fa fa-plus"></i> Sketch</button>
{{ form.csrf_token }}
</form>
</div>
<ul class="leftnav">
<li><a href="{{ url_for('home_views.home') }}"><i class="fa fa-inbox"></i> All</a></li>
<li><a href="{{ url_for('home_views.home', filter='user') }}"><i class="fa fa-user"></i> My sketches</a></li>
<li><a href="{{ url_for('home_views.home', filter='shared') }}"><i class="fa fa-share"></i> Shared</a></li>
</ul>
</div>
<div id="navigation">
<div class="leftnav-title">
<form action="{{ url_for('home_views.home') }}" method="post">
{{ form.name }}
{{ form.description }}
<button type="submit" class="btn btn-primary btn-block btn-uppercase"><i class="fa fa-plus"></i> Sketch</button>
{{ form.csrf_token }}
</form>
</div>
<ul class="leftnav">
<li><a href="{{ url_for('home_views.home') }}"><i class="fa fa-inbox"></i> All</a></li>
<li><a href="{{ url_for('home_views.home', filter='user') }}"><i class="fa fa-user"></i> My sketches</a></li>
<li><a href="{{ url_for('home_views.home', filter='shared') }}"><i class="fa fa-share"></i> Shared with me</a></li>
</ul>
</div>
{% endblock %}

{% block main %}
<div class="container">
{% if upload_enabled %}
<ts-core-upload-queue></ts-core-upload-queue>
{% endif %}
<div class="row">
<div class="col-md-12">
<div class="card">
<form class="form form-inline" method="get" action="{{ url_for('home_views.home') }}">
<input type="search" id="q" name="q" class="search-input" placeholder="Search sketches" autofocus="true" value="{{ query }}">
</form>
<div class="container">
<div class="row">
<div class="col-md-12">

{% if upload_enabled %}
<ts-core-upload-queue></ts-core-upload-queue>
{% endif %}

<div class="card">
<form class="form form-inline" method="get" action="{{ url_for('home_views.home') }}">
<input type="search" id="q" name="q" class="search-input" placeholder="Search sketches" autofocus="true" value="{{ query }}">
</form>
</div>

<div class="card">
{% if not sketches.all() %}
<form action="{{ url_for('home_views.home') }}" method="post">
{{ form.name }}
{{ form.description }}
<h4>No sketches found</h4>
<button type="submit" class="btn btn-link" style="padding:0;">Create a new sketch to get started!</button>
{{ form.csrf_token }}
</form>

{% else %}

{% if not sketches.all() %}
No result
{% else %}

<table class="table">
<tbody>
{% for sketch in sketches.all() %}
<tr>
<td style="padding: 30px;padding-left:0;">
<a style="font-size: 1.3em;" href="{{ url_for('sketch_views.overview', sketch_id=sketch.id) }}">{{ sketch.name }}</a>
<br>
<span style="color:#777;">{{ sketch.description }}</span>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
</div>
<table class="table">
<tbody>
{% for sketch in sketches.all() %}
<tr>
<td style="padding: 30px;padding-left:0;">
<a style="font-size: 1.3em;" href="{{ url_for('sketch_views.overview', sketch_id=sketch.id) }}">{{ sketch.name }}</a>
<br>
<span style="color:#777;">{{ sketch.description }}</span>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
14 changes: 5 additions & 9 deletions timesketch/ui/templates/sketch/explore.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,12 @@
limitations under the License.
-->

{% block main_no_sidenav %}
<div id="main">
<div class="container">

<div class="row">
<div class="col-md-12">
<ts-search sketch-id="{{ sketch.id }}" view-id="{{ view.id }}" autoload="true" redirect="true"></ts-search>
</div>
{% block main %}
<div class="container">
<div class="row">
<div class="col-md-12">
<ts-search sketch-id="{{ sketch.id }}" view-id="{{ view.id }}" autoload="true" redirect="true"></ts-search>
</div>

</div>
</div>
{% endblock %}
2 changes: 1 addition & 1 deletion timesketch/ui/templates/sketch/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ <h2>{{ sketch.name }}
</tbody>
</table>
{% else %}
<p>There is no timeline added to this sketch. Add one to get started.</p>
<p>There is no timeline added to this sketch.</p>
{% endif %}
{% if sketch.has_permission(current_user, 'write') %}
<div class="btn-group">
Expand Down
5 changes: 3 additions & 2 deletions timesketch/ui/templates/sketch/timelines.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@
{% if sketch.has_permission(current_user, 'write') %}
<div class="row">
<div class="col-md-12">
<div class="card">
<form method="get" action="{{ url_for('sketch_views.timelines', sketch_id=sketch.id) }}">
<input type="text" name="q" class="search-input" placeholder="Search for timelines to add" />
</form>
</div>
</div>
<br>
</div>

{% if form.timelines.choices %}
<div class="row">
Expand Down Expand Up @@ -77,7 +78,7 @@ <h4>Timelines in this sketch</h4>
</tbody>
</table>
{% else %}
<p>There is no timeline added to this sketch. Add one to get started.</p>
<p>There is no timeline added to this sketch.</p>
{% endif %}
</div>

Expand Down
2 changes: 1 addition & 1 deletion timesketch/ui/views/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def home():
query_filter = request.args.get(u'filter', u'')
query = request.args.get(u'q', u'')
# Only render upload button if it is configured.
upload_enabled = u'UPLOAD_FOLDER' in current_app.config
upload_enabled = current_app.config[u'UPLOAD_ENABLED']

if query_filter:
if query_filter == u'user':
Expand Down

0 comments on commit ea38d15

Please sign in to comment.