-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
873 changed files
with
194,617 additions
and
15 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 |
---|---|---|
@@ -1,5 +1 @@ | ||
*.pyc | ||
cache/* | ||
filebase/* | ||
postbase/* | ||
*db.sqlite3 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!.gitignore |
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,10 @@ | ||
{ | ||
"hosts": [ | ||
"zhyack.cn", | ||
"*.zhyack.cn" | ||
], | ||
"index_title": "blogOurBlog", | ||
"secret_key": "tpegey53)+-817alfam_v3gv+^l!%h_w*i#yc1+e3jhbz5ns-&", | ||
"show_debug_info": true, | ||
"owner_id": "creator" | ||
} |
Binary file not shown.
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,2 @@ | ||
* | ||
!.gitignore |
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,2 @@ | ||
* | ||
!.gitignore |
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 @@ | ||
*/migrations/* |
Empty file.
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,140 @@ | ||
""" | ||
Django settings for core project. | ||
Generated by 'django-admin startproject' using Django 2.0.2. | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/2.0/topics/settings/ | ||
For the full list of settings and their values, see | ||
https://docs.djangoproject.com/en/2.0/ref/settings/ | ||
""" | ||
|
||
|
||
|
||
import os | ||
import json | ||
|
||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) | ||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | ||
|
||
myconfig = {'hosts':[], 'index_title':'blogOurBlog', 'secret_key':'tpegey53)+-817alfam_v3gv+^l!%h_w*i#yc1+e3jhbz5ns-&', 'show_debug_info':False, 'owner_id':'creator'} | ||
|
||
CONFIG_PATH = os.path.join(os.path.dirname(BASE_DIR), 'config.json') | ||
if os.path.exists(CONFIG_PATH): | ||
myconfig = json.load(open(CONFIG_PATH, 'r')) | ||
|
||
|
||
# Quick-start development settings - unsuitable for production | ||
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/ | ||
|
||
# SECURITY WARNING: keep the secret key used in production secret! | ||
SECRET_KEY = myconfig['secret_key'] | ||
|
||
# SECURITY WARNING: don't run with debug turned on in production! | ||
DEBUG = myconfig['show_debug_info'] | ||
|
||
ALLOWED_HOSTS = myconfig['hosts']+['localhost', '127.0.0.1', '[::1]'] | ||
|
||
|
||
# Application definition | ||
|
||
INSTALLED_APPS = [ | ||
'django.contrib.admin', | ||
'django.contrib.auth', | ||
'django.contrib.contenttypes', | ||
'django.contrib.sessions', | ||
'django.contrib.messages', | ||
'django.contrib.staticfiles', | ||
'users', | ||
'files', | ||
'posts', | ||
] | ||
|
||
MIDDLEWARE = [ | ||
'django.middleware.security.SecurityMiddleware', | ||
'django.contrib.sessions.middleware.SessionMiddleware', | ||
'django.middleware.common.CommonMiddleware', | ||
'django.middleware.csrf.CsrfViewMiddleware', | ||
'django.contrib.auth.middleware.AuthenticationMiddleware', | ||
'django.contrib.messages.middleware.MessageMiddleware', | ||
'django.middleware.clickjacking.XFrameOptionsMiddleware', | ||
] | ||
|
||
ROOT_URLCONF = 'core.urls' | ||
|
||
TEMPLATES = [ | ||
{ | ||
'BACKEND': 'django.template.backends.django.DjangoTemplates', | ||
'DIRS': [os.path.join(os.path.dirname(BASE_DIR), 'templates')], | ||
'APP_DIRS': True, | ||
'OPTIONS': { | ||
'context_processors': [ | ||
'django.template.context_processors.debug', | ||
'django.template.context_processors.request', | ||
'django.contrib.auth.context_processors.auth', | ||
'django.contrib.messages.context_processors.messages', | ||
], | ||
}, | ||
}, | ||
] | ||
|
||
WSGI_APPLICATION = 'core.wsgi.application' | ||
|
||
|
||
# Database | ||
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases | ||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.sqlite3', | ||
'NAME': os.path.join(os.path.dirname(BASE_DIR), 'db.sqlite3'), | ||
} | ||
} | ||
|
||
|
||
# Password validation | ||
# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators | ||
|
||
AUTH_PASSWORD_VALIDATORS = [ | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', | ||
}, | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', | ||
}, | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', | ||
}, | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', | ||
}, | ||
] | ||
|
||
|
||
# Internationalization | ||
# https://docs.djangoproject.com/en/2.0/topics/i18n/ | ||
|
||
LANGUAGE_CODE = 'zh-hans' | ||
|
||
TIME_ZONE = 'Asia/Shanghai' | ||
|
||
USE_I18N = True | ||
|
||
USE_L10N = True | ||
|
||
USE_TZ = True | ||
|
||
|
||
# Static files (CSS, JavaScript, Images) | ||
# https://docs.djangoproject.com/en/2.0/howto/static-files/ | ||
|
||
STATIC_URL = '/static/' | ||
|
||
STATICFILES_DIRS = [ | ||
os.path.join(os.path.dirname(BASE_DIR), "static/"), | ||
] | ||
|
||
AUTH_USER_MODEL = 'users.User' | ||
LOGOUT_REDIRECT_URL = '/' | ||
LOGIN_REDIRECT_URL = '/' |
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,47 @@ | ||
"""core URL Configuration | ||
The `urlpatterns` list routes URLs to views. For more information please see: | ||
https://docs.djangoproject.com/en/2.0/topics/http/urls/ | ||
Examples: | ||
Function views | ||
1. Add an import: from my_app import views | ||
2. Add a URL to urlpatterns: path('', views.home, name='home') | ||
Class-based views | ||
1. Add an import: from other_app.views import Home | ||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') | ||
Including another URLconf | ||
1. Import the include() function: from django.urls import include, path | ||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) | ||
""" | ||
from django.contrib import admin | ||
from django.urls import path, include | ||
from main import views as mviews | ||
from editor import views as eviews | ||
from files import views as fviews | ||
from posts import views as pviews | ||
|
||
urlpatterns = [ | ||
path('admin/', admin.site.urls), | ||
path('users/', include('users.urls')), | ||
path('users/', include('django.contrib.auth.urls')), | ||
path('', mviews.index, name='index'), | ||
path('home/', mviews.home, name='home'), | ||
path('upnav/', mviews.refreshNav, name='nav'), | ||
path('uptagednav/', mviews.refreshtagedNav, name='tagednav'), | ||
path('upsearchnav/<path:cont>', mviews.refreshsearchNav, name='searcgnav'), | ||
path('upfile/', fviews.uploadPage, name='uploadpage'), | ||
path('download/<path:fp>', fviews.downFiles, name='download'), | ||
path('upload/', fviews.upload, name='upload'), | ||
path('files/<path:fp>/', fviews.viewFiles, name='viewfiles'), | ||
path('removefile/<path:fp>/', fviews.removeFile, name='removefile'), | ||
path('updatefile/<path:fp>/', fviews.updateFile, name='updatefile'), | ||
path('setpost/', pviews.setPost, name='setpost'), | ||
path('updatepost/<path:fp>/', pviews.updatePost, name='updatepost'), | ||
path('removepost/<path:fp>/', pviews.removePost, name='removepost'), | ||
path('validpost/', pviews.validPost, name='validpost'), | ||
path('savecache/', pviews.saveCache, name='savecache'), | ||
path('posts/', include('posts.urls')), | ||
path('preview/<path:route>', mviews.preview, name='preview'), | ||
path('preview_table/<path:route>', mviews.preview_table, name='preview_table'), | ||
path('edit/', include('editor.urls')), | ||
] |
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,16 @@ | ||
""" | ||
WSGI config for core project. | ||
It exposes the WSGI callable as a module-level variable named ``application``. | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/ | ||
""" | ||
|
||
import os | ||
|
||
from django.core.wsgi import get_wsgi_application | ||
|
||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "core.settings") | ||
|
||
application = get_wsgi_application() |
Empty file.
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,3 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. |
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,5 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class EditorConfig(AppConfig): | ||
name = 'editor' |
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,3 @@ | ||
from django.db import models | ||
|
||
# Create your models here. |
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,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
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,7 @@ | ||
from django.urls import path | ||
from . import views | ||
|
||
app_name = 'editor' | ||
urlpatterns = [ | ||
path('<path:fp>/', views.mainpage, name='editor'), | ||
] |
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,16 @@ | ||
from django.shortcuts import render | ||
from posts.views import getPosts, getCachedPosts | ||
from django.http import JsonResponse, HttpResponseNotFound, HttpResponseForbidden, HttpResponse | ||
# Create your views here. | ||
|
||
def mainpage(request, fp): | ||
# judge whether the user and file are right. | ||
answer = getPosts(request, fp) | ||
pcache = getCachedPosts(request, fp) | ||
answer['post_cache']=pcache | ||
if answer['success'] == 0: | ||
return HttpResponseForbidden() | ||
elif answer['success'] == 1: | ||
return HttpResponseNotFound() | ||
else: | ||
return render(request, 'editor/editor.html', context=answer) |
Empty file.
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,5 @@ | ||
from django.contrib import admin | ||
from .models import myFile | ||
# Register your models here. | ||
|
||
admin.site.register(myFile) |
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,5 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class FilesConfig(AppConfig): | ||
name = 'files' |
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,12 @@ | ||
from django import forms | ||
|
||
class UploadForm(forms.Form): | ||
fviewers = forms.CharField(max_length=200) | ||
ufile = forms.FileField(required=False, widget=forms.ClearableFileInput(attrs={'multiple': True})) | ||
fname = forms.CharField(max_length=200, required=False) | ||
ftags = forms.CharField(max_length=200) | ||
ffeature = forms.CharField(max_length=20) | ||
foverlap = forms.BooleanField(required=False) | ||
fpass = forms.CharField(max_length=100, required=False) | ||
frank = forms.IntegerField() | ||
ftrace = forms.IntegerField() |
Oops, something went wrong.