Surplus_Up (2DU) пре 7 година
родитељ
комит
842553d7b1
5 измењених фајлова са 7 додато и 136 уклоњено
  1. 4 25
      app.py
  2. 0 71
      set_mark/html_only.py
  3. 0 5
      set_mark/markdown.py
  4. 1 34
      set_mark/tool.py
  5. 2 1
      views/main_css/main.css

+ 4 - 25
app.py

@@ -252,7 +252,7 @@ else:
     
     print('language : ' + str(rep_language))
 
-support_mark = ['namumark', 'html']
+support_mark = ['namumark']
 	
 curs.execute('select data from other where name = "markup"')
 rep_data = curs.fetchall()
@@ -335,7 +335,7 @@ def alarm():
         menu = [['user', load_lang('user')]]
     ))
 
-@app.route('/<regex("inter_wiki|(?:html|edit|email)_filter"):tools>')
+@app.route('/<regex("inter_wiki|(?:edit|email)_filter"):tools>')
 def inter_wiki(tools = None):
     div = ''
     admin = admin_check(None, None)
@@ -347,19 +347,6 @@ def inter_wiki(tools = None):
         div = ''
 
         curs.execute('select title, link from inter')
-    elif tools == 'html_filter':
-        del_link = 'del_html_filter'
-        plus_link = 'plus_html_filter'
-        title = 'html' + load_lang('filter') + ' ' + load_lang('list')
-        div =   '''
-                <ul>
-                    <li>span</li>
-                    <li>div</li>
-                    <li>iframe</li>
-                </ul>
-                '''
-
-        curs.execute('select html from html_filter where kind = ""')
     elif tools == 'email_filter':
         del_link = 'del_email_filter'
         plus_link = 'plus_email_filter'
@@ -413,13 +400,11 @@ def inter_wiki(tools = None):
         menu = [['other', load_lang('other')]]
     ))
 
-@app.route('/<regex("del_(?:inter_wiki|(?:html|edit|email)_filter)"):tools>/<name>')
+@app.route('/<regex("del_(?:inter_wiki|(?:edit|email)_filter)"):tools>/<name>')
 def del_inter(tools = None, name = None):
     if admin_check(None, tools) == 1:
         if tools == 'del_inter_wiki':
             curs.execute("delete from inter where title = ?", [name])
-        elif tools == 'del_html_filter':
-            curs.execute("delete from html_filter where html = ? and kind = ''", [name])
         elif tools == 'del_edit_filter':
             curs.execute("delete from filter where name = ?", [name])
         else:
@@ -431,16 +416,13 @@ def del_inter(tools = None, name = None):
     else:
         return re_error('/error/3')
 
-@app.route('/<regex("plus_(?:inter_wiki|(?:html|edit|email)_filter)"):tools>', methods=['POST', 'GET'])
+@app.route('/<regex("plus_(?:inter_wiki|(?:edit|email)_filter)"):tools>', methods=['POST', 'GET'])
 @app.route('/<regex("plus_edit_filter"):tools>/<name>', methods=['POST', 'GET'])
 def plus_inter(tools = None, name = None):
     if flask.request.method == 'POST':
         if tools == 'plus_inter_wiki':
             curs.execute('insert into inter (title, link) values (?, ?)', [flask.request.form.get('title', None), flask.request.form.get('link', None)])
             admin_check(None, 'inter_wiki_plus')
-        elif tools == 'plus_html_filter':
-            curs.execute('insert into html_filter (html, kind) values (?, "")', [flask.request.form.get('title', None)])
-            admin_check(None, 'html_filter edit')
         elif tools == 'plus_edit_filter':
             if admin_check(1, 'edit_filter edit') != 1:
                 return re_error('/error/3')
