From 7f25dcf95c3f09669dc9ddc0fbe418da454960ce Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Fri, 4 Nov 2016 08:45:06 -0400 Subject: [PATCH] broken --- .../nntpchan/nntpchan/frontend/__init__.py | 0 .../nntpchan/nntpchan/frontend/admin.py | 3 ++ .../django/nntpchan/nntpchan/frontend/apps.py | 5 +++ .../nntpchan/frontend/migrations/__init__.py | 0 .../nntpchan/nntpchan/frontend/models.py | 10 ++++++ .../nntpchan/nntpchan/frontend/tests.py | 3 ++ .../django/nntpchan/nntpchan/frontend/urls.py | 14 ++++++++ .../nntpchan/nntpchan/frontend/views.py | 34 +++++++++++++++++++ .../django/nntpchan/nntpchan/settings.py | 1 + .../django/nntpchan/nntpchan/urls.py | 5 ++- .../django/nntpchan/nntpchan/views.py | 4 +++ contrib/frontends/py/frontend.py | 4 +++ contrib/frontends/py/nntpchan/__init__.py | 5 +++ contrib/js/nntpchan/captcha-reload.js | 2 +- 14 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 contrib/frontends/django/nntpchan/nntpchan/frontend/__init__.py create mode 100644 contrib/frontends/django/nntpchan/nntpchan/frontend/admin.py create mode 100644 contrib/frontends/django/nntpchan/nntpchan/frontend/apps.py create mode 100644 contrib/frontends/django/nntpchan/nntpchan/frontend/migrations/__init__.py create mode 100644 contrib/frontends/django/nntpchan/nntpchan/frontend/models.py create mode 100644 contrib/frontends/django/nntpchan/nntpchan/frontend/tests.py create mode 100644 contrib/frontends/django/nntpchan/nntpchan/frontend/urls.py create mode 100644 contrib/frontends/django/nntpchan/nntpchan/frontend/views.py create mode 100644 contrib/frontends/django/nntpchan/nntpchan/views.py diff --git a/contrib/frontends/django/nntpchan/nntpchan/frontend/__init__.py b/contrib/frontends/django/nntpchan/nntpchan/frontend/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/contrib/frontends/django/nntpchan/nntpchan/frontend/admin.py b/contrib/frontends/django/nntpchan/nntpchan/frontend/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/contrib/frontends/django/nntpchan/nntpchan/frontend/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/contrib/frontends/django/nntpchan/nntpchan/frontend/apps.py b/contrib/frontends/django/nntpchan/nntpchan/frontend/apps.py new file mode 100644 index 0000000..33ae5ca --- /dev/null +++ b/contrib/frontends/django/nntpchan/nntpchan/frontend/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class FrontendConfig(AppConfig): + name = 'frontend' diff --git a/contrib/frontends/django/nntpchan/nntpchan/frontend/migrations/__init__.py b/contrib/frontends/django/nntpchan/nntpchan/frontend/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/contrib/frontends/django/nntpchan/nntpchan/frontend/models.py b/contrib/frontends/django/nntpchan/nntpchan/frontend/models.py new file mode 100644 index 0000000..6d830c2 --- /dev/null +++ b/contrib/frontends/django/nntpchan/nntpchan/frontend/models.py @@ -0,0 +1,10 @@ +from django.db import models + +class Attachment(models.Model): + pass + +class Post(models.Model): + pass + +class Board(models.Model): + pass diff --git a/contrib/frontends/django/nntpchan/nntpchan/frontend/tests.py b/contrib/frontends/django/nntpchan/nntpchan/frontend/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/contrib/frontends/django/nntpchan/nntpchan/frontend/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/contrib/frontends/django/nntpchan/nntpchan/frontend/urls.py b/contrib/frontends/django/nntpchan/nntpchan/frontend/urls.py new file mode 100644 index 0000000..8b53534 --- /dev/null +++ b/contrib/frontends/django/nntpchan/nntpchan/frontend/urls.py @@ -0,0 +1,14 @@ +from django.conf.urls import url + +from . import views + +urlpatterns = [ + url(r'^ctl-(?P[0-9])\.html$', views.modlog, name='old-modlog'), + url(r'^ctl/((?P[0-9])/)?$', views.modlog, name='modlog'), + url(r'^overchan\.(?P[a-zA-z0-9\.]+)-(?P[0-9])\.html$', views.boardpage, name='old-board'), + url(r'^(?P[a-zA-z0-9\.]+)/((?P[0-9])/)?$', views.boardpage, name='board'), + url(r'^thread-(?P[a-fA-F0-9\.]{40})\.html$', views.threadpage, name='old-thread'), + url(r'^t/(?P[a-fA-F0-9\.]{40})\.html$', views.redirect_thread, name='redirect-thread'), + url(r'^t/(?P[a-fA-F0-9\.]{40})/$', views.threadpage, name='thread'), + url(r'^$', views.frontpage, name='index'), +] diff --git a/contrib/frontends/django/nntpchan/nntpchan/frontend/views.py b/contrib/frontends/django/nntpchan/nntpchan/frontend/views.py new file mode 100644 index 0000000..cd3a277 --- /dev/null +++ b/contrib/frontends/django/nntpchan/nntpchan/frontend/views.py @@ -0,0 +1,34 @@ +from django.http import HttpResponse +from django.shortcuts import render +from django.views import generic + +from .models import Post, Board + +class IndexView(generic.DetailView): + template_name = 'frontend/index.html' + +class BoardView(generic.ListView): + template_name = 'frontend/board.html' + +class ThreadView(generic.ListView): + template_name = 'frontend/thread.html' + +def frontpage(request): + return HttpResponse('ayyyy') + +def boardpage(request, name, page): + if page is None: + page = 0 + name = 'overchan.{}'.format(name) + return HttpResponse('{} page {}'.format(name, page)) + +def threadpage(request, op): + return HttpResponse('thread {}'.format(op)) + +def redirect_thread(request, op): + pass + +def modlog(request, page): + if page is None: + page = 0 + return HttpResponse('mod log page {}'.format(page)) diff --git a/contrib/frontends/django/nntpchan/nntpchan/settings.py b/contrib/frontends/django/nntpchan/nntpchan/settings.py index 594eb5d..b48b1a6 100644 --- a/contrib/frontends/django/nntpchan/nntpchan/settings.py +++ b/contrib/frontends/django/nntpchan/nntpchan/settings.py @@ -31,6 +31,7 @@ ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ + 'nntpchan.frontend.apps.FrontendConfig', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', diff --git a/contrib/frontends/django/nntpchan/nntpchan/urls.py b/contrib/frontends/django/nntpchan/nntpchan/urls.py index 13bab34..b0942ed 100644 --- a/contrib/frontends/django/nntpchan/nntpchan/urls.py +++ b/contrib/frontends/django/nntpchan/nntpchan/urls.py @@ -13,9 +13,8 @@ Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ -from django.conf.urls import url -from django.contrib import admin +from django.conf.urls import url, include urlpatterns = [ - url(r'^admin/', admin.site.urls), + url(r'^nntpchan/', include('nntpchan.frontend.urls')) ] diff --git a/contrib/frontends/django/nntpchan/nntpchan/views.py b/contrib/frontends/django/nntpchan/nntpchan/views.py new file mode 100644 index 0000000..2eef837 --- /dev/null +++ b/contrib/frontends/django/nntpchan/nntpchan/views.py @@ -0,0 +1,4 @@ +from django.http import HttpResponse + +def index(request): + return HttpResponse('ayyyyy') diff --git a/contrib/frontends/py/frontend.py b/contrib/frontends/py/frontend.py index d4c583e..6591b20 100755 --- a/contrib/frontends/py/frontend.py +++ b/contrib/frontends/py/frontend.py @@ -1,4 +1,8 @@ #!/usr/bin/env python3 +# +# entry point for c++ frontend +# + from nntpchan import message from nntpchan import db import logging diff --git a/contrib/frontends/py/nntpchan/__init__.py b/contrib/frontends/py/nntpchan/__init__.py index 8b13789..7621893 100644 --- a/contrib/frontends/py/nntpchan/__init__.py +++ b/contrib/frontends/py/nntpchan/__init__.py @@ -1 +1,6 @@ +# +# entry for gunicorn +# +from nntpchan.app import app +from nntpchan import viewsp diff --git a/contrib/js/nntpchan/captcha-reload.js b/contrib/js/nntpchan/captcha-reload.js index da4141b..79ca583 100644 --- a/contrib/js/nntpchan/captcha-reload.js +++ b/contrib/js/nntpchan/captcha-reload.js @@ -17,7 +17,7 @@ onready(function(){ var e = document.getElementById("captcha_img"); if (e) { e.onclick = function() { - reload(document.getElementById("captcha_img")); + reload(e); }; } });