-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add registry subdomain and suspensions page openrightsgroup/Blocking-…
- Loading branch information
Showing
5 changed files
with
104 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import os | ||
import re | ||
import psycopg2 | ||
import logging | ||
import datetime | ||
import itertools | ||
|
||
from flask import Blueprint, render_template, redirect, request, \ | ||
g, url_for, abort, config, current_app, session, flash, jsonify, Response | ||
|
||
from models import * | ||
from auth import * | ||
from utils import * | ||
from resources import * | ||
from db import * | ||
|
||
import NORM | ||
from NORM.exceptions import ObjectNotFound,ObjectExists | ||
|
||
registry_pages = Blueprint('registry', __name__, template_folder='templates/registry') | ||
|
||
|
||
@registry_pages.route('/') | ||
@registry_pages.route('/suspensions') | ||
@registry_pages.route('/suspensions/<int:page>') | ||
def registry_suspensions(page=1): | ||
pagesize = 25 | ||
offset = (page-1)*pagesize | ||
|
||
res = NORM.Query(g.conn, "select count(*), max(created) from public.registry_suspension_urls", []) | ||
row = res.fetchone() | ||
count = row[0] | ||
pagecount = get_pagecount(count, pagesize) | ||
newdate = row[1] | ||
|
||
sql = "select * from public.registry_suspension_urls limit {0} offset {1}".format(pagesize, offset) | ||
print sql | ||
suspensions = NORM.Query(g.conn, sql, []) | ||
g.conn.commit() | ||
return render_template('registry_suspensions.html', | ||
suspensions=suspensions, | ||
page=page, | ||
count=count, | ||
newdate=newdate, | ||
pagesize=pagesize, | ||
pagecount=pagecount) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
BlockedFrontend/templates/registry/registry_suspensions.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{% extends "BasicPage.page.html" %} | ||
{%import "remotecontent.part.html" as rmt %} | ||
{%import "paging.part.html" as paging %} | ||
|
||
{% set pagetitle = "Registry suspensions" %} | ||
|
||
{%block banner_text %} | ||
{% call rmt.remote('banner_text') %} | ||
Domains that have been suspended by their registrar | ||
{% endcall %} | ||
{% endblock %} | ||
|
||
{% block main_menu %} | ||
{{ chunks.registry_menu() }} | ||
{% endblock %} | ||
|
||
{% block body %} | ||
|
||
<h3>{{ count }} suspended domain{{ '' if count == 1 else 's' }} found</h3> | ||
|
||
<table class="table"> | ||
<tr> | ||
<th>Domain</th> | ||
<th>Registrar</th> | ||
<th>Detected</th> | ||
<th>Last Seen</th> | ||
</tr> | ||
{% for row in suspensions %} | ||
<tr> | ||
<td>{{ row.url|noproto }} </td> | ||
<td>{{ row.registry|title }}</td> | ||
<td>{{ row.created|fmdate }} {% if row.created == newdate %}<span class="label label-info">New</span>{% endif %}</td> | ||
<td>{{ row.lastseen|fmdate }}</td> | ||
</tr> | ||
{% endfor %} | ||
|
||
</table> | ||
{{ paging.page_list('.registry_suspensions', page, pagecount, pagesize) }} | ||
|
||
{% endblock %} |