mirror of
https://github.com/openzim/zimit.git
synced 2025-09-22 11:22:23 -04:00
parent
ddb0eb69e3
commit
df2d0ccada
33
README.rst
33
README.rst
@ -11,8 +11,8 @@ Exposed API
|
||||
All APIs are talking JSON over HTTP. As such, all parameters should be sent as
|
||||
stringified JSON and the Content-Type should be set to "application/json".
|
||||
|
||||
POST /websites
|
||||
==============
|
||||
POST /website-zim
|
||||
=================
|
||||
|
||||
By posting to this endpoint, you are asking the system to start a new download
|
||||
of a website and a conversion into a Zim format.
|
||||
@ -47,6 +47,19 @@ Status codes
|
||||
it contains information about what is missing.
|
||||
- `201 Created` will be returned if the process started.
|
||||
|
||||
Exemple
|
||||
-------
|
||||
|
||||
::
|
||||
|
||||
$ http POST http://0.0.0.0:6543/website-url url="https://refugeeinfo.eu/" title="Refugee Info" email="alexis@notmyidea.org"
|
||||
HTTP/1.1 201 Created
|
||||
|
||||
{
|
||||
"job": "5012abe3-bee2-4dd7-be87-39a88d76035d"
|
||||
}
|
||||
|
||||
|
||||
GET /status/{jobid}
|
||||
===================
|
||||
|
||||
@ -65,6 +78,20 @@ Status codes
|
||||
- `404 Not Found` will be returned in case the requested job does not exist.
|
||||
- `200 OK` will be returned in any other case.
|
||||
|
||||
Exemple
|
||||
-------
|
||||
|
||||
::
|
||||
|
||||
http GET http://0.0.0.0:6543/status/5012abe3-bee2-4dd7-be87-39a88d76035d
|
||||
HTTP/1.1 200 OK
|
||||
|
||||
{
|
||||
"log": "<snip>",
|
||||
"status": "finished"
|
||||
}
|
||||
|
||||
|
||||
Okay, so how do I install it on my server?
|
||||
##########################################
|
||||
|
||||
@ -92,7 +119,7 @@ In a separate process, you also need to run the worker::
|
||||
|
||||
And you're ready to go. To test it::
|
||||
|
||||
$ http POST http://0.0.0.0:6543/website url="https://refugeeinfo.eu/" title="Refugee Info" email="alexis@notmyidea.org"
|
||||
$ http POST http://0.0.0.0:6543/website-url url="https://refugeeinfo.eu/" title="Refugee Info" email="alexis@notmyidea.org"
|
||||
|
||||
|
||||
Debian dependencies
|
||||
|
@ -67,7 +67,7 @@ function submitForm() {
|
||||
title: getField('title'),
|
||||
email: getField('email'),
|
||||
}
|
||||
fetch("/website", {
|
||||
fetch("/website-zim", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(content),
|
||||
headers: {'Content-Type': 'application/json'}
|
||||
|
@ -1,107 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="mdl-js"><head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
<title>Zim It!</title>
|
||||
|
||||
<link rel="stylesheet" href="assets/material.css">
|
||||
<script src="assets/material.js"></script>
|
||||
<link rel="stylesheet" href="assets/icon.css">
|
||||
<link href="assets/css.css" rel="stylesheet" type="text/css">
|
||||
<link rel="stylesheet" href="assets/main.html">
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="mdl-layout__container"><div data-upgraded=",MaterialLayout" class="mdl-layout mdl-js-layout mdl-layout--fixed-header is-upgraded">
|
||||
|
||||
|
||||
<header class="mdl-layout__header is-casting-shadow">
|
||||
<div class="mdl-layout__header-row">
|
||||
<span class="mdl-layout-title0"><a href="#"><img src="assets/koombook-nb.png" height="30"></a></span>
|
||||
<div class="mdl-layout-spacer"></div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main class="mdl-layout__content">
|
||||
|
||||
<form action="#" method="post">
|
||||
|
||||
<div data-upgraded=",MaterialTabs,MaterialRipple" class="mdl-tabs mdl-js-tabs mdl-js-ripple-effect mdl-js-ripple-effect--ignore-events is-upgraded">
|
||||
<div class="mdl-grid">
|
||||
<div class="mdl-tabs__tab-bar mdl-cell--10-col mdl-cell--stretch">
|
||||
<a href="#starks-panel" class="mdl-tabs__tab is-active">Zim Essentials<span data-upgraded=",MaterialRipple" class="mdl-tabs__ripple-container mdl-js-ripple-effect"><span style="width: 339.923px; height: 339.923px; transform: translate(-50%, -50%) translate(121px, 35px);" class="mdl-ripple is-animating"></span></span></a>
|
||||
<a href="#lannisters-panel" class="mdl-tabs__tab">Zim Optional<span data-upgraded=",MaterialRipple" class="mdl-tabs__ripple-container mdl-js-ripple-effect"><span style="width: 313.178px; height: 313.178px; transform: translate(-50%, -50%) translate(56px, 28px);" class="mdl-ripple is-animating"></span></span></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mdl-tabs__panel is-active" id="starks-panel">
|
||||
<div class="mdl-grid">
|
||||
<div data-upgraded=",MaterialTextfield" class="mdl-textfield mdl-js-textfield mdl-cell mdl-cell--10-col is-upgraded">
|
||||
<input class="mdl-textfield__input" id="zim_url" type="url">
|
||||
<label class="mdl-textfield__label" for="zim_url">Url</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mdl-grid">
|
||||
<div data-upgraded=",MaterialTextfield" class="mdl-textfield mdl-js-textfield mdl-cell mdl-cell--5-col is-upgraded">
|
||||
<input class="mdl-textfield__input" id="zim_title" type="text">
|
||||
<label class="mdl-textfield__label" for="zim_titre">Zim Title</label>
|
||||
</div>
|
||||
<div data-upgraded=",MaterialTextfield" class="mdl-textfield mdl-js-textfield mdl-cell mdl-cell--5-col is-dirty is-upgraded">
|
||||
<select class="mdl-textfield__input" name="zim_lang" id="zim_lang">
|
||||
<option selected="selected" value="en">English</option>
|
||||
<option value="ar">Arabic</option>
|
||||
<option value="fr">French</option>
|
||||
<option value="es">Spanish</option>
|
||||
<option value="it">Italian</option>
|
||||
<option value="cn">Chinese</option>
|
||||
</select>
|
||||
<label class="mdl-textfield__label" for="zim_lang">zim Language</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mdl-tabs__panel" id="lannisters-panel">
|
||||
<div class="mdl-grid">
|
||||
<div data-upgraded=",MaterialTextfield" class="mdl-textfield mdl-js-textfield mdl-cell mdl-cell--10-col is-upgraded">
|
||||
<textarea data-upgraded=",MaterialTextfield" class="mdl-textfield__input mdl-js-textfield" type="text" rows="3" id="zim_description"></textarea>
|
||||
<label class="mdl-textfield__label" for="zim_description">Zim Description</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mdl-grid">
|
||||
<div data-upgraded=",MaterialTextfield" class="mdl-textfield mdl-js-textfield mdl-cell mdl-cell--5-col is-upgraded">
|
||||
<input class="mdl-textfield__input" id="zim_author" type="text">
|
||||
<label class="mdl-textfield__label" for="zim_author">Zim Author</label>
|
||||
</div>
|
||||
<div data-upgraded=",MaterialTextfield" class="mdl-textfield mdl-js-textfield mdl-cell mdl-cell--5-col is-upgraded">
|
||||
<input class="mdl-textfield__input" id="zim_email" type="email">
|
||||
<label class="mdl-textfield__label" for="zim_email">Author E-mail</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- /panel -->
|
||||
</div>
|
||||
<!-- /tabs -->
|
||||
|
||||
<div class="mdl-grid">
|
||||
<p class="mdl-cell mdl-cell--10-col" style="margin-bottom:40px">This is a zim creator. Enter the <em>url</em> of the website you want ton turn in a zim file, a <em>title</em> and the <em>language</em> and click on <em>Create zim File</em>. <br>If
|
||||
needed, you can also add a description, the name of the origanl author
|
||||
of the content and your email if you want to be notified when the zim is
|
||||
ready. Enjoy !</p>
|
||||
<div data-upgraded=",MaterialTextfield" class="mdl-textfield mdl-js-textfield mdl-cell mdl-cell--10-col">
|
||||
<button data-upgraded=",MaterialButton,MaterialRipple" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent">Create zim file<span class="mdl-button__ripple-container"><span class="mdl-ripple"></span></span></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</main>
|
||||
|
||||
</div></div>
|
||||
|
||||
|
||||
|
||||
</body></html>
|
@ -6,7 +6,7 @@ from pyramid.httpexceptions import HTTPTemporaryRedirect, HTTPNotFound
|
||||
|
||||
from zimit.worker import create_zim
|
||||
|
||||
website = Service(name='website', path='/website')
|
||||
website = Service(name='website', path='/website-zim')
|
||||
home = Service(name='home', path='/')
|
||||
status = Service(name='status', path='/status/{id}')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user