Move /ranking -> /index/apps

This commit is contained in:
relikd
2020-09-25 23:16:57 +02:00
parent e2901503f4
commit f7c75d1bd5
8 changed files with 36 additions and 22 deletions

View File

@@ -51,6 +51,7 @@ digraph Dependency {
index_app_names -> index_categories index_app_names -> index_categories
index_categories -> html_categories index_categories -> html_categories
html_categories -> html_ranking html_categories -> html_ranking
html_index_apps -> html_ranking
index_rank -> html_bundle index_rank -> html_bundle
index_rank -> html_index_domains index_rank -> html_index_domains
index_domains -> html_index_domains index_domains -> html_index_domains

View File

@@ -11,18 +11,19 @@ def process(affected=None, per_page=60):
arr = [] arr = []
for fname, json in mylib.enum_categories(): for fname, json in mylib.enum_categories():
cid, cname = json['meta'] cid, cname = json['meta']
arr.append((cid, cname)) arr.append([cid, cname])
if affected and cid not in affected: if affected and cid not in affected:
continue continue
out_dir = mylib.path_add(base, cid) out_dir = mylib.path_add(base, cid)
# full url since categories can have page 2, 3, etc. # full url since categories can have page 2, 3, etc.
A = '<h2>' + HTML.a_path([(parent, '/category/')], cname) + \ A = HTML.h2_path_n_rank(cname, [(parent, '/category/')], 'ranking/')
'<a class="snd floatr" href="ranking/">Ranking</a></h2>'
Z = HTML.p_download_json('data.json', 'category-{}.json'.format(cid)) Z = HTML.p_download_json('data.json', 'category-{}.json'.format(cid))
# does BREAK html_ranking!! call html_categories before html_ranking
_, a = HTML.write_app_pages(out_dir, json['apps'], _, a = HTML.write_app_pages(out_dir, json['apps'],
cname, per_page, pre=A, post=Z) cname, per_page, pre=A, post=Z)
# write_app_pages breaks html_ranking!! call html_ranking after this!
print(' {} ({})'.format(cname, a)) print(' {} ({})'.format(cname, a))
if a > 1:
arr[-1][-1] += ' ({})'.format(a) # append count
mylib.symlink(fname, mylib.path_add(out_dir, 'data.json')) mylib.symlink(fname, mylib.path_add(out_dir, 'data.json'))
print(' .. {} categories'.format(len(arr))) print(' .. {} categories'.format(len(arr)))

View File

@@ -8,10 +8,11 @@ import index_app_names # get_sorted_app_names
def process(per_page=60): def process(per_page=60):
print('generating html: app-index ...') print('generating html: app-index ...')
title = 'Apps (AZ)' title = 'Apps (AZ)'
header = '<h2>' + HTML.a_path([('Results', '/results/')], title) + '</h2>' header = HTML.h2_path_n_rank(title, [('Results', '/results/')], 'ranking/')
p, a = HTML.write_app_pages(mylib.path_out('index', 'apps'), p, a = HTML.write_app_pages(mylib.path_out('index', 'apps'),
index_app_names.get_sorted_app_names(), index_app_names.get_sorted_app_names(),
title, per_page=per_page, pre=header) title, per_page=per_page, pre=header)
# write_app_pages breaks html_ranking!! call html_ranking after this!
print(' {} apps'.format(a)) print(' {} apps'.format(a))
print(' {} pages'.format(p)) print(' {} pages'.format(p))
print('') print('')

View File

@@ -124,7 +124,6 @@ def gen_results(c_apps, c_domains, title):
<li>List of <a href="/index/domains/all/">Requested Domains</a></li> <li>List of <a href="/index/domains/all/">Requested Domains</a></li>
<li>List of <a href="/index/domains/tracker/">Trackers</a></li> <li>List of <a href="/index/domains/tracker/">Trackers</a></li>
</ul> </ul>
<p>Or go ahead to the <b><a href="/ranking/">Ranking</a></b> directly.</p>
'''.format(title, c_apps, c_domains, c_recordings, c_logs), title=title) '''.format(title, c_apps, c_domains, c_recordings, c_logs), title=title)
mylib.symlink(index_rank.fname_app_rank(), mylib.symlink(index_rank.fname_app_rank(),
mylib.path_out('results', 'rank.json')) # after HTML.write mylib.path_out('results', 'rank.json')) # after HTML.write

View File

@@ -33,7 +33,7 @@ def write_ranking_category(cid, category_name):
src = html_base(('All Categories', '/category/'), src = html_base(('All Categories', '/category/'),
(category_name, '/category/{}/'.format(cid))) (category_name, '/category/{}/'.format(cid)))
src += HTML.p_download_json('data.json', src += HTML.p_download_json('data.json',
'results-category-{}.json'.format(cid)) 'raw-category-{}.json'.format(cid))
src += html_script_chunk('data.json') src += html_script_chunk('data.json')
HTML.write(base, src, title='Category Ranking: ' + category_name) HTML.write(base, src, title='Category Ranking: ' + category_name)
mylib.symlink(index_rank.fname_ranking_category(cid), mylib.symlink(index_rank.fname_ranking_category(cid),
@@ -41,8 +41,10 @@ def write_ranking_category(cid, category_name):
def write_ranking_all(title, base_dir): def write_ranking_all(title, base_dir):
src = html_base(('Results', '/results/')) # full urls since app index can have page 2, 3, etc.
src += HTML.p_download_json('data.json', 'results-all.json') src = html_base(('Results', '/results/'),
('Apps (AZ)', '/index/apps/'))
src += HTML.p_download_json('data.json', 'raw-apps.json')
src += html_script_chunk('data.json') src += html_script_chunk('data.json')
HTML.write(base_dir, src, title=title) HTML.write(base_dir, src, title=title)
mylib.symlink(index_rank.fname_ranking_all(), mylib.symlink(index_rank.fname_ranking_all(),
@@ -51,7 +53,7 @@ def write_ranking_all(title, base_dir):
def process(): def process():
print('generating html: ranking ...') print('generating html: ranking ...')
write_ranking_all('Ranking', mylib.path_out('ranking')) write_ranking_all('Ranking', mylib.path_out('index', 'apps', 'ranking'))
for _, json in mylib.enum_categories(): for _, json in mylib.enum_categories():
cid, name = json['meta'] cid, name = json['meta']
write_ranking_category(cid, name) write_ranking_category(cid, name)

View File

@@ -23,6 +23,11 @@ def a_subdomain(x, inner=None, attr_str=''):
return '<a{} href="/subdomain/#{}">{}</a>'.format(attr_str, x, inner or x) return '<a{} href="/subdomain/#{}">{}</a>'.format(attr_str, x, inner or x)
def h2_path_n_rank(title, path_parts, rank_href):
return '<h2>{} <a class="snd floatr" href="{}">Ranking</a></h2>'.format(
a_path(path_parts, title), rank_href)
def p_download_json(href, download_name): def p_download_json(href, download_name):
return '<p class="right snd">Download: <a href="{}" download="{}">json</a></p>'.format( return '<p class="right snd">Download: <a href="{}" download="{}">json</a></p>'.format(
href, download_name) href, download_name)

View File

@@ -36,12 +36,12 @@ def rebuild_html(bundle_ids=None, cat_ids=None, inclIApp=True, inclRoot=False):
if bundle_ids: if bundle_ids:
html_bundle.process(bundle_ids) # after index_rank html_bundle.process(bundle_ids) # after index_rank
html_categories.process(affected=cat_ids) # after index_categories html_categories.process(affected=cat_ids) # after index_categories
html_ranking.process() # after html_categories
html_index_domains.process() # after index_domains & index_rank html_index_domains.process() # after index_domains & index_rank
if inclIApp: if inclIApp:
html_index_apps.process() # after index_categories html_index_apps.process() # after index_categories
else: else:
print('no new bundle, not rebuilding index') print('no new bundle, not rebuilding index')
html_ranking.process() # after html_categories & html_index_apps
if inclRoot: # TODO: remove check if root contains dynamic content if inclRoot: # TODO: remove check if root contains dynamic content
html_root.process() html_root.process()

View File

@@ -38,12 +38,12 @@
<polygon fill="black" stroke="black" points="476.631,-262.515 478.774,-252.14 470.628,-258.914 476.631,-262.515"></polygon> <polygon fill="black" stroke="black" points="476.631,-262.515 478.774,-252.14 470.628,-258.914 476.631,-262.515"></polygon>
</g> </g>
<!-- download_tracker --> <!-- download_tracker -->
<g id="node29" class="node"><title>download_tracker</title> <g id="node30" class="node"><title>download_tracker</title>
<ellipse fill="none" stroke="black" cx="563" cy="-306" rx="80.1284" ry="18"></ellipse> <ellipse fill="none" stroke="black" cx="563" cy="-306" rx="80.1284" ry="18"></ellipse>
<text text-anchor="middle" x="563" y="-301.8" font-family="Times,serif" font-size="14.00">download_tracker</text> <text text-anchor="middle" x="563" y="-301.8" font-family="Times,serif" font-size="14.00">download_tracker</text>
</g> </g>
<!-- .&#45;&gt;download_tracker --> <!-- .&#45;&gt;download_tracker -->
<g id="edge30" class="edge"><title>.-&gt;download_tracker</title> <g id="edge32" class="edge"><title>.-&gt;download_tracker</title>
<path fill="none" stroke="black" d="M423.186,-367.414C447.609,-356.86 487.511,-339.619 518.449,-326.251"></path> <path fill="none" stroke="black" d="M423.186,-367.414C447.609,-356.86 487.511,-339.619 518.449,-326.251"></path>
<polygon fill="black" stroke="black" points="519.944,-329.417 527.735,-322.238 517.167,-322.992 519.944,-329.417"></polygon> <polygon fill="black" stroke="black" points="519.944,-329.417 527.735,-322.238 517.167,-322.992 519.944,-329.417"></polygon>
</g> </g>
@@ -93,27 +93,27 @@
<polygon fill="black" stroke="black" points="271.335,-184.385 261.789,-179.789 266.385,-189.335 271.335,-184.385"></polygon> <polygon fill="black" stroke="black" points="271.335,-184.385 261.789,-179.789 266.385,-189.335 271.335,-184.385"></polygon>
</g> </g>
<!-- html_bundle --> <!-- html_bundle -->
<g id="node24" class="node"><title>html_bundle</title> <g id="node25" class="node"><title>html_bundle</title>
<ellipse fill="none" stroke="black" cx="396" cy="-90" rx="59.2871" ry="18"></ellipse> <ellipse fill="none" stroke="black" cx="396" cy="-90" rx="59.2871" ry="18"></ellipse>
<text text-anchor="middle" x="396" y="-85.8" font-family="Times,serif" font-size="14.00">html_bundle</text> <text text-anchor="middle" x="396" y="-85.8" font-family="Times,serif" font-size="14.00">html_bundle</text>
</g> </g>
<!-- index_rank&#45;&gt;html_bundle --> <!-- index_rank&#45;&gt;html_bundle -->
<g id="edge24" class="edge"><title>index_rank-&gt;html_bundle</title> <g id="edge26" class="edge"><title>index_rank-&gt;html_bundle</title>
<path fill="none" stroke="black" d="M401.27,-143.697C400.498,-135.983 399.571,-126.712 398.711,-118.112"></path> <path fill="none" stroke="black" d="M401.27,-143.697C400.498,-135.983 399.571,-126.712 398.711,-118.112"></path>
<polygon fill="black" stroke="black" points="402.188,-117.706 397.71,-108.104 395.223,-118.403 402.188,-117.706"></polygon> <polygon fill="black" stroke="black" points="402.188,-117.706 397.71,-108.104 395.223,-118.403 402.188,-117.706"></polygon>
</g> </g>
<!-- html_index_domains --> <!-- html_index_domains -->
<g id="node26" class="node"><title>html_index_domains</title> <g id="node27" class="node"><title>html_index_domains</title>
<ellipse fill="none" stroke="black" cx="566" cy="-90" rx="92.3709" ry="18"></ellipse> <ellipse fill="none" stroke="black" cx="566" cy="-90" rx="92.3709" ry="18"></ellipse>
<text text-anchor="middle" x="566" y="-85.8" font-family="Times,serif" font-size="14.00">html_index_domains</text> <text text-anchor="middle" x="566" y="-85.8" font-family="Times,serif" font-size="14.00">html_index_domains</text>
</g> </g>
<!-- index_rank&#45;&gt;html_index_domains --> <!-- index_rank&#45;&gt;html_index_domains -->
<g id="edge26" class="edge"><title>index_rank-&gt;html_index_domains</title> <g id="edge28" class="edge"><title>index_rank-&gt;html_index_domains</title>
<path fill="none" stroke="black" d="M434.815,-147.337C459.181,-136.873 493.128,-122.295 520.384,-110.59"></path> <path fill="none" stroke="black" d="M434.815,-147.337C459.181,-136.873 493.128,-122.295 520.384,-110.59"></path>
<polygon fill="black" stroke="black" points="521.912,-113.743 529.719,-106.581 519.149,-107.311 521.912,-113.743"></polygon> <polygon fill="black" stroke="black" points="521.912,-113.743 529.719,-106.581 519.149,-107.311 521.912,-113.743"></polygon>
</g> </g>
<!-- index_domains&#45;&gt;html_index_domains --> <!-- index_domains&#45;&gt;html_index_domains -->
<g id="edge28" class="edge"><title>index_domains-&gt;html_index_domains</title> <g id="edge30" class="edge"><title>index_domains-&gt;html_index_domains</title>
<path fill="none" stroke="black" d="M560.73,-143.697C561.502,-135.983 562.429,-126.712 563.289,-118.112"></path> <path fill="none" stroke="black" d="M560.73,-143.697C561.502,-135.983 562.429,-126.712 563.289,-118.112"></path>
<polygon fill="black" stroke="black" points="566.777,-118.403 564.29,-108.104 559.812,-117.706 566.777,-118.403"></polygon> <polygon fill="black" stroke="black" points="566.777,-118.403 564.29,-108.104 559.812,-117.706 566.777,-118.403"></polygon>
</g> </g>
@@ -139,13 +139,18 @@
</g> </g>
<!-- html_ranking --> <!-- html_ranking -->
<g id="node22" class="node"><title>html_ranking</title> <g id="node22" class="node"><title>html_ranking</title>
<ellipse fill="none" stroke="black" cx="245" cy="-18" rx="63.108" ry="18"></ellipse> <ellipse fill="none" stroke="black" cx="161" cy="-18" rx="63.108" ry="18"></ellipse>
<text text-anchor="middle" x="245" y="-13.8" font-family="Times,serif" font-size="14.00">html_ranking</text> <text text-anchor="middle" x="161" y="-13.8" font-family="Times,serif" font-size="14.00">html_ranking</text>
</g>
<!-- html_index_apps&#45;&gt;html_ranking -->
<g id="edge24" class="edge"><title>html_index_apps-&gt;html_ranking</title>
<path fill="none" stroke="black" d="M96.9068,-72.411C107.865,-63.2789 121.629,-51.8093 133.59,-41.8418"></path>
<polygon fill="black" stroke="black" points="136.084,-44.3191 141.526,-35.2285 131.603,-38.9416 136.084,-44.3191"></polygon>
</g> </g>
<!-- html_categories&#45;&gt;html_ranking --> <!-- html_categories&#45;&gt;html_ranking -->
<g id="edge22" class="edge"><title>html_categories-&gt;html_ranking</title> <g id="edge22" class="edge"><title>html_categories-&gt;html_ranking</title>
<path fill="none" stroke="black" d="M245,-71.6966C245,-63.9827 245,-54.7125 245,-46.1124"></path> <path fill="none" stroke="black" d="M225.093,-72.411C214.135,-63.2789 200.371,-51.8093 188.41,-41.8418"></path>
<polygon fill="black" stroke="black" points="248.5,-46.1043 245,-36.1043 241.5,-46.1044 248.5,-46.1043"></polygon> <polygon fill="black" stroke="black" points="190.397,-38.9416 180.474,-35.2285 185.916,-44.3191 190.397,-38.9416"></polygon>
</g> </g>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.8 KiB