Răsfoiți Sursa

tenshi project 1

2du 5 ani în urmă
părinte
comite
5bebba0b6c

+ 0 - 1
app.py

@@ -132,7 +132,6 @@ load_conn(conn)
 # DB init
 create_data = {}
 create_data['data'] = ['title', 'data', 'type']
-create_data['cache_data'] = ['title', 'data', 'id']
 create_data['history'] = ['id', 'title', 'data', 'date', 'ip', 'send', 'leng', 'hide', 'type']
 create_data['rc'] = ['id', 'title', 'date', 'type']
 create_data['rd'] = ['title', 'sub', 'code', 'date', 'band', 'stop', 'agree', 'acl']

+ 0 - 0
language/en-US.json → lang/en-US.json


+ 0 - 0
language/help_tool.py → lang/help_tool.py


+ 0 - 0
language/ko-KR.json → lang/ko-KR.json


+ 1 - 1
route/setting.py

@@ -170,7 +170,7 @@ def setting_2(conn, num, db_set):
                         </span>
                         <span>''' + load_lang('wiki_skin') + '''</span>
                         <hr class="main_hr">
-                        <select name="skin">''' + load_skin(d_list[5] if d_list[5] != '' else 'marisa') + '''</select>
+                        <select name="skin">''' + load_skin(d_list[5] if d_list[5] != '' else 'tenshi') + '''</select>
                         <hr class="main_hr">
                         <input type="checkbox" name="reg" ''' + check_box_div[0] + '''> ''' + load_lang('no_register') + '''
                         <hr class="main_hr">

+ 3 - 3
route/tool/func.py

@@ -448,7 +448,7 @@ def load_lang(data, num = 2, safe = 0):
         if rep_data and rep_data[0][0] != '' and rep_data[0][0] != 'default':
             try:
                 if not rep_data[0][0] in global_lang:
-                    lang = json.loads(open(os.path.join('language', rep_data[0][0] + '.json'), encoding='utf8').read())
+                    lang = json.loads(open(os.path.join('lang', rep_data[0][0] + '.json'), encoding='utf8').read())
                     global_lang[rep_data[0][0]] = lang
                 else:
                     lang = global_lang[rep_data[0][0]]
@@ -510,7 +510,7 @@ def ip_warring():
     return text_data
 
 def skin_check(set_n = 0):
-    skin_list = load_skin('marisa', 1)
+    skin_list = load_skin('tenshi', 1)
     skin = skin_list[0]
     check_list = []
     ip = ip_check()
@@ -823,7 +823,7 @@ def load_skin(data = '', set_n = 0, default = 0):
                 if default == 1:
                     data = [['default']]
                 else:
-                    data = [['marisa']]
+                    data = [['tenshi']]
     else:
         data = [[data]]
 

+ 13 - 44
route/view_read.py

@@ -7,6 +7,8 @@ def view_read_2(conn, name):
     div = ''
     ip = ip_check()
     run_redirect = ''
+    name_doc_pass = flask.request.args.get('from', '')
+    uppage = re.sub(r"([^/]+)$", '', name)
 
     num = flask.request.args.get('num', None)
     num = int(number_check(num)) if num else None
@@ -14,14 +16,9 @@ def view_read_2(conn, name):
     curs.execute(db_change("select sub from rd where title = ? and not stop = 'O' order by date desc"), [name])
     topic = 1 if curs.fetchall() else 0
 
-    curs.execute(db_change("select link from back where title = ? and type = 'cat' order by link asc"), [name])
-
-    curs.execute(db_change("select title from data where title like ?"), ['%' + name + '/%'])
+    curs.execute(db_change("select title from data where title like ?"), [name + '/%'])
     down = 1 if curs.fetchall() else 0
-
-    m = re.search(r"^(.*)\/(.*)$", name)
-    uppage = m.group(1) if m else 0
-
+    
     if re.search(r'^category:', name):
         curs.execute(db_change("select link from back where title = ? and type = 'cat' order by link asc"), [name])
         back = curs.fetchall()
@@ -48,8 +45,6 @@ def view_read_2(conn, name):
             if u_div != '':
                 div += '<br><h2 id="cate_under">' + load_lang('under_category') + '</h2><ul class="inside_ul">' + u_div + '</ul>'
 
-
-    cache_data = None
     if num:
         curs.execute(db_change("select title from history where title = ? and id = ? and hide = 'O'"), [name, str(num)])
         if curs.fetchall() and admin_check(6) != 1:
