summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-04-21 02:22:44 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-04-21 02:22:44 -0400
commit03fa7e4f27bdb39a8f8f5ed91a87d18bf8357b47 (patch)
treec67eafcbda55706f18400b3115a2b8a5be318394 /public
parent91c451821ce7000cbc268cec8427d208a6cedd7e (diff)
parentb8ee7b1ee281b45b245fb454228b8ad847c56200 (diff)
Merge branch 'archweb' into archweb-generic2
Conflicts: devel/views.py feeds.py public/views.py settings.py sitestatic/archweb.js templates/base.html templates/devel/profile.html templates/mirrors/status.html templates/news/view.html templates/packages/flaghelp.html templates/packages/opensearch.xml templates/public/download.html templates/public/feeds.html templates/public/index.html templates/registration/login.html templates/releng/results.html templates/todolists/public_list.html
Diffstat (limited to 'public')
-rw-r--r--public/static/logos/archlinux-logo-black-1200dpi.pngbin283011 -> 131811 bytes
-rw-r--r--public/static/logos/archlinux-logo-black-90dpi.pngbin12971 -> 8291 bytes
-rw-r--r--public/static/logos/archlinux-logo-dark-1200dpi.pngbin291912 -> 260724 bytes
-rw-r--r--public/static/logos/archlinux-logo-dark-90dpi.pngbin13805 -> 11178 bytes
-rw-r--r--public/static/logos/archlinux-logo-light-1200dpi.pngbin284099 -> 251334 bytes
-rw-r--r--public/static/logos/archlinux-logo-light-90dpi.pngbin13084 -> 11047 bytes
-rw-r--r--public/static/logos/archlinux-logo-white-1200dpi.pngbin263771 -> 131811 bytes
-rw-r--r--public/static/logos/archlinux-logo-white-90dpi.pngbin11870 -> 8291 bytes
-rw-r--r--public/static/logos/legacy/arch-legacy-aqua-blue.pngbin11150 -> 10281 bytes
-rw-r--r--public/static/logos/legacy/arch-legacy-aqua-white.pngbin9171 -> 5527 bytes
-rw-r--r--public/static/logos/legacy/arch-legacy-aqua.pngbin7709 -> 7177 bytes
-rw-r--r--public/static/logos/legacy/arch-legacy-blue1.pngbin6563 -> 5108 bytes
-rw-r--r--public/static/logos/legacy/arch-legacy-blue2.pngbin4588 -> 3510 bytes
-rw-r--r--public/static/logos/legacy/arch-legacy-noodle-blue.pngbin13223 -> 12231 bytes
-rw-r--r--public/static/logos/legacy/arch-legacy-noodle-box.pngbin12060 -> 11235 bytes
-rw-r--r--public/static/logos/legacy/arch-legacy-noodle-cup.pngbin9971 -> 9446 bytes
-rw-r--r--public/static/logos/legacy/arch-legacy-noodle-white.pngbin11340 -> 9589 bytes
-rw-r--r--public/static/logos/legacy/arch-legacy-ribbon1.pngbin11628 -> 5255 bytes
-rw-r--r--public/static/logos/legacy/arch-legacy-ribbon2.pngbin12390 -> 5361 bytes
-rw-r--r--public/static/logos/legacy/arch-legacy-ribbon3.pngbin15590 -> 6467 bytes
-rw-r--r--public/static/logos/legacy/arch-legacy-ribbon4.pngbin16747 -> 6813 bytes
-rw-r--r--public/static/logos/legacy/arch-legacy-ribbon5.pngbin4986 -> 4896 bytes
-rw-r--r--public/static/logos/legacy/arch-legacy-ribbon6.pngbin15700 -> 6457 bytes
-rw-r--r--public/static/logos/legacy/arch-legacy-wombat-lg.pngbin114926 -> 99457 bytes
-rw-r--r--public/static/logos/legacy/arch-legacy-wombat.pngbin7761 -> 7102 bytes
-rw-r--r--public/utils.py27
-rw-r--r--public/views.py124
27 files changed, 122 insertions, 29 deletions
diff --git a/public/static/logos/archlinux-logo-black-1200dpi.png b/public/static/logos/archlinux-logo-black-1200dpi.png
index a3082c39..3b6b6e48 100644
--- a/public/static/logos/archlinux-logo-black-1200dpi.png
+++ b/public/static/logos/archlinux-logo-black-1200dpi.png
Binary files differ
diff --git a/public/static/logos/archlinux-logo-black-90dpi.png b/public/static/logos/archlinux-logo-black-90dpi.png
index 6948b795..528f9d62 100644
--- a/public/static/logos/archlinux-logo-black-90dpi.png
+++ b/public/static/logos/archlinux-logo-black-90dpi.png
Binary files differ
diff --git a/public/static/logos/archlinux-logo-dark-1200dpi.png b/public/static/logos/archlinux-logo-dark-1200dpi.png
index 24a5cefa..62eeba12 100644
--- a/public/static/logos/archlinux-logo-dark-1200dpi.png
+++ b/public/static/logos/archlinux-logo-dark-1200dpi.png
Binary files differ
diff --git a/public/static/logos/archlinux-logo-dark-90dpi.png b/public/static/logos/archlinux-logo-dark-90dpi.png
index f3757c61..8830fe11 100644
--- a/public/static/logos/archlinux-logo-dark-90dpi.png
+++ b/public/static/logos/archlinux-logo-dark-90dpi.png
Binary files differ
diff --git a/public/static/logos/archlinux-logo-light-1200dpi.png b/public/static/logos/archlinux-logo-light-1200dpi.png
index 79e0a0f1..d5399e9a 100644
--- a/public/static/logos/archlinux-logo-light-1200dpi.png
+++ b/public/static/logos/archlinux-logo-light-1200dpi.png
Binary files differ
diff --git a/public/static/logos/archlinux-logo-light-90dpi.png b/public/static/logos/archlinux-logo-light-90dpi.png
index 95803309..e5f4055d 100644
--- a/public/static/logos/archlinux-logo-light-90dpi.png
+++ b/public/static/logos/archlinux-logo-light-90dpi.png
Binary files differ
diff --git a/public/static/logos/archlinux-logo-white-1200dpi.png b/public/static/logos/archlinux-logo-white-1200dpi.png
index 50e700cf..4c287e32 100644
--- a/public/static/logos/archlinux-logo-white-1200dpi.png
+++ b/public/static/logos/archlinux-logo-white-1200dpi.png
Binary files differ
diff --git a/public/static/logos/archlinux-logo-white-90dpi.png b/public/static/logos/archlinux-logo-white-90dpi.png
index 86679601..3c7173bc 100644
--- a/public/static/logos/archlinux-logo-white-90dpi.png
+++ b/public/static/logos/archlinux-logo-white-90dpi.png
Binary files differ
diff --git a/public/static/logos/legacy/arch-legacy-aqua-blue.png b/public/static/logos/legacy/arch-legacy-aqua-blue.png
index 9637ce72..4bbb215d 100644
--- a/public/static/logos/legacy/arch-legacy-aqua-blue.png
+++ b/public/static/logos/legacy/arch-legacy-aqua-blue.png
Binary files differ
diff --git a/public/static/logos/legacy/arch-legacy-aqua-white.png b/public/static/logos/legacy/arch-legacy-aqua-white.png
index 25fe9001..68ae73b6 100644
--- a/public/static/logos/legacy/arch-legacy-aqua-white.png
+++ b/public/static/logos/legacy/arch-legacy-aqua-white.png
Binary files differ
diff --git a/public/static/logos/legacy/arch-legacy-aqua.png b/public/static/logos/legacy/arch-legacy-aqua.png
index 881e1709..8cc7da47 100644
--- a/public/static/logos/legacy/arch-legacy-aqua.png
+++ b/public/static/logos/legacy/arch-legacy-aqua.png
Binary files differ
diff --git a/public/static/logos/legacy/arch-legacy-blue1.png b/public/static/logos/legacy/arch-legacy-blue1.png
index 3ed6c248..403a0661 100644
--- a/public/static/logos/legacy/arch-legacy-blue1.png
+++ b/public/static/logos/legacy/arch-legacy-blue1.png
Binary files differ
diff --git a/public/static/logos/legacy/arch-legacy-blue2.png b/public/static/logos/legacy/arch-legacy-blue2.png
index 8b5b791e..809ad4f0 100644
--- a/public/static/logos/legacy/arch-legacy-blue2.png
+++ b/public/static/logos/legacy/arch-legacy-blue2.png
Binary files differ
diff --git a/public/static/logos/legacy/arch-legacy-noodle-blue.png b/public/static/logos/legacy/arch-legacy-noodle-blue.png
index b24d34cf..cf7c00ed 100644
--- a/public/static/logos/legacy/arch-legacy-noodle-blue.png
+++ b/public/static/logos/legacy/arch-legacy-noodle-blue.png
Binary files differ
diff --git a/public/static/logos/legacy/arch-legacy-noodle-box.png b/public/static/logos/legacy/arch-legacy-noodle-box.png
index 1162ed64..78d76a6a 100644
--- a/public/static/logos/legacy/arch-legacy-noodle-box.png
+++ b/public/static/logos/legacy/arch-legacy-noodle-box.png
Binary files differ
diff --git a/public/static/logos/legacy/arch-legacy-noodle-cup.png b/public/static/logos/legacy/arch-legacy-noodle-cup.png
index b4f93078..c62cceee 100644
--- a/public/static/logos/legacy/arch-legacy-noodle-cup.png
+++ b/public/static/logos/legacy/arch-legacy-noodle-cup.png
Binary files differ
diff --git a/public/static/logos/legacy/arch-legacy-noodle-white.png b/public/static/logos/legacy/arch-legacy-noodle-white.png
index a12ee21c..04c17c53 100644
--- a/public/static/logos/legacy/arch-legacy-noodle-white.png
+++ b/public/static/logos/legacy/arch-legacy-noodle-white.png
Binary files differ
diff --git a/public/static/logos/legacy/arch-legacy-ribbon1.png b/public/static/logos/legacy/arch-legacy-ribbon1.png
index fb8e7720..dba79302 100644
--- a/public/static/logos/legacy/arch-legacy-ribbon1.png
+++ b/public/static/logos/legacy/arch-legacy-ribbon1.png
Binary files differ
diff --git a/public/static/logos/legacy/arch-legacy-ribbon2.png b/public/static/logos/legacy/arch-legacy-ribbon2.png
index 66635999..eccd61be 100644
--- a/public/static/logos/legacy/arch-legacy-ribbon2.png
+++ b/public/static/logos/legacy/arch-legacy-ribbon2.png
Binary files differ
diff --git a/public/static/logos/legacy/arch-legacy-ribbon3.png b/public/static/logos/legacy/arch-legacy-ribbon3.png
index c3c00b85..df412335 100644
--- a/public/static/logos/legacy/arch-legacy-ribbon3.png
+++ b/public/static/logos/legacy/arch-legacy-ribbon3.png
Binary files differ
diff --git a/public/static/logos/legacy/arch-legacy-ribbon4.png b/public/static/logos/legacy/arch-legacy-ribbon4.png
index 33a78edf..8f0ed3a0 100644
--- a/public/static/logos/legacy/arch-legacy-ribbon4.png
+++ b/public/static/logos/legacy/arch-legacy-ribbon4.png
Binary files differ
diff --git a/public/static/logos/legacy/arch-legacy-ribbon5.png b/public/static/logos/legacy/arch-legacy-ribbon5.png
index abf7cce4..e48dc537 100644
--- a/public/static/logos/legacy/arch-legacy-ribbon5.png
+++ b/public/static/logos/legacy/arch-legacy-ribbon5.png
Binary files differ
diff --git a/public/static/logos/legacy/arch-legacy-ribbon6.png b/public/static/logos/legacy/arch-legacy-ribbon6.png
index 9f275f22..c3091240 100644
--- a/public/static/logos/legacy/arch-legacy-ribbon6.png
+++ b/public/static/logos/legacy/arch-legacy-ribbon6.png
Binary files differ
diff --git a/public/static/logos/legacy/arch-legacy-wombat-lg.png b/public/static/logos/legacy/arch-legacy-wombat-lg.png
index 0661b6f5..661ec0a9 100644
--- a/public/static/logos/legacy/arch-legacy-wombat-lg.png
+++ b/public/static/logos/legacy/arch-legacy-wombat-lg.png
Binary files differ
diff --git a/public/static/logos/legacy/arch-legacy-wombat.png b/public/static/logos/legacy/arch-legacy-wombat.png
index 67e1afac..52678145 100644
--- a/public/static/logos/legacy/arch-legacy-wombat.png
+++ b/public/static/logos/legacy/arch-legacy-wombat.png
Binary files differ
diff --git a/public/utils.py b/public/utils.py
index a40c9b53..fcfd0f77 100644
--- a/public/utils.py
+++ b/public/utils.py
@@ -1,6 +1,7 @@
+from collections import defaultdict
from operator import attrgetter
-from main.models import Arch, Package
+from main.models import Arch, Repo, Package
from main.utils import cache_function, groupby_preserve_order, PackageStandin
class RecentUpdate(object):
@@ -44,13 +45,27 @@ class RecentUpdate(object):
else:
# fake out the template- this is slightly hacky but yields one
# 'package-like' object per arch which is what the normal loop does
- arches = set()
+ by_arch = defaultdict(list)
for package in self.others:
- if package.arch not in arches and not arches.add(package.arch):
- yield PackageStandin(package)
+ by_arch[package.arch].append(package)
+ for arch, packages in by_arch.items():
+ if len(packages) == 1:
+ yield packages[0]
+ else:
+ yield PackageStandin(packages[0])
+
+ def __unicode__(self):
+ return "RecentUpdate '%s %s' <%d packages>" % (
+ self.pkgbase, self.version, len(self.packages))
@cache_function(62)
-def get_recent_updates(number=15):
+def get_recent_updates(number=15, testing=True, staging=False):
+ repos = Repo.objects.all()
+ if not testing:
+ repos = repos.exclude(testing=True)
+ if not staging:
+ repos = repos.exclude(staging=True)
+
# This is a bit of magic. We are going to show 15 on the front page, but we
# want to try and eliminate cross-architecture wasted space. Pull enough
# packages that we can later do some screening and trim out the fat.
@@ -59,7 +74,7 @@ def get_recent_updates(number=15):
fetch = number * 6
for arch in Arch.objects.all():
pkgs += list(Package.objects.normal().filter(
- arch=arch).order_by('-last_update')[:fetch])
+ arch=arch, repo__in=repos).order_by('-last_update')[:fetch])
pkgs.sort(key=attrgetter('last_update'), reverse=True)
same_pkgbase_key = lambda x: (x.repo.name, x.pkgbase)
diff --git a/public/views.py b/public/views.py
index c2c42f5a..0dde88e7 100644
--- a/public/views.py
+++ b/public/views.py
@@ -1,43 +1,53 @@
from datetime import datetime
+import json
from operator import attrgetter
from django.conf import settings
from django.contrib.auth.models import User
from django.db.models import Count, Q
-from django.http import Http404
-from django.views.decorators.cache import cache_control
-from django.views.generic.simple import direct_to_template
+from django.http import Http404, HttpResponse
+from django.shortcuts import render
+from django.views.decorators.cache import cache_control, cache_page
from devel.models import MasterKey, PGPSignature
from main.models import Arch, Repo, Donor
from mirrors.models import MirrorUrl
from news.models import News
+from releng.models import Release
from .utils import get_recent_updates
+
@cache_control(max_age=300)
def index(request):
- pkgs = get_recent_updates()
+ if request.user.is_authenticated():
+ pkgs = get_recent_updates(testing=True, staging=True)
+ else:
+ pkgs = get_recent_updates()
context = {
'news_updates': News.objects.order_by('-postdate', '-id')[:15],
'pkg_updates': pkgs,
}
- return direct_to_template(request, 'public/index.html', context)
+ return render(request, 'public/index.html', context)
USER_LISTS = {
'devs': {
'user_type': 'Developers',
+ 'user_title': 'Developer',
'description': "This is a list of the current "+settings.BRANDING_DISTRONAME+" Developers. They maintain the [core] and [extra] package repositories in addition to doing any other developer duties.",
},
'tus': {
'user_type': 'Trusted Users',
+ 'user_title': 'Trusted User',
'description': "Here are all your friendly "+settings.BRANDING_DISTRONAME+" Trusted Users who are in charge of the [community] repository.",
},
'fellows': {
'user_type': 'Fellows',
+ 'user_title': 'Fellow',
'description': "Below you can find a list of ex-developers (aka project fellows). These folks helped make "+settings.BRANDING_SHORTNAME+" what it is today. Thanks!",
},
}
+
@cache_control(max_age=300)
def userlist(request, user_type='devs'):
users = User.objects.order_by(
@@ -55,64 +65,132 @@ def userlist(request, user_type='devs'):
users = users.distinct()
context = USER_LISTS[user_type].copy()
context['users'] = users
- return direct_to_template(request, 'public/userlist.html', context)
+ return render(request, 'public/userlist.html', context)
+
@cache_control(max_age=300)
def donate(request):
context = {
'donors': Donor.objects.filter(visible=True).order_by('name'),
}
- return direct_to_template(request, 'public/donate.html', context)
+ return render(request, 'public/donate.html', context)
-@cache_control(max_age=300)
-def download(request):
- mirror_urls = MirrorUrl.objects.select_related('mirror').filter(
+
+def _mirror_urls():
+ '''In order to ensure this is lazily evaluated since we can't do
+ sorting at the database level, make it a callable.'''
+ urls = MirrorUrl.objects.select_related('mirror').filter(
protocol__default=True,
mirror__public=True, mirror__active=True, mirror__isos=True)
- sort_by = attrgetter('real_country.name', 'mirror.name')
- mirror_urls = sorted(mirror_urls, key=sort_by)
+ sort_by = attrgetter('country.name', 'mirror.name')
+ return sorted(urls, key=sort_by)
+
+
+@cache_control(max_age=300)
+def download(request):
+ try:
+ release = Release.objects.filter(available=True).latest()
+ except Release.DoesNotExist:
+ release = None
+
context = {
+ 'release': release,
'releng_iso_url': settings.ISO_LIST_URL,
'releng_pxeboot_url': settings.PXEBOOT_URL,
- 'mirror_urls': mirror_urls,
+ 'mirror_urls': _mirror_urls,
}
- return direct_to_template(request, 'public/download.html', context)
+ return render(request, 'public/download.html', context)
+
@cache_control(max_age=300)
def feeds(request):
+ repos = Repo.objects.all()
+ if not request.user.is_authenticated():
+ repos = repos.filter(staging=False)
context = {
'arches': Arch.objects.all(),
- 'repos': Repo.objects.all(),
+ 'repos': repos,
}
- return direct_to_template(request, 'public/feeds.html', context)
+ return render(request, 'public/feeds.html', context)
+
@cache_control(max_age=300)
def keys(request):
+ users = User.objects.filter(is_active=True).select_related(
+ 'userprofile__pgp_key').order_by('first_name', 'last_name')
+ user_key_ids = frozenset(user.userprofile.pgp_key[-16:] for user in users
+ if user.userprofile.pgp_key)
+
not_expired = Q(expires__gt=datetime.utcnow) | Q(expires__isnull=True)
master_keys = MasterKey.objects.select_related('owner', 'revoker',
'owner__userprofile', 'revoker__userprofile').filter(
revoked__isnull=True)
+ master_key_ids = frozenset(key.pgp_key[-16:] for key in master_keys)
- sig_counts = PGPSignature.objects.filter(
- not_expired, valid=True).values_list('signer').annotate(
+ sig_counts = PGPSignature.objects.filter(not_expired, valid=True,
+ signee__in=user_key_ids).order_by().values_list('signer').annotate(
Count('signer'))
- sig_counts = dict((key_id[-16:], ct) for key_id, ct in sig_counts)
+ sig_counts = {key_id[-16:]: ct for key_id, ct in sig_counts}
for key in master_keys:
key.signature_count = sig_counts.get(key.pgp_key[-16:], 0)
- users = User.objects.filter(is_active=True).select_related(
- 'userprofile__pgp_key').order_by('first_name', 'last_name')
-
# frozenset because we are going to do lots of __contains__ lookups
signatures = frozenset(PGPSignature.objects.filter(
not_expired, valid=True).values_list('signer', 'signee'))
+ restrict = Q(signer__in=user_key_ids) & Q(signee__in=user_key_ids)
+ cross_signatures = PGPSignature.objects.filter(restrict,
+ not_expired, valid=True).order_by('created')
+
context = {
'keys': master_keys,
'active_users': users,
'signatures': signatures,
+ 'cross_signatures': cross_signatures,
}
- return direct_to_template(request, 'public/keys.html', context)
+ return render(request, 'public/keys.html', context)
+
+
+@cache_page(1800)
+def keys_json(request):
+ node_list = []
+
+ users = User.objects.filter(is_active=True).select_related('userprofile')
+ node_list.extend({
+ 'name': dev.get_full_name(),
+ 'key': dev.userprofile.pgp_key,
+ 'group': 'dev'
+ } for dev in users.filter(groups__name='Developers'))
+ node_list.extend({
+ 'name': tu.get_full_name(),
+ 'key': tu.userprofile.pgp_key,
+ 'group': 'tu'
+ } for tu in users.filter(groups__name='Trusted Users').exclude(
+ groups__name='Developers'))
+
+ master_keys = MasterKey.objects.select_related('owner').filter(
+ revoked__isnull=True)
+ node_list.extend({
+ 'name': 'Master Key (%s)' % key.owner.get_full_name(),
+ 'key': key.pgp_key,
+ 'group': 'master'
+ } for key in master_keys)
+
+ node_list.append({
+ 'name': 'CA Cert Signing Authority',
+ 'key': 'A31D4F81EF4EBD07B456FA04D2BB0D0165D0FD58',
+ 'group': 'cacert',
+ })
+
+ not_expired = Q(expires__gt=datetime.utcnow) | Q(expires__isnull=True)
+ signatures = PGPSignature.objects.filter(not_expired, valid=True)
+ edge_list = [{ 'signee': sig.signee, 'signer': sig.signer }
+ for sig in signatures]
+
+ data = { 'nodes': node_list, 'edges': edge_list }
+
+ to_json = json.dumps(data, ensure_ascii=False)
+ return HttpResponse(to_json, content_type='application/json')
# vim: set ts=4 sw=4 et: