Ejemplo n.º 1
0
    def website_info(website_id):
        website = db.get_website_by_id(website_id)

        if website:
            return render_template("website.html", website=website)
        else:
            abort(404)
Ejemplo n.º 2
0
    def website_links(website_id):
        website = db.get_website_by_id(website_id)

        if website:
            links = searchEngine.get_link_list(website_id, website.url)
            return Response("\n".join(links), mimetype="text/plain")
        else:
            abort(404)
Ejemplo n.º 3
0
    def website_json_chart(website_id):
        website = db.get_website_by_id(website_id)

        if website:
            stats = searchEngine.get_stats(website_id)
            stats["base_url"] = website.url
            stats["report_time"] = website.last_modified
            return Response(json.dumps(stats), mimetype="application/json")
        else:
            abort(404)
Ejemplo n.º 4
0
    def admin_rescan_website(website_id):
        require_role("admin")
        website = db.get_website_by_id(website_id)

        if website:
            priority = request.args.get("priority") if "priority" in request.args else 1
            task = Task(website_id, website.url, priority)
            taskManager.queue_task(task)

            flash("Enqueued rescan task", "success")
        else:
            flash("Website does not exist", "danger")
        return redirect("/website/" + str(website_id))