@@ -57,38 +52,13 @@ def view_read_2(conn, name):
 
         curs.execute(db_change("select data from history where title = ? and id = ?"), [name, str(num)])
     else:
-        curs.execute(db_change("select id from history where title = ? order by id + 0 desc limit 1"), [name])
-        last_history_num = curs.fetchall()
-        if last_history_num and not flask.request.args.get('reload', None):
-            curs.execute(db_change("select data from cache_data where title = ? and id = ?"), [name, last_history_num[0][0]])
-            cache_data = curs.fetchall()
-            if not cache_data:
-                curs.execute(db_change("select data from data where title = ?"), [name])
-        else:
-            curs.execute(db_change("select data from data where title = ?"), [name])
-
-    if cache_data and acl_check(name, 'render') != 1:
-        end_data = cache_data[0][0]
-    else:
-        data = curs.fetchall()
-        if data:
-            else_data = data[0][0]
-        else:
-            else_data = None
-
-        if flask.request.args.get('from', None) and else_data:
-            else_data = re.sub(r'^\r\n', '', else_data)
-            else_data = re.sub(r'\r\n$', '', else_data)
-
-        end_data = render_set(
-            doc_name = name,
-            doc_data = else_data
-        )
+        curs.execute(db_change("select data from data where title = ?"), [name])
 
-        if not num and acl_check(name, 'render') != 1:
-            curs.execute(db_change("delete from cache_data where title = ?"), [name])
-            if last_history_num:
-                curs.execute(db_change("insert into cache_data (title, data, id) values (?, ?, ?)"), [name, end_data, last_history_num[0][0]])
+    data = curs.fetchall()
+    end_data = render_set(
+        doc_name = name,
+        doc_data = data[0][0] if data else None
+    )
 
     if end_data == 'HTTP Request 401.3':
         response_data = 401
@@ -149,14 +119,13 @@ def view_read_2(conn, name):
             ['history/' + url_pas(name), load_lang('history')], 
             ['xref/' + url_pas(name), load_lang('backlink')], 
             ['acl/' + url_pas(name), load_lang('acl'), acl],
-            ['w/' + url_pas(name) + '?reload=true', load_lang('reload')]
         ]
 
-        if flask.request.args.get('from', None):
+        if name_doc_pass != '':
             menu += [['w/' + url_pas(name), load_lang('pass')]]
             end_data = '''
                 <div id="redirect">
-                    <a href="/w/''' + url_pas(flask.request.args.get('from', None)) + '?from=' + url_pas(name) + '">' + flask.request.args.get('from', None) + '</a> ⇨ <b>' + name + '''</b>
+                    <a href="/w/''' + url_pas(name_doc_pass) + '?from=' + url_pas(name) + '">' + name_doc_pass + '</a> ⇨ <b>' + name + '''</b>
                 </div>
                 <br>
             ''' + end_data
@@ -175,7 +144,7 @@ def view_read_2(conn, name):
 
     match = re.search(r"^user:([^/]*)", name)
     if match:
-        user_name = match.group(1)
+        user_name = html.escape(match.group(1))
         div = '''
             <div id="get_user_info"></div>
             <script>load_user_info("''' + user_name + '''");</script>

+ 4 - 0
views/main_css/js/render_onmark.js

@@ -1,4 +1,6 @@
 // 인터위키
+// 폴딩
+// 인용문
 // Tool
 function do_url_change(data) {
     return encodeURIComponent(data);
@@ -501,6 +503,7 @@ function do_onmark_middle_render(data, data_js, name_include, data_nowiki, name_
                     data = data.replace(middle_re, '<span id="' + name_include + 'render_contect_' + String(html_n) + '">');
                     middle_stack.push('</span>');
                 } else if(middle_data[1] === '#!folding') {
+                    // 이 부분 완성해야함
                     data = data.replace(middle_re, '<wiki_start style="">');
                     middle_stack.push('<wiki_end>');
                 } else {
@@ -728,6 +731,7 @@ function do_onmark_table_render_sub(data, data_col) {
                 
                 align_auto = 0;
             } else {
+                // 이 부분 다시 해야함
                 var table_option_data = data_option.replace(/"/g, '');
                 if(table_option_data.match(/^[a-zA-Z0-9]{6}|[a-zA-Z0-9]{3}$/)) {
                     data_option_all['td'] += 'background:#' + table_option_data + ';';

+ 0 - 5
views/marisa/info.json

@@ -1,5 +0,0 @@
-{
-    "name" : "Marisa",
-    "skin_ver" : "v1.2.8",
-    "require_ver" : "10"
-}

+ 0 - 0
views/marisa/LICENSE → views/tenshi/LICENSE


+ 0 - 0
views/marisa/README.md → views/tenshi/README.md


+ 0 - 0
views/marisa/css/dark.css → views/tenshi/css/dark.css


+ 138 - 127
views/marisa/css/main.css → views/tenshi/css/main.css

@@ -1,17 +1,15 @@
 body {
     max-width: 100%;
+    
     word-break: break-all;
     word-wrap: break-word;
+    
     margin: 0;
+    
     font-family: 'Apple SD Gothic', '맑은고딕', 'Nanum Gothic', 'Noto Sans KR', sans-serif;
     font-size: 0.85rem;
 }
 
-ul {
-    padding: 0;
-    padding-left: 10px;
-}
-
 select {
     padding: 5px;
 }
@@ -23,8 +21,10 @@ hr {
 
 button {
     padding: 10px;
+    
     border: 1px solid #aaa;
     background: white;
+    
     cursor: pointer;
 }
 
@@ -32,52 +32,45 @@ td {
     border: 1px solid gainsboro;
 }
 
-li {
-    margin-left: 20px;
+html {
+    background: #eeeeee;
 }
 
 #background {
-    background: gainsboro;
-}
-
-#top {
-    width: 100%;
-    background: #4a4a4a;
-    padding: 15px;
-    padding-right: 0;
-    padding-left: 0;
-    position: relative;
-    top: 0;
-    left: 0;
-    height: auto;
+    background: #eeeeee;
 }
 
 #main {
     margin: auto;
     margin-top: -20px;
+    
     padding: 20px;
     padding-bottom: 20px;
-    background: white;
+    
     min-height: 350px;
+    
+    background: white;
+    box-shadow: 0 2px 4px 0 rgba(0,0,0,0.16), 0 2px 10px 0 rgba(0,0,0,0.12);
 }
 
 #bottom {
     width: 100%;
-    background: white;
+    
+    background: #eeeeee;
+    
+    margin-top: 10px;
     padding-bottom: 20px;
 }
 
-#top_main {
-    margin: auto;
-}
-
 #bottom_main {
     margin: auto;
+    
     padding-top: 20px;
 }
 
 #tool {
     float: right;
+    
     border: none;
 }
 
@@ -119,6 +112,7 @@ li {
 @media (max-width: 780px) {
     #main {
         width: 90%;
+        
         border-left: none;
         border-right: none;
     }
@@ -133,105 +127,146 @@ li {
 
     #tool {
         float: none;
+        
         width: 90%;
+        
         margin-top: 0px;
         margin-bottom: 10px;
     }
 }
 
-h1 {
+h1, h2, h3, h4, h5, h6 {
     border-bottom: 1px solid gainsboro;
+    
     padding-bottom: 10px;
 }
 
-h2 {
-    border-bottom: 1px solid gainsboro;
-    padding-bottom: 10px;
+#main_top {
+    width: 100%;
 }
 
-h3 {
-    border-bottom: 1px solid gainsboro;
-    padding-bottom: 10px;
+/* top */
+#top {
+    width: 100%;
+    line-height: 50px;
+    
+    position: relative;
+    top: 0;
+    left: 0;
+
+    background: #2780e3;
+    box-shadow: 0 2px 4px 0 rgba(0,0,0,0.16), 0 2px 10px 0 rgba(0,0,0,0.12);
 }
 
-h4 {
-    border-bottom: 1px solid gainsboro;
-    padding-bottom: 10px;
+#top_main {
+    margin: auto;
 }
 
-h5 {
-    border-bottom: 1px solid gainsboro;
-    padding-bottom: 10px;
+#top_tool {
+    float: right;
+    color: white;
 }
 
-h6 {
-    border-bottom: 1px solid gainsboro;
-    padding-bottom: 10px;
+#top_tool_group {
+    display: inline-block;
+    
+    margin-right: 10px;
+}
+
+#top_tool_cel {
+    display: inline-block;
+    
+    margin-right: -12px;
+}
+
+.top_in_cel {
+    padding-left: 10px;
+    padding-right: 10px;
+    
+    transition: .2s ease-in-out;
+}
+
+.top_in_cel:hover {
+    background: #022988;
+    
+    transition: .2s ease-in-out;
+}
+
+#top_in_user {
+    margin-right: -13px;
 }
 
 #tool_cel {
     display: inline-block;
 }
 
-#main_top {
-    width: 100%;
+#top a {
+    color: white;
+    
+    display: block;
 }
 
 #logo {
     display: inline-block;
 }
 
-#top_tool {
-    float: right;
-    color: white;
-    margin-top: -9px;
+#logo a {
+    padding-left: 20px;
+    padding-right: 20px;
 }
 
 .cel_in_cel {
-    border: 1px solid #aaa;
     padding: 10px;
+    
+    line-height: initial;
+    
     position: absolute;
+    
     background: white;
-    margin-top: 10px;
+    box-shadow: 0 2px 4px 0 rgba(0,0,0,0.16), 0 2px 10px 0 rgba(0,0,0,0.12);
 }
 
-#top_tool_cel {
-    display: inline-block;
+#top .cel_in_cel a {
+    color: black;
+    
+    padding-left: 0;
+    padding-right: 0;
 }
 
+/* search */
 #search {
     display: inline-block;
     width: 300px;
 }
 
-#mobile_search {
-    width: 100%;
-}
-
 #search_input {
     width: 220px;
     height: 35px;
+    
     padding-left: 10px;
-    background-color: gray;
-    border: solid 1px gray;
-    color: #fff;
+    
+    background-color: white;
+    border: solid 2px #2780e3;
+    color: black;
+    
     transition: .2s ease-in-out;
-    outline: none;
 }
+
 #search_input::placeholder {
-    color: #fff;
+    color: black;
 }
+
 #search_input:hover, #search_input:focus {
-    border-color: #ababab;
-    background-color: #eaeaea;
-    color: #000;
+    border: solid 2px #f4aba1;
+    
     transition: .2s ease-in-out;
 }
+
 #search_input:hover::placeholder, #search_input:focus::placeholder {
-    color: #000;
+    color: black;
 }
 
-div#pre_search {
+#pre_search {
     padding: 10px;
     border: 1px solid #4a4a4a;
     width: 200px;
@@ -241,7 +276,7 @@ div#pre_search {
     position: absolute;
 }
 
-div#pre_search a {
+#pre_search a {
     color: dodgerblue;
 }
 
@@ -252,32 +287,15 @@ div#pre_search a {
     color: white;
 }
 
-#mobile_search button {
-    padding: 0;
-    border: none;
-    background: transparent;
-}
-
-#mobile_button_first {
-    margin-top: 10px;
+/* content */
+a {
+    color: dodgerblue;
 }
 
 #toc {
     max-width: 300px;
 }
 
-#top a {
-    color: white;
-}
-
-#top .cel_in_cel a {
-    color: black;
-}
-
-a {
-    color: dodgerblue;
-}
-
 #syntax {
     background: #f0f0f0;
     padding: 5px;
@@ -298,41 +316,56 @@ textarea, input {
     background: transparent;
 }
 
+/* nav_bar */
+#nav_bar {
+    z-index: 100;
+    
+    font-size: 25px;
+    
+    position: fixed;
+    bottom: 0;
+    right: 0;
+    
+    background: #fa635c;
+    box-shadow: -1px -1px 4px 0 rgba(0,0,0,0.16), -1px -1px 10px 0 rgba(0,0,0,0.12);
+    
+    text-align: center;
+}
+
 #go_toc {
     display: inline-block;
-    padding: 10px;
+
+    padding-right: 10px;
+    padding-left: 10px;
+    padding-top: 5px;
+    padding-bottom: 5px;
+    
     width: 25px;
 }
 
 #go_top {
     display: inline-block;
-    padding: 10px;
+    
+    padding-right: 10px;
+    padding-left: 10px;
+    
     width: 25px;
 }
 
 #go_bottom {
     display: inline-block;
-    padding-left: 5px;
-    padding-right: 5px;
-    width: 25px;
-}
 
-#nav_bar {
-    z-index: 100;
-    font-size: 24px;
-    position: fixed;
-    bottom: 0;
-    right: 0;
-    border: 1px solid #4a4a4a;
-    background: #4a4a4a;
-    text-align: center;
-    height: 45px;
+    padding-right: 10px;
+    padding-left: 10px;
+    
+    width: 25px;
 }
 
 #nav_bar a {
     color: white;
 }
 
+/* */
 #out_link::before {
     content: '🅴';
     font-weight: lighter;
@@ -344,7 +377,7 @@ a:hover {
     text-decoration: underline;
 }
 
-#mobile_menu a:hover, #top a:hover {
+#top a:hover {
     text-decoration: none;
 }
 
@@ -356,26 +389,17 @@ div#last_edit {
     margin-bottom: 20px;
 }
 
-#topic_color {
-    color: limegreen;
-}
-
-#top_menu_groups {
-    display: inline-block;
-}
-
 @media (max-width: 600px) {
     #top_tool {
         float: none;
         display: inline;
     }
 
-    #top_menu_groups {
+    #top_tool_group {
         margin-left: 20px;
     }
 
     #search {
-        margin-top: 10px;
         width: 100%;
     }
 
@@ -390,17 +414,4 @@ div#last_edit {
 
 button#save {
     background: #c6ffc6;
-}
-
-div#top_tool_cel a:hover, #logo a:hover, #search button:hover, div#nav_bar a:hover {
-    color: #aaa;
-}
-
-div#main {
-    border-left: 1px solid #aaa;
-    border-right: 1px solid #aaa;
-}
-
-#bottom {   
-    border-top: 1px solid #aaa;   
 }

+ 9 - 9
views/marisa/index.html → views/tenshi/index.html

@@ -8,9 +8,9 @@
             <title>{{imp[0]}} - {{imp[1][0]}}</title>
         {% endif %}
         {{imp[3][3]|safe}}
-        <link rel="stylesheet" href="/views/marisa/css/main.css?ver=17">
-        <script src="/views/marisa/js/skin_set.js?ver=6"></script>
-        <script src="/views/marisa/js/main.js?ver=3"></script>
+        <link rel="stylesheet" href="/views/tenshi/css/main.css?ver=17">
+        <script src="/views/tenshi/js/skin_set.js?ver=6"></script>
+        <script src="/views/tenshi/js/main.js?ver=3"></script>
         <script>main_load(); window.addEventListener('DOMContentLoaded', skin_set);</script>
         <script src="https://code.iconify.design/1/1.0.3/iconify.min.js"></script>
         <link rel="shortcut icon" href="/views/main_css/file/favicon.ico?ver=1">
@@ -30,12 +30,12 @@
             <div id="top">
                 <div id="top_main">
                     <div id="logo">
-                        <a href="/">{{imp[1][4]|safe}}</a>
+                        <a href="/" class="top_in_cel">{{imp[1][4]|safe}}</a>
                     </div>
                     <div id="top_tool">
-                        <div id="top_menu_groups">
+                        <div id="top_tool_group">
                             <div id="top_tool_cel">
-                                <a href="javascript:void(0);" onclick="opening('recent_cel');">
+                                <a href="javascript:opening('recent_cel');" class="top_in_cel">
                                     <span class="iconify" data-icon="ic:baseline-access-time" data-inline="true"></span>
                                     <span class="not_mobile">{{'list'|load_lang}}</span>
                                     <span class="iconify" data-icon="ic:baseline-arrow-drop-down" data-inline="true"></span>
@@ -59,7 +59,7 @@
                             </div>
                             <div id="top_tool_cel">
-                                <a href="javascript:void(0);" onclick="opening('other_cel');">
+                                <a href="javascript:opening('other_cel');" class="top_in_cel">
                                     <span class="iconify" data-icon="ic:baseline-archive" data-inline="true"></span>
                                     <span class="not_mobile">{{'tool'|load_lang}}</span>
                                     <span class="iconify" data-icon="ic:baseline-arrow-drop-down" data-inline="true"></span>
@@ -94,8 +94,8 @@
                                 </div>
                             </div>
-                            <div id="top_tool_cel">
-                                <a href="/user">
+                            <div id="top_tool_cel" id="top_in_user">
+                                <a href="/user" class="top_in_cel">
                                     {% if imp[2][2] == 1 %}
                                         {% if imp[2][8] != '0' %}
                                             <span class="iconify" data-icon="ic:baseline-add-alert" data-inline="true"></span>

+ 5 - 0
views/tenshi/info.json

@@ -0,0 +1,5 @@
+{
+    "name" : "Tenshi",
+    "skin_ver" : "v2.0.0",
+    "require_ver" : "10"
+}

+ 0 - 0
views/marisa/js/main.js → views/tenshi/js/main.js


+ 1 - 1
views/marisa/js/skin_set.js → views/tenshi/js/skin_set.js

@@ -17,7 +17,7 @@ function main_load() {
     ) {
         head_data.innerHTML += '' +
             '<link rel="stylesheet" href="/views/main_css/css/sub/dark.css?ver=2">' +
-            '<link rel="stylesheet" href="/views/marisa/css/dark.css?ver=6">' +
+            '<link rel="stylesheet" href="/views/tenshi/css/dark.css?ver=6">' +
         '';
     }
 }