@@ -496,9 +478,6 @@ def plus_inter(tools = None, name = None):
                         <hr>
                         <input ''' + stat + ''' placeholder="''' + load_lang('regex') + '''" name="content" value="''' + html.escape(textarea) + '''" type="text">
                         '''
-        elif tools == 'plus_html_filter':
-            title = 'html ' + load_lang('filter') + ' ' + load_lang('plus')
-            form_data = '<input placeholder="html" type="text" name="title">'
         else:
             title = 'email ' + load_lang('filter') + ' ' + load_lang('plus')
             form_data = '<input placeholder="email" type="text" name="title">'

+ 0 - 71
set_mark/html_only.py

@@ -1,71 +0,0 @@
-from . import tool
-
-import datetime
-import html
-import re
-
-def html_only(conn, data, title, main_num):
-	curs = conn.cursor()
-	
-	backlink = []
-	plus_data = ''
-
-	while 1:
-		in_data = re.search('<a(?: href="/w/((?:(?!\").)+)")?>((?:(?!<\/a>).)+)<\/a>', data)
-		if in_data:
-			in_data = in_data.groups()
-
-			if in_data[0]:
-				main_link = in_data[0]
-				sub_link = in_data[1]
-			else:
-				main_link = in_data[1]
-				sub_link = in_data[1]
-
-			curs.execute("select title from data where title = ?", [main_link])
-			if not curs.fetchall():
-				link_id = 'id="not_thing"'
-			
-				backlink += [[title, main_link, 'no']]
-			else:
-				link_id = 'id=""'
-
-			backlink += [[title, main_link, '']]
-
-			data = re.sub('<a(?: href="/((?:(?!\").)+)")?>((?:(?!<\/a>).)+)<\/a>', '<a ' + link_id + ' href="/w/' + main_link + '">' + sub_link + '</a>', data, 1)
-		else:
-			break
-
-	data = re.sub('<test_a', '', data)
-
-	while 1:
-		in_data = re.search('<a((?:(?!>).)+)>((?:(?!<\/a>).)+)<\/a>', data)
-		if in_data:
-			in_data = in_data.groups()
-
-			a_data = re.sub('href="((?:(?!").)+)"', '', in_data[0])
-			a_data = re.sub('id="((?:(?!").)+)"', '', a_data)
-
-			if re.search('=', a_data):
-				data = re.sub('<a((?:(?!>).)+)>((?:(?!<\/a>).)+)<\/a>', '', data, 1)
-			else:
-				data = re.sub('<a((?:(?!>).)+)>((?:(?!<\/a>).)+)<\/a>', '<test_a ' + in_data[0] + '>' + in_data[1] + '</a>', data, 1)
-		else:
-			break
-
-	data = re.sub('<test_a', '<a', data)
-
-	ok_list = [
-		'h1',
-		'h2',
-		'h3',
-		'h4',
-		'h5',
-		'h6',
-		'li',
-		'a'
-	]
-
-	data = tool.xss_protect(curs, data, ok_list)
-	
-	return [data, plus_data, backlink]

+ 0 - 5
set_mark/markdown.py

@@ -1,5 +0,0 @@
-from . import tool
-
-import datetime
-import html
-import re

+ 1 - 34
set_mark/tool.py

@@ -41,37 +41,4 @@ def sha224(data):
     return hashlib.sha224(bytes(data, 'utf-8')).hexdigest()
 
 def md5_replace(data):
-    return hashlib.md5(data.encode()).hexdigest()
-
-def xss_protect(curs, data, ok_list = []):
-    curs.execute('select html from html_filter where kind = ""')
-    html_db = curs.fetchall()
-
-    src_list = ["www.youtube.com", "serviceapi.nmv.naver.com", "tv.kakao.com", "www.google.com", "serviceapi.rmcnmv.naver.com"]
-    html_list = ['div', 'span', 'embed', 'iframe', 'ruby', 'rp', 'rt'] + ok_list
-    
-    html_data = re.findall('&lt;(\/)?((?:(?!&gt;| ).)+)( (?:(?:(?!&gt;).)+)?)?&gt;', data)
-    for in_data in html_data:
-        if in_data[0] == '':
-            if in_data[1] in html_list or (html_db and in_data[1] in html_db[0]):
-                if re.search('&lt;\/' + in_data[1] + '&gt;', data):
-                    src = re.search('src=([^ ]*)', in_data[2])
-                    if src:
-                        v_src = re.search('http(?:s)?:\/\/([^/\'" ]*)', src.groups()[0])
-                        if v_src:
-                            if not v_src.groups()[0] in src_list:
-                                and_data = re.sub('&#x27;', '\'', re.sub('&quot;', '"', re.sub('src=([^ ]*)', '', in_data[2])))
-                            else:
-                                and_data = re.sub('&#x27;', '\'', re.sub('&quot;', '"', in_data[2]))
-                        else:
-                            and_data = re.sub('&#x27;', '\'', re.sub('&quot;', '"', re.sub('src=([^ ]*)', '', in_data[2])))
-                    else:
-                        and_data = re.sub('&#x27;', '\'', re.sub('&quot;', '"', in_data[2]))
-                        
-                    data = data.replace('&lt;' + in_data[1] + in_data[2] + '&gt;', '<' + in_data[1] + and_data + '>', 1)
-                    data = re.sub('&lt;\/' + in_data[1] + '&gt;', '</' + in_data[1] + '>', data, 1)
-
-    position = re.compile('position', re.I)
-    data = position.sub('', data)
-
-    return data
+    return hashlib.md5(data.encode()).hexdigest()

+ 2 - 1
views/main_css/main.css

@@ -30,4 +30,5 @@ s:hover, strike:hover, del:hover { color: gray; background-color: gainsboro; tex
 #main_table_width { width: 33.3%; }
 #main_table_width_half { width: 50%; }
 #main_table_width_quarter { width: 25%; }
-#redirect { border: 1px solid; padding: 10px; }
+#redirect { border: 1px solid; padding: 10px; }
+body { word-break: break-all; }