mirror of
https://github.com/simon987/od-database.git
synced 2025-12-13 06:49:02 +00:00
Initial commit
This commit is contained in:
15
templates/contribute.html
Normal file
15
templates/contribute.html
Normal file
@@ -0,0 +1,15 @@
|
||||
{% extends "layout.html" %}
|
||||
{% set current_page = "contribute" %}
|
||||
|
||||
{% block body %}
|
||||
<div class="container">
|
||||
<div class="card">
|
||||
<div class="card-header">How to contribute</div>
|
||||
<div class="card-body">
|
||||
<p>Fork on <a href="https://github.com/simon987/od-database">GitHub</a> or create an issue</p>
|
||||
<p>Or <a href="/submit">submit a website</a></p>
|
||||
<p>You can also contact me <a href="https://reddit.com/message/compose?to=Hexahedr_n">on Reddit</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock body %}
|
||||
54
templates/home.html
Normal file
54
templates/home.html
Normal file
@@ -0,0 +1,54 @@
|
||||
{% extends "layout.html" %}
|
||||
|
||||
{% set title = "OD-Database - Home" %}
|
||||
|
||||
{% block body %}
|
||||
|
||||
<div class="container">
|
||||
<div class="jumbotron">
|
||||
<h1 class="text-monospace" style="font-size: 3.5rem;">OD-Database</h1>
|
||||
|
||||
{% if stats and stats["file_size"] %}
|
||||
<p class="lead">{{ stats["file_count"] }} files totalling
|
||||
~{{ stats["file_size"] | filesizeformat }} in
|
||||
{{ stats["website_paths"] }} folders from {{ stats["website_count"] }} website(s)</p>
|
||||
{% endif %}
|
||||
{% if current_website %}
|
||||
<p>Currently indexing <code>{{ current_website }}</code><span class="vim-caret"> </span> </p>
|
||||
{% endif %}
|
||||
<p></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">Search</div>
|
||||
<div class="card-body">
|
||||
<form action="/search">
|
||||
|
||||
<div class="form-group">
|
||||
<input class="form-control" name="q" id="q" placeholder="Full-text Query">
|
||||
</div>
|
||||
|
||||
<input class="btn btn-primary btn-shadow" type="submit" value="Search">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">Full-text Query Syntax</div>
|
||||
<div class="card-body">
|
||||
|
||||
<p>The following query types are allowed (More information
|
||||
<a href="https://www.sqlite.org/fts5.html#full_text_query_syntax">here</a>):</p>
|
||||
<p>Exact term: <code> "foo"</code></p>
|
||||
<p>Term with prefix: <code> "foo*"</code></p>
|
||||
<p>File names: <code> "name:foo"</code></p>
|
||||
<p>Paths: <code> "path:foo"</code></p>
|
||||
<p>Starts with term: <code> "^foo"</code></p>
|
||||
<p>NEAR group: <code> "NEAR(foo bar, 3)"</code></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% endblock body %}
|
||||
66
templates/layout.html
Normal file
66
templates/layout.html
Normal file
@@ -0,0 +1,66 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{{ title }}</title>
|
||||
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
|
||||
|
||||
<script src="/static/js/popper.min.js" type="text/javascript"></script>
|
||||
<script src="/static/js/jquery.min.js" type="text/javascript"></script>
|
||||
<script src="/static/js/bootstrap.min.js" type="text/javascript"></script>
|
||||
<script src="/static/js/Chart.min.js" type="text/javascript"></script>
|
||||
|
||||
<link href="/static/css/fontawesome-all.min.css" rel="stylesheet" type="text/css">
|
||||
<link href="/static/css/bootstrap4-vibrant-sea.min.css" rel="stylesheet" type="text/css">
|
||||
<link href="/static/css/main.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<nav class="navbar navbar-expand-lg navbar-light" style="background: #F7F7F7; border-bottom: solid 1px #dfdfdf;">
|
||||
<a class="navbar-brand" href="/"><i class="fas fa-database"></i> OD-Database</a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {{ "active" if current_page == "website" else "" }}" href="/website">Websites</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {{ "active" if current_page == "submit" else "" }}" href="/submit">Submit website</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {{ "active" if current_page == "contribute" else "" }}" href="/contribute">Contribute</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
{% block alert_messages %}
|
||||
|
||||
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
<div class="container" style="margin-top: 1em">
|
||||
{% for category, message in messages %}
|
||||
<div class="alert alert-{{ category }}">
|
||||
<a href="#" class="close" data-dismiss="alert" aria-label="fermer">×</a>
|
||||
{{ message | safe }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{% endblock body %}
|
||||
|
||||
</body>
|
||||
</html>
|
||||
76
templates/search.html
Normal file
76
templates/search.html
Normal file
@@ -0,0 +1,76 @@
|
||||
{% extends "layout.html" %}
|
||||
|
||||
{% set title = "OD-Database - Search" %}
|
||||
|
||||
{% block body %}
|
||||
<div class="container">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">Search</div>
|
||||
<div class="card-body">
|
||||
<form action="/search">
|
||||
|
||||
<div class="form-group">
|
||||
<input class="form-control" name="q" id="q" placeholder="Full-text Query" value="{{ q }}">
|
||||
</div>
|
||||
|
||||
<input class="btn btn-primary btn-shadow" type="submit" value="Search">
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if results %}
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<tbody>
|
||||
|
||||
{% for hit in results %}
|
||||
{% set path = hit[1] + hit[2] %}
|
||||
<tr>
|
||||
<td>
|
||||
{# File name & link #}
|
||||
<a href="{{ path + "/" + hit[3] }}" title="{{ hit[3] }}">
|
||||
{{ hit[3] | truncate(50, True, "..>") }}
|
||||
</a>
|
||||
{# File type badge #}
|
||||
{% set mime = get_mime(hit[3]) %}
|
||||
{% if mime %}
|
||||
<span class="badge badge-pill {{ get_color(mime) }}">
|
||||
{{ hit[3][hit[3].rfind(".") + 1:] }}
|
||||
</span>
|
||||
{% endif %}
|
||||
{# File path #}
|
||||
<div class="text-muted" title="{{ path }}" style="font-size: 10px;">
|
||||
<a style="color: #6c757d" title="See files from this website"
|
||||
href="/website/{{ hit[4] }}">{{ hit[1] }}</a>{{ truncate_path(hit[2], 60) }}
|
||||
</div>
|
||||
</td>
|
||||
{# File size #}
|
||||
<td style="white-space: nowrap; vertical-align: top; text-align: right; font-size: 14px">
|
||||
{{ hit[0] | filesizeformat }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<a href="/search?q={{ q }}&p={{ p + 1 }}" class="btn btn-primary" style="float: right">Next</a>
|
||||
{% if p > 0 %}
|
||||
<a href="/search?q={{ q }}&p={{ p - 1 }}" class="btn btn-primary">Previous</a>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="card">
|
||||
<div class="card-body">No results</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% endblock body %}
|
||||
59
templates/submit.html
Normal file
59
templates/submit.html
Normal file
@@ -0,0 +1,59 @@
|
||||
{% extends "layout.html" %}
|
||||
{% set title = "OD-Database - Submit website" %}
|
||||
|
||||
{% block body %}
|
||||
<div class="container" >
|
||||
<div class="card">
|
||||
<div class="card-header">Submit a website</div>
|
||||
<div class="card-body">
|
||||
<form action="/enqueue" method="POST">
|
||||
<div class="form-group">
|
||||
<input class="form-control" name="url" id="url" placeholder="URL">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
{# {{ recaptcha.get_code()|safe }}#}
|
||||
</div>
|
||||
<div class="col">
|
||||
<input class="btn btn-primary" type="submit" value="Submit" title="Submit open directory">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<hr>
|
||||
|
||||
<p class="text-muted">
|
||||
Note: TODO note
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">Queued websites</div>
|
||||
<div class="card-body">
|
||||
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Url</th>
|
||||
<th>Date added</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{% for w in queue %}
|
||||
<tr>
|
||||
<td title="{{ w.url }}">{{ w.url | truncate(70)}}</td>
|
||||
<td>{{ w.last_modified }} UTC</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock body %}
|
||||
45
templates/website.html
Normal file
45
templates/website.html
Normal file
@@ -0,0 +1,45 @@
|
||||
{% extends "layout.html" %}
|
||||
{% set title = "OD-Datase - Websites" %}
|
||||
|
||||
{% block body %}
|
||||
<div class="container">
|
||||
<div class="card">
|
||||
<div class="card-header">Information for {{ website.url }}</div>
|
||||
<div class="card-body">
|
||||
|
||||
<div id="chart-wrapper" style="margin-bottom: 1em">
|
||||
<p id="loading-text">Calculating...</p>
|
||||
<canvas id="typesChart"></canvas>
|
||||
<script src="/static/js/Chart.min.js"></script>
|
||||
<script src="/static/js/report.js"></script>
|
||||
</div>
|
||||
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>Base url</th>
|
||||
<td id="baseUrl"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>File count</th>
|
||||
<td id="fileCount"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>Total size</th>
|
||||
<td id="totalSize"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>Last updated</th>
|
||||
<td id="reportTime"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<hr>
|
||||
<a href="/website/{{ website.id }}/links" class="btn btn-shadow btn-primary">Link list</a>
|
||||
<a href="/website/{{ website.id }}/json_chart" class="btn btn-shadow btn-primary">Summary (JSON)</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock body %}
|
||||
29
templates/websites.html
Normal file
29
templates/websites.html
Normal file
@@ -0,0 +1,29 @@
|
||||
{% extends "layout.html" %}
|
||||
{% set title = "OD-Database - Websites" %}
|
||||
{% set current_page = "website" %}
|
||||
|
||||
|
||||
{% block body %}
|
||||
<div class="container">
|
||||
<div class="card">
|
||||
<div class="card-header">Last updated websites</div>
|
||||
<div class="card-body">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Url</th>
|
||||
<th>Last crawled</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
{% for website in websites %}
|
||||
<tr>
|
||||
<td><a title="Click for stats & link list" href="/website/{{ website[0] }}">{{ website[1] }}</a></td>
|
||||
<td>{{ website[2] }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock body %}
|
||||
Reference in New Issue
Block a user