summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlo Landmeter <clandmeter@gmail.com>2015-03-17 09:30:06 +0000
committerCarlo Landmeter <clandmeter@gmail.com>2015-03-17 09:30:06 +0000
commit47d6db8cbe043d2c524af68831d236080b1127f4 (patch)
tree0c49abe825f60b56681a5fecf08b0283901e6bbd
downloadaports-turbo-47d6db8cbe043d2c524af68831d236080b1127f4.tar.bz2
aports-turbo-47d6db8cbe043d2c524af68831d236080b1127f4.tar.xz
initial import
-rw-r--r--.gitignore1
-rwxr-xr-xaports.lua134
-rw-r--r--assets/alpinelinux-logo.svg167
-rw-r--r--assets/favicon.icobin0 -> 4286 bytes
-rw-r--r--assets/style.css81
-rw-r--r--tpl/contents.tpl45
-rw-r--r--tpl/footer.tpl3
-rw-r--r--tpl/header.tpl50
-rw-r--r--tpl/package.tpl56
-rw-r--r--tpl/packages.tpl51
10 files changed, 588 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..9c39416
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+db/*
diff --git a/aports.lua b/aports.lua
new file mode 100755
index 0000000..7a3a7d9
--- /dev/null
+++ b/aports.lua
@@ -0,0 +1,134 @@
+#!/usr/bin/env luajit
+
+-- lua turbo application
+
+local turbo = require "turbo"
+local inspect = require "inspect"
+
+local tpl = turbo.web.Mustache.TemplateHelper("./tpl")
+
+local ContentsRenderer = class("ContentsRenderer", turbo.web.RequestHandler)
+
+function ContentsRenderer:get()
+ local table = {}
+ local args = {
+ filename = self:get_argument("filename","", true),
+ arch = self:get_argument("arch", "x86", true),
+ }
+ if args.filename ~= "" then
+ local result = QueryContents(args)
+ if next(result) ~= nil then
+ table.rows = result
+ end
+ end
+ table.contents = true
+ table.filename = args.filename
+ table.header = tpl:render("header.tpl", table)
+ table.footer = tpl:render("footer.tpl", table)
+ local page = tpl:render(self.options, table)
+ self:write(page)
+end
+
+local PackagesRenderer = class("PackagesRenderer", turbo.web.RequestHandler)
+
+function PackagesRenderer:get()
+ local table = {}
+ local args = {
+ package = self:get_argument("package","", true)
+ }
+ if args.package == "" then
+ args.package = "%"
+ end
+ local result = QueryPackages(args)
+ if next(result) ~= nil then
+ table.rows = result
+ end
+ table.packages = true
+ table.header = tpl:render("header.tpl", table)
+ table.footer = tpl:render("footer.tpl", table)
+ local page = tpl:render(self.options, table)
+ self:write(page)
+ print(inspect(table))
+end
+
+local PackageRenderer = class("PackageRenderer", turbo.web.RequestHandler)
+
+function PackageRenderer:get(arch, pkgname)
+ local fields = {}
+ local table = {}
+ fields.arch = arch
+ fields.pkgname = pkgname
+ result = QueryPackage(fields)
+
+ if result ~= nil then
+ table = result
+ for k in pairs (table) do
+ if table[k] == "" then
+ table[k] = nil
+ end
+ end
+ end
+ table.header = tpl:render("header.tpl")
+ table.footer = tpl:render("footer.tpl")
+ local page = tpl:render(self.options, table)
+ self:write(page)
+end
+
+function QueryContents(terms)
+ require('DBI')
+ local dbh = assert(DBI.Connect('SQLite3', 'db/filelist.db'))
+ local sth = assert(dbh:prepare('select * from filelist where file like ? and arch like ? limit 100'))
+ sth:execute(terms.filename, terms.arch)
+ local r = {}
+ for row in sth:rows(true) do
+ r[#r + 1] = {
+ file = "/" .. row.path .. "/" .. row.file,
+ pkgname = row.pkgname,
+ repo = row.repo,
+ arch = row.arch,
+ }
+ end
+ return r
+
+end
+function QueryPackages(terms)
+ require('DBI')
+ local dbh = assert(DBI.Connect('SQLite3', 'db/apkindex.db'))
+ local sth = assert(dbh:prepare('select name, version, url, lic, desc, arch, maintainer, datetime(build_time, \'unixepoch\') as build_time from apkindex where name like ? ORDER BY build_time DESC limit 100'))
+ sth:execute(terms.package)
+ local r = {}
+ for row in sth:rows(true) do
+ r[#r + 1] = {
+ package = row.name,
+ version = row.version,
+ project = row.url,
+ license = row.lic,
+ desc = row.desc,
+ arch = row.arch,
+ repo = "unk",
+ maintainer = string.gsub(row.maintainer, '<.*>', ''),
+ bdate = row.build_time
+ }
+ end
+ return r
+end
+
+function QueryPackage(fields)
+ require('DBI')
+ local dbh = assert(DBI.Connect('SQLite3', 'db/apkindex.db'))
+ local sth = assert(dbh:prepare('select *, datetime(build_time, \'unixepoch\') as build_time from apkindex where name like ? and arch like ? limit 1'))
+ sth:execute(fields.pkgname, fields.arch)
+ local r = {}
+ r = sth:fetch(true)
+ print(inspect(r))
+ return r
+end
+
+turbo.web.Application({
+ {"^/$", turbo.web.RedirectHandler, "/packages"},
+ {"^/contents$", ContentsRenderer, "contents.tpl"},
+ {"^/packages$", PackagesRenderer, "packages.tpl"},
+ {"^/package/(.*)/(.*)$", PackageRenderer, "package.tpl"},
+ {"/assets/(.*)$", turbo.web.StaticFileHandler, "assets/"},
+}):listen(8888)
+turbo.ioloop.instance():start()
diff --git a/assets/alpinelinux-logo.svg b/assets/alpinelinux-logo.svg
new file mode 100644
index 0000000..70f2f60
--- /dev/null
+++ b/assets/alpinelinux-logo.svg
@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.48.5 r10040"
+ width="665.16876"
+ height="161.78787"
+ xml:space="preserve"
+ sodipodi:docname="alpinelinux-logo.svg"><metadata
+ id="metadata8"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
+ id="defs6"><clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath16"><path
+ d="M 0,560 960,560 960,0 0,0 0,560 z"
+ id="path18"
+ inkscape:connector-curvature="0" /></clipPath></defs><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1595"
+ inkscape:window-height="964"
+ id="namedview4"
+ showgrid="false"
+ fit-margin-top="0"
+ fit-margin-left="0"
+ fit-margin-right="0"
+ fit-margin-bottom="0"
+ inkscape:zoom="0.33333333"
+ inkscape:cx="-197.05676"
+ inkscape:cy="-80.4375"
+ inkscape:window-x="276"
+ inkscape:window-y="233"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="g10" /><g
+ id="g10"
+ inkscape:groupmode="layer"
+ inkscape:label="Alpine_Linux_logo_v4"
+ transform="matrix(1.25,0,0,-1.25,-267.55675,592.22537)"><g
+ id="g20"
+ transform="translate(686.7844,397.9583)"
+ style="fill:#0d597f;fill-opacity:1"><path
+ d="m 0,0 c -3.74,6.413 -3.73,19.372 0.023,26.161 1.64,2.969 6.622,9.559 28.367,9.559 4.468,0 7.739,-0.229 10.148,-0.554 5.278,-0.71 9.297,-2.509 9.297,-7.425 0,-6.49 -9.565,-6.55 -9.565,-6.55 l -20.27,0 C 9.392,21.191 8.734,9.287 8.734,9.287 l 9.17,0 20.366,0 c 10.375,0 21.125,4.649 21.125,18.258 0,9.047 -5.207,15.135 -13.71,17.468 -8.498,2.332 -11.809,2.206 -23.391,1.998 C 13.02,46.845 7.679,44.81 4.305,43.752 -1.609,41.896 -6.907,38.432 -10.48,31.966 -16.297,21.438 -16.244,4.03 -10.365,-6.047 -4.08,-16.821 6.696,-22.587 19.723,-22.597 l 39.672,0 10e-4,11.943 -39.714,0 C 8.246,-10.688 2.571,-4.408 0,0"
+ style="fill:#0d597f;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path22"
+ inkscape:connector-curvature="0" /></g><g
+ id="g24"
+ transform="translate(441.9298,442.9648)"
+ style="fill:#0d597f;fill-opacity:1"><path
+ d="m 0,0 c -10.527,5.817 -27.936,5.764 -38.013,-0.115 -14.384,-8.391 -19.841,-24.786 -14.594,-43.858 2.693,-9.79 9.965,-17.002 21.03,-20.855 7.818,-2.723 15.012,-2.801 15.31,-2.803 l -0.015,12 c -0.207,10e-4 -20.756,0.305 -24.755,14.842 -5.16,18.758 3.468,27.041 9.071,30.309 6.413,3.74 19.372,3.73 26.161,-0.023 7.212,-3.985 7.733,-12.297 7.733,-25.513 l 0,-24.358 c 0,-8.608 12,-9.171 12,-9.171 l 0,9.171 0,24.358 c 0,12.618 0,28.319 -13.928,36.016"
+ style="fill:#0d597f;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path26"
+ inkscape:connector-curvature="0" /></g><g
+ id="g28"
+ transform="translate(597.6101,375.3665)"
+ style="fill:#0d597f;fill-opacity:1"><path
+ d="m 0,0 0,37.405 c 0.011,13.027 5.776,23.803 16.55,30.088 10.078,5.878 27.486,5.932 38.013,0.115 13.928,-7.697 13.928,-23.399 13.928,-36.016 l 0,-24.319 0,-9.171 c 0,0 -12,0.563 -12,9.171 l 0,24.319 c 0,13.216 -0.521,21.528 -7.733,25.513 C 41.969,60.858 29.01,60.868 22.597,57.128 18.189,54.557 11.909,48.882 11.943,37.446 l 0,-37.447 L 0,0 z"
+ style="fill:#0d597f;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path30"
+ inkscape:connector-curvature="0" /></g><g
+ id="g32"
+ transform="translate(579.8309,375.3661)"
+ style="fill:#0d597f;fill-opacity:1"><path
+ d="m 0,0 0,47.562 0,9.171 c 0,0 11.904,-0.658 11.904,-9.267 L 11.904,0 0,0 z"
+ style="fill:#0d597f;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path34"
+ inkscape:connector-curvature="0" /></g><g
+ id="g36"
+ transform="translate(591.7351,443.8518)"
+ style="fill:#0d597f;fill-opacity:1"><path
+ d="m 0,0 0,-2.028 0,-9.171 c 0,0 -11.904,0.658 -11.904,9.267 L -11.904,0 0,0 z"
+ style="fill:#0d597f;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path38"
+ inkscape:connector-curvature="0" /></g><g
+ id="g40"
+ transform="translate(519.3928,442.6805)"
+ style="fill:#0d597f;fill-opacity:1"><path
+ d="m 0,0 c 10.527,5.817 27.936,5.764 38.013,-0.115 14.384,-8.391 19.841,-24.786 14.594,-43.858 -2.693,-9.79 -9.965,-17.002 -21.03,-20.855 -7.818,-2.723 -15.007,-2.447 -15.305,-2.449 l 0.01,11.899 c 0.207,10e-4 20.756,0.052 24.755,14.589 5.16,18.758 -3.468,27.041 -9.071,30.309 -6.413,3.74 -19.372,3.73 -26.161,-0.023 -7.212,-3.985 -7.733,-12.297 -7.733,-25.513 l 0,-12.612 c 0,-8.608 -12,-9.17 -12,-9.17 l 0,9.17 0,12.612 c 0,12.618 0,28.319 13.928,36.016"
+ style="fill:#0d597f;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path42"
+ inkscape:connector-curvature="0" /></g><g
+ id="g44"
+ transform="translate(517.3693,344.6278)"
+ style="fill:#0d597f;fill-opacity:1"><path
+ d="m 0,0 0,30.505 0,9.17 c 0,0 -11.904,-0.658 -11.904,-9.266 L -11.904,0 0,0 z"
+ style="fill:#0d597f;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path46"
+ inkscape:connector-curvature="0" /></g><g
+ id="g48"
+ transform="translate(473.349,473.7803)"
+ style="fill:#0d597f;fill-opacity:1"><path
+ d="m 0,0 0,-32.359 0,-9.17 c 0,0 -11.904,0.658 -11.904,9.266 L -11.904,0 0,0 z"
+ style="fill:#0d597f;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path50"
+ inkscape:connector-curvature="0" /></g><g
+ id="g52"
+ transform="translate(474.9603,402.1447)"
+ style="fill:#0d597f;fill-opacity:1"><path
+ d="m 0,0 c -1.039,3.777 -1.519,7.129 -1.577,10.101 l -0.034,10.255 c 0,8.608 -11.913,9.171 -11.913,9.171 l 0,-9.171 0,-10.193 c 0.037,-4.24 0.68,-8.714 1.954,-13.347 2.693,-9.79 9.966,-17.002 21.03,-20.855 7.818,-2.723 14.992,-2.743 15.289,-2.745 l 0.006,11.942 C 24.548,-14.841 3.999,-14.537 0,0"
+ style="fill:#0d597f;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path54"
+ inkscape:connector-curvature="0" /></g><g
+ id="g56"
+ transform="translate(268.1394,393.2718)"
+ style="fill:#0d597f;fill-opacity:1"><path
+ d="M 0,0 0,15.687 -11.296,4.379 C -10.079,3.532 -8.932,2.836 -7.853,2.27 -6.774,1.703 -5.764,1.265 -4.823,0.932 -3.882,0.598 -3.009,0.37 -2.206,0.222 -1.402,0.075 -0.667,0.009 0,0 m 57.751,1.304 c 0.02,-0.017 0.13,-0.11 0.333,-0.239 0.204,-0.13 0.502,-0.297 0.898,-0.462 0.395,-0.164 0.889,-0.327 1.485,-0.448 0.596,-0.122 1.294,-0.202 2.098,-0.202 0.671,0 1.411,0.059 2.222,0.2 0.812,0.142 1.693,0.367 2.645,0.699 0.953,0.333 1.976,0.773 3.07,1.344 1.094,0.572 2.259,1.276 3.495,2.136 L 65.425,12.729 37.015,41.245 24.549,28.776 7.733,46.117 -34.471,4.39 c 1.235,-0.86 2.398,-1.564 3.491,-2.136 1.093,-0.571 2.115,-1.011 3.067,-1.344 0.951,-0.332 1.832,-0.557 2.643,-0.698 0.81,-0.142 1.55,-0.201 2.22,-0.201 0.804,0 1.502,0.08 2.097,0.202 0.596,0.121 1.089,0.284 1.485,0.449 0.396,0.164 0.693,0.331 0.897,0.461 0.204,0.13 0.314,0.223 0.334,0.24 L 0.815,20.415 7.628,26.948 26.494,8.082 33.085,1.304 c 0.02,-0.017 0.13,-0.11 0.334,-0.239 0.204,-0.13 0.501,-0.297 0.897,-0.462 0.396,-0.164 0.89,-0.327 1.485,-0.448 0.596,-0.122 1.295,-0.202 2.099,-0.202 0.67,0 1.411,0.059 2.222,0.2 0.811,0.142 1.693,0.367 2.645,0.699 0.952,0.333 1.975,0.773 3.069,1.344 1.094,0.572 2.259,1.276 3.495,2.136 L 34.192,19.157 37.01,21.975 50.111,8.874 57.751,1.304 M 57.588,80.32 94.807,15.838 57.588,-48.644 l -74.463,0 -37.219,64.482 37.219,64.482 74.463,0 z"
+ style="fill:#0d597f;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path58"
+ inkscape:connector-curvature="0" /></g><g
+ id="g60"
+ transform="translate(302.5041,412.251)"
+ style="fill:#0d597f;fill-opacity:1"><path
+ d="M 0,0 -9.913,9.895 -9.208,10.604 0.775,0.73 0,0 z"
+ style="fill:#0d597f;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path62"
+ inkscape:connector-curvature="0" /></g><g
+ id="g64"
+ transform="translate(528.4338,353.235)"
+ style="fill:#0d597f;fill-opacity:1"><path
+ d="m 0,0 0,22.161 -2,0 L -2,0 c 0,-4.295 3.35,-8.885 12.75,-8.885 l 15.25,0 0,2 -15.25,0 C 0.775,-6.885 0,-1.615 0,0"
+ style="fill:#0d597f;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path66"
+ inkscape:connector-curvature="0" /></g><path
+ d="m 561.073,344.35 2,0 0,22.787 -2,0 0,-22.787 z"
+ style="fill:#0d597f;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path68"
+ inkscape:connector-curvature="0" /><path
+ d="m 561.073,368.358 2,0 0,2.992 -2,0 0,-2.992 z"
+ style="fill:#0d597f;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path70"
+ inkscape:connector-curvature="0" /><g
+ id="g72"
+ transform="translate(664.6232,367.1373)"
+ style="fill:#0d597f;fill-opacity:1"><path
+ d="m 0,0 -2.634,0 -8.469,-9.888 -8.481,9.888 -2.634,0 9.796,-11.428 -9.729,-11.359 2.62,0 8.422,9.827 8.423,-9.827 2.647,0 -9.75,11.367 L 0,0 z"
+ style="fill:#0d597f;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path74"
+ inkscape:connector-curvature="0" /></g><g
+ id="g76"
+ transform="translate(634.3527,353.11)"
+ style="fill:#0d597f;fill-opacity:1"><path
+ d="M 0,0 C 0,-0.691 -0.366,-6.76 -13.063,-6.76 -25.637,-6.76 -26,-0.691 -26,0 l 0,14.027 -2,0 L -28,0 c 0,-0.896 0.419,-8.76 14.937,-8.76 C 1.577,-8.76 2,-0.896 2,0 l 0,14.027 -2,0 L 0,0 z"
+ style="fill:#0d597f;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path78"
+ inkscape:connector-curvature="0" /></g><g
+ id="g80"
+ transform="translate(584.7756,367.1373)"
+ style="fill:#0d597f;fill-opacity:1"><path
+ d="m 0,0 c -14.64,0 -15.063,-7.863 -15.063,-8.76 l 0,-14.027 2,0 0,14.027 c 0,0.692 0.367,6.76 13.063,6.76 12.574,0 12.938,-6.068 12.938,-6.76 l 0,-14.027 2,0 0,14.027 C 14.938,-7.863 14.519,0 0,0"
+ style="fill:#0d597f;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path82"
+ inkscape:connector-curvature="0" /></g></g></svg> \ No newline at end of file
diff --git a/assets/favicon.ico b/assets/favicon.ico
new file mode 100644
index 0000000..471bba3
--- /dev/null
+++ b/assets/favicon.ico
Binary files differ
diff --git a/assets/style.css b/assets/style.css
new file mode 100644
index 0000000..f525dba
--- /dev/null
+++ b/assets/style.css
@@ -0,0 +1,81 @@
+html {
+ height: 100%;
+}
+
+html, body {
+ overflow-x: hidden;
+ margin: 0;
+ padding: 0;
+}
+
+body {
+ position: relative;
+ min-height: 100%;
+ background: #eee;
+ margin:auto;
+ width:80%;
+}
+
+
+
+header {
+ border-bottom: 2px solid #17a;
+ display: inline-block;
+ width: 100%;
+ /* fix inline-block auto margin */
+ margin-bottom: -4px;
+}
+
+#main {
+ background: #fff;
+ padding: 10px;
+ margin:0px;
+}
+
+form#search {
+ margin: 10px;
+}
+
+footer {
+ margin: 10px;
+ text-align: center;
+ font-size: 0.8em
+}
+
+img#logo {
+ width:300px;
+ float: left;
+ margin: 1em;
+ margin-right: 2em;
+}
+
+#sitenav {
+ float: right;
+ margin-top: 5em;
+}
+
+#pagenav {
+ float: left;
+ margin-top: 3em;
+ font-weight: bold;
+}
+
+nav a {
+ padding:3.2em 1em 3.2em;
+}
+
+nav a.active {
+ background-color: #17a;
+ color: white;
+}
+
+table {
+ font-size: 90%;
+ white-space: nowrap;
+}
+
+/* package */
+
+table#package {
+ width: 60%;
+ } \ No newline at end of file
diff --git a/tpl/contents.tpl b/tpl/contents.tpl
new file mode 100644
index 0000000..dc4fe92
--- /dev/null
+++ b/tpl/contents.tpl
@@ -0,0 +1,45 @@
+{{{header}}}
+ <div id="main">
+ <div class="panel panel-default">
+ <div class="panel-heading">Search the contents of packages</div>
+ <div class="panel-body">
+ <form class="form-inline" role="form" id="search">
+ <div class="form-group">
+ <label for="filename">Filename</label>
+ <input type="text" class="form-control" id="filename" name="filename" value="{{{filename}}}">
+ </div>
+ <div class="form-group">
+ <label for="arch">Architecture</label>
+ <select name="arch" class="form-control" id="arch">
+ <option>x86</option>
+ <option>x86_64</option>
+ <option>armhf</option>
+ </select>
+ </div>
+ <button type="submit" class="btn btn-primary">Search</button>
+ </form>
+ </div>
+ <div class="table-responsive">
+ <table class="table table-striped table-bordered table-condensed" data-toggle="table">
+ <tr>
+ <th>File</th>
+ <th>Package name</th>
+ <th>Repository</th>
+ <th>Architecture</th>
+ </tr>{{#rows}}
+ <tr>
+ <td>{{{file}}}</td>
+ <td>{{{pkgname}}}</td>
+ <td>{{{repo}}}</td>
+ <td>{{{arch}}}</td>
+ </tr>{{/rows}}
+ {{{^rows}}}
+ <tr>
+ <td colspan="4">No item found...</td>
+ </tr>
+ {{{/rows}}}
+ </table>
+ </div>
+ </div>
+ </div>
+{{{footer}}}
diff --git a/tpl/footer.tpl b/tpl/footer.tpl
new file mode 100644
index 0000000..60e689e
--- /dev/null
+++ b/tpl/footer.tpl
@@ -0,0 +1,3 @@
+ <footer>© Copyright 2014 Alpine Linux Development Team all rights reserved | <a href="http://www.alpinelinux.org/privacy-policy.html">Privacy Policy</a></footer>
+ </body>
+</html>
diff --git a/tpl/header.tpl b/tpl/header.tpl
new file mode 100644
index 0000000..fdfdb67
--- /dev/null
+++ b/tpl/header.tpl
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>Alpine aports fileindex</title>
+ <!-- Bootstrap -->
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
+ <link rel="stylesheet" href="/assets/style.css">
+ <link rel="shortcut icon" href="/assets/favicon.ico" />
+
+ <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
+ <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
+
+ <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
+ <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
+ <!--[if lt IE 9]>
+ <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
+ <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
+ <![endif]-->
+ </head>
+ <body>
+ <header>
+ <a href="/"><img id="logo" src="/assets/alpinelinux-logo.svg" alt="Alpine Linux logo" /></a>
+ <div id="pagenav">
+ <nav>
+ {{#packages}}
+ <a href="/packages" class="active">Packages</a>
+ {{/packages}}
+ {{^packages}}
+ <a href="/packages">Packages</a>
+ {{/packages}}
+ {{#contents}}
+ <a href="/contents" class="active" class="">Contents</a>
+ {{/contents}}
+ {{^contents}}
+ <a href="/contents" class="">Contents</a>
+ {{/contents}}
+ </nav>
+ </div>
+ <div id="sitenav">
+ <nav>
+ <a href="http://wiki.alpinelinux.org">wiki</a>
+ <a href="http://git.alpinelinux.org">git</a>
+ <a href="http://bugs.alpinelinux.org/projects/alpine/issues">bugs</a>
+ <a href="http://forum.alpinelinux.org/forum">forums</a>
+ </nav>
+ </div>
+ </header>
diff --git a/tpl/package.tpl b/tpl/package.tpl
new file mode 100644
index 0000000..e25110f
--- /dev/null
+++ b/tpl/package.tpl
@@ -0,0 +1,56 @@
+{{{header}}}
+ <div id="main">
+ <div class="panel panel-default">
+ <div class="panel-heading">Package details</div>
+ <div class="panel-body">
+ </div>
+ <table class="table table-striped table-bordered table-condensed" id="package">
+ {{#name}}
+ <tr>
+ <th>Name</th>
+ <td title="{{{desc}}}"><a href="/package/{{{name}}}">{{{name}}}</a></td>
+ </tr>
+ <tr>
+ <th>Version</th>
+ <td>{{{version}}}</td>
+ </tr>
+ <tr>
+ <th>Project</th>
+ <td><a href="{{{url}}}">URL</a></td>
+ </tr>
+ <tr>
+ <th>Licence</th>
+ <td>{{{lic}}}</td>
+ </tr>
+ <tr>
+ <th>Architecture</th>
+ <td>{{{arch}}}</td>
+ </tr>
+ <tr>
+ <th>Repository</th>
+ <td>Repository</td>
+ </tr>
+ <tr>
+ <th>Maintainer</th>
+ <td>{{{maintainer}}}</td>
+ </tr>
+ <tr>
+ <th>Build date</th>
+ <td>{{{build_time}}}</td>
+ </tr>
+ {{#install_if}}
+ <tr>
+ <th>Install if</th>
+ <td>{{{install_if}}}</td>
+ </tr>
+ {{/install_if}}
+ {{/name}}
+ {{^name}}
+ <tr>
+ <td>This package does not exist!</td>
+ </tr>
+ {{/name}}
+ </table>
+ </div>
+ </div>
+{{{footer}}}
diff --git a/tpl/packages.tpl b/tpl/packages.tpl
new file mode 100644
index 0000000..9027858
--- /dev/null
+++ b/tpl/packages.tpl
@@ -0,0 +1,51 @@
+{{{header}}}
+ <div id="main">
+ <div class="panel panel-default">
+ <div class="panel-heading">Search for packages</div>
+ <div class="panel-body">
+ <form class="form-inline" role="form" id="search">
+ <div class="form-group">
+ <label for="package">Package name</label>
+ <input type="text" class="form-control" id="package" name="package" value="{{{package}}}">
+ </div>
+ <div class="form-group">
+ <label for="arch">Architecture</label>
+ <select name="arch" class="form-control" id="arch">
+ <option>x86</option>
+ <option>x86_64</option>
+ <option>armhf</option>
+ </select>
+ </div>
+ <button type="submit" class="btn btn-primary">Search</button>
+ </form>
+ </div>
+ <table class="table table-striped table-bordered table-condensed">
+ <tr>
+ <th>Package</th>
+ <th>Version</th>
+ <th>Project</th>
+ <th>Licence</th>
+ <th>Architecture</th>
+ <th>Repository</th>
+ <th>Maintainer</th>
+ <th>Build date</th>
+ </tr>{{#rows}}
+ <tr>
+ <td class="package" title="{{{desc}}}"><a href="/package/{{{arch}}}/{{{package}}}">{{{package}}}</a></td>
+ <td class="version">{{{version}}}</td>
+ <td class="url"><a href="{{{project}}}">URL</a></td>
+ <td class="license">{{{license}}}</td>
+ <td class="arch">{{{arch}}}</td>
+ <td class="repo">{{{repo}}}</td>
+ <td class="maintainer">{{{maintainer}}}</td>
+ <td class="bdate">{{{bdate}}}</td>
+ </tr>{{/rows}}
+ {{{^rows}}}
+ <tr>
+ <td colspan="8">No item found...</td>
+ </tr>
+ {{{/rows}}}
+ </table>
+ </div>
+ </div>
+{{{footer}}}