This repository has been archived by the owner on Aug 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
1152 lines (941 loc) · 32.8 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Init
import os
import re
for i_data in os.listdir("route"):
f_src = re.search(r"(.+)\.py$", i_data)
if f_src:
exec("from route." + f_src.group(1) + " import *")
# Init-Version
version_list = json.loads(open('version.json', encoding = 'utf8').read())
# Init-DB
if os.path.exists(os.path.join('data', 'set.json')):
db_set_list = ['db', 'db_type']
set_data = json.loads(open(
os.path.join('data', 'set.json'),
encoding = 'utf8'
).read())
for i in db_set_list:
if not i in set_data:
print('Please delete set.json')
print('----')
raise
print('DB name : ' + set_data['db'])
print('DB type : ' + set_data['db_type'])
elif os.getenv('NAMU_DB') or os.getenv('NAMU_DB_TYPE'):
set_data = {}
if os.getenv('NAMU_DB'):
set_data['db'] = os.getenv('NAMU_DB')
else:
set_data['db'] = 'data'
if os.getenv('NAMU_DB_TYPE'):
set_data['db'] = os.getenv('NAMU_DB_TYPE')
else:
set_data['db'] = 'sqlite'
print('DB name : ' + set_data['db'])
print('DB type : ' + set_data['db_type'])
else:
set_data = {}
normal_db_type = ['sqlite', 'mysql']
print('DB type (' + normal_db_type[0] + ') [' + ', '.join(normal_db_type) + '] : ', end = '')
data_get = str(input())
if data_get == '' or not data_get in normal_db_type:
set_data['db_type'] = 'sqlite'
else:
set_data['db_type'] = data_get
all_src = []
if set_data['db_type'] == 'sqlite':
for i_data in os.listdir("."):
f_src = re.search(r"(.+)\.db$", i_data)
if f_src:
all_src += [f_src.group(1)]
print('DB name (data) [' + ', '.join(all_src) + '] : ', end = '')
data_get = str(input())
if data_get == '':
set_data['db'] = 'data'
else:
set_data['db'] = data_get
with open(os.path.join('data', 'set.json'), 'w', encoding = 'utf8') as f:
f.write(json.dumps(set_data))
data_db_set = {}
data_db_set['name'] = set_data['db']
data_db_set['type'] = set_data['db_type']
if data_db_set['type'] == 'mysql':
if os.path.exists(os.path.join('data', 'mysql.json')):
db_set_list = ['user', 'password', 'host', 'port']
set_data = json.loads(
open(
os.path.join('data', 'mysql.json'),
encoding = 'utf8'
).read()
)
for i in db_set_list:
if not i in set_data:
os.remove(os.path.join('data', 'mysql.json'))
break
set_data_mysql = set_data
if not os.path.exists(os.path.join('data', 'mysql.json')):
set_data_mysql = {}
print('DB user ID : ', end = '')
set_data_mysql['user'] = str(input())
print('DB password : ', end = '')
set_data_mysql['password'] = str(input())
print('DB host (localhost) : ', end = '')
set_data_mysql['host'] = str(input())
if set_data_mysql['host'] == '':
set_data_mysql['host'] = 'localhost'
print('DB port (3306) : ', end = '')
set_data_mysql['port'] = str(input())
if set_data_mysql['port'] == '':
set_data_mysql['port'] = '3306'
with open(
os.path.join('data', 'mysql.json'),
'w',
encoding = 'utf8'
) as f:
f.write(json.dumps(set_data_mysql))
data_db_set['mysql_user'] = set_data_mysql['user']
data_db_set['mysql_pw'] = set_data_mysql['password']
if 'host' in set_data_mysql:
data_db_set['mysql_host'] = set_data_mysql['host']
else:
data_db_set['mysql_host'] = 'localhost'
if 'port' in set_data_mysql:
data_db_set['mysql_port'] = set_data_mysql['port']
else:
data_db_set['mysql_port'] = '3306'
db_data_get(data_db_set['type'])
load_db = get_db_connect(data_db_set)
conn = load_db.db_load()
curs = conn.cursor()
setup_tool = ''
try:
curs.execute(db_change('select data from other where name = "ver"'))
except:
setup_tool = 'init'
if setup_tool != 'init':
ver_set_data = curs.fetchall()
if ver_set_data:
if int(version_list['beta']['c_ver']) > int(ver_set_data[0][0]):
setup_tool = 'update'
else:
setup_tool = 'normal'
else:
setup_tool = 'init'
if setup_tool != 'normal':
# Init-Create_DB
create_data = {}
# 폐지 예정 (data_set으로 통합)
create_data['data'] = ['title', 'data', 'type']
create_data['history'] = ['id', 'title', 'data', 'date', 'ip', 'send', 'leng', 'hide', 'type']
create_data['rc'] = ['id', 'title', 'date', 'type']
create_data['acl'] = ['title', 'data', 'type']
# 개편 예정 (data_link로 변경)
create_data['back'] = ['title', 'link', 'type']
# 폐지 예정 (topic_set으로 통합) [가장 시급]
create_data['rd'] = ['title', 'sub', 'code', 'date', 'band', 'stop', 'agree', 'acl']
create_data['topic'] = ['id', 'data', 'date', 'ip', 'block', 'top', 'code']
# 폐지 예정 (user_set으로 통합)
create_data['rb'] = ['block', 'end', 'today', 'blocker', 'why', 'band', 'login', 'ongoing']
create_data['scan'] = ['user', 'title', 'type']
# 개편 예정 (wiki_set과 wiki_filter과 wiki_vote으로 변경)
create_data['other'] = ['name', 'data', 'coverage']
create_data['html_filter'] = ['html', 'kind', 'plus', 'plus_t']
create_data['vote'] = ['name', 'id', 'subject', 'data', 'user', 'type', 'acl']
# 개편 예정 (auth_list와 auth_log로 변경)
create_data['alist'] = ['name', 'acl']
create_data['re_admin'] = ['who', 'what', 'time']
# 개편 예정 (user_notice와 user_agent로 변경)
create_data['alarm'] = ['name', 'data', 'date']
create_data['ua_d'] = ['name', 'ip', 'ua', 'today', 'sub']
create_data['user_set'] = ['name', 'id', 'data']
for create_table in create_data:
for create in ['test'] + create_data[create_table]:
try:
curs.execute(db_change('select ' + create + ' from ' + create_table + ' limit 1'))
except:
try:
curs.execute(db_change('create table ' + create_table + '(test longtext default "")'))
except:
curs.execute(db_change("alter table " + create_table + " add column " + create + " longtext default ''"))
if setup_tool == 'update':
update(int(ver_set_data[0][0]), set_data)
else:
set_init()
set_init_always(version_list['beta']['c_ver'])
# Init-Route
class EverythingConverter(werkzeug.routing.PathConverter):
regex = '.*?'
class RegexConverter(werkzeug.routing.BaseConverter):
def __init__(self, url_map, *items):
super(RegexConverter, self).__init__(url_map)
self.regex = items[0]
app = flask.Flask(
__name__,
template_folder = './'
)
app.config['JSON_AS_ASCII'] = False
app.config['JSONIFY_PRETTYPRINT_REGULAR'] = True
log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR)
app.jinja_env.filters['md5_replace'] = md5_replace
app.jinja_env.filters['load_lang'] = load_lang
app.jinja_env.filters['cut_100'] = cut_100
app.url_map.converters['everything'] = EverythingConverter
app.url_map.converters['regex'] = RegexConverter
curs.execute(db_change('select data from other where name = "key"'))
sql_data = curs.fetchall()
app.secret_key = sql_data[0][0]
print('----')
# Init-DB_Data
server_set = {}
server_set_var = {
'host' : {
'display' : 'Host',
'require' : 'conv',
'default' : '0.0.0.0'
}, 'port' : {
'display' : 'Port',
'require' : 'conv',
'default' : '3000'
}, 'language' : {
'display' : 'Language',
'require' : 'select',
'default' : 'ko-KR',
'list' : ['ko-KR', 'en-US']
}, 'markup' : {
'display' : 'Markup',
'require' : 'select',
'default' : 'namumark',
'list' : ['namumark', 'custom', 'raw']
}, 'encode' : {
'display' : 'Encryption method',
'require' : 'select',
'default' : 'sha3',
'list' : ['sha3', 'sha256']
}
}
server_set_env = {
'host' : os.getenv('NAMU_HOST'),
'port' : os.getenv('NAMU_PORT'),
'language' : os.getenv('NAMU_LANG'),
'markup' : os.getenv('NAMU_MARKUP'),
'encode' : os.getenv('NAMU_ENCRYPT')
}
for i in server_set_var:
curs.execute(db_change('select data from other where name = ?'), [i])
server_set_val = curs.fetchall()
if server_set_val:
server_set_val = server_set_val[0][0]
elif server_set_env[i] != None:
server_set_val = server_set_env[i]
else:
if 'list' in server_set_var[i]:
print(server_set_var[i]['display'] + ' (' + server_set_var[i]['default'] + ') [' + ', '.join(server_set_var[i]['list']) + ']' + ' : ', end = '')
else:
print(server_set_var[i]['display'] + ' (' + server_set_var[i]['default'] + ') : ', end = '')
server_set_val = input()
if server_set_val == '':
server_set_val = server_set_var[i]['default']
elif server_set_var[i]['require'] == 'select':
if not server_set_val in server_set_var[i]['list']:
server_set_val = server_set_var[i]['default']
curs.execute(db_change('insert into other (name, data) values (?, ?)'), [i, server_set_val])
print(server_set_var[i]['display'] + ' : ' + server_set_val)
server_set[i] = server_set_val
print('----')
# Init-DB_care
if data_db_set['type'] == 'sqlite':
def back_up(back_time, back_up_where):
print('----')
try:
shutil.copyfile(
data_db_set['name'] + '.db',
back_up_where
)
print('Back up : OK')
except:
print('Back up : Error')
threading.Timer(
60 * 60 * back_time,
back_up,
[back_time, back_up_where]
).start()
curs.execute(db_change('select data from other where name = "back_up"'))
back_time = curs.fetchall()
back_time = int(number_check(back_time[0][0])) if back_time else 0
if back_time != 0:
curs.execute(db_change('select data from other where name = "backup_where"'))
back_up_where = curs.fetchall()
if back_up_where and back_up_where[0][0] != '':
back_up_where = back_up_where[0][0]
else:
back_up_where = 'back_' + data_db_set['name'] + '.db'
print('Back up state : ' + str(back_time) + ' hours')
back_up(back_time, back_up_where)
else:
print('Back up state : Turn off')
print('Now running... http://localhost:' + server_set['port'])
conn.commit()
# Init-custom
if os.path.exists('custom.py'):
from custom import custom_run
custom_run(load_db.db_get(), app)
# Func
# Func-inter_wiki
app.add_url_rule(
rule = '/inter_wiki',
defaults = {
'conn' : load_db.db_get(),
'tool' : 'inter_wiki'
},
view_func = inter_wiki
)
app.add_url_rule(
rule = '/inter_wiki/del/<name>',
defaults = {
'conn' : load_db.db_get(),
'tool' : 'del_inter_wiki',
'name' : 'Test'
},
view_func = inter_wiki_del
)
app.add_url_rule(
rule = '/inter_wiki/add',
defaults = {
'conn' : load_db.db_get(),
'tool' : 'plus_inter_wiki',
'name' : None
},
methods = ['GET', 'POST'],
view_func = inter_wiki_add
)
app.add_url_rule(
rule = '/edit_top',
defaults = {
'conn' : load_db.db_get(),
'tool' : 'edit_top'
},
view_func = inter_wiki
)
app.add_url_rule(
rule = '/edit_top/del/<name>',
defaults = {
'conn' : load_db.db_get(),
'tool' : 'del_edit_top',
'name' : 'Test'
},
view_func = inter_wiki_del
)
app.add_url_rule(
rule = '/edit_top/add',
defaults = {
'conn' : load_db.db_get(),
'tool' : 'plus_edit_top',
'name' : None
},
methods = ['GET', 'POST'],
view_func = inter_wiki_add
)
app.add_url_rule(
rule = '/image_license',
defaults = {
'conn' : load_db.db_get(),
'tool' : 'image_license'
},
view_func = inter_wiki
)
app.add_url_rule(
rule = '/image_license/del/<name>',
defaults = {
'conn' : load_db.db_get(),
'tool' : 'del_image_license',
'name' : 'Test'
},
view_func = inter_wiki_del
)
app.add_url_rule(
rule = '/image_license/add',
defaults = {
'conn' : load_db.db_get(),
'tool' : 'plus_image_license',
'name' : None
},
methods = ['GET', 'POST'],
view_func = inter_wiki_add
)
app.add_url_rule(
rule = '/edit_filter',
defaults = {
'conn' : load_db.db_get(),
'tool' : 'edit_filter'
},
view_func = inter_wiki
)
app.add_url_rule(
rule = '/edit_filter/del/<name>',
defaults = {
'conn' : load_db.db_get(),
'tool' : 'del_edit_filter',
'name' : 'Test'
},
view_func = inter_wiki_del
)
# 이거 수정 필요 할 듯
app.add_url_rule(
rule = '/edit_filter/add',
defaults = {
'conn' : load_db.db_get(),
'tool' : 'plus_edit_filter',
'name' : None
},
view_func = inter_wiki_add
)
app.add_url_rule(
rule = '/edit_filter/add/<name>',
defaults = {
'conn' : load_db.db_get(),
'tool' : 'plus_edit_filter',
'name' : 'Test'
},
methods = ['GET', 'POST'],
view_func = inter_wiki_add
)
app.add_url_rule(
rule = '/email_filter',
defaults = {
'conn' : load_db.db_get(),
'tool' : 'email_filter'
},
view_func = inter_wiki
)
app.add_url_rule(
rule = '/email_filter/del/<name>',
defaults = {
'conn' : load_db.db_get(),
'tool' : 'del_email_filter',
'name' : 'Test'
},
view_func = inter_wiki_del
)
app.add_url_rule(
rule = '/email_filter/add',
defaults = {
'conn' : load_db.db_get(),
'tool' : 'plus_email_filter',
'name' : None
},
methods = ['GET', 'POST'],
view_func = inter_wiki_add
)
app.add_url_rule(
rule = '/file_filter',
defaults = {
'conn' : load_db.db_get(),
'tool' : 'file_filter'
},
view_func = inter_wiki
)
app.add_url_rule(
rule = '/file_filter/del/<name>',
defaults = {
'conn' : load_db.db_get(),
'tool' : 'del_file_filter',
'name' : 'Test'
},
view_func = inter_wiki_del
)
app.add_url_rule(
rule = '/file_filter/add',
defaults = {
'conn' : load_db.db_get(),
'tool' : 'plus_file_filter',
'name' : None
},
methods = ['GET', 'POST'],
view_func = inter_wiki_add
)
app.add_url_rule(
rule = '/name_filter',
defaults = {
'conn' : load_db.db_get(),
'tool' : 'name_filter'
},
view_func = inter_wiki
)
app.add_url_rule(
rule = '/name_filter/del/<name>',
defaults = {
'conn' : load_db.db_get(),
'tool' : 'del_name_filter',
'name' : 'Test'
},
view_func = inter_wiki_del
)
app.add_url_rule(
rule = '/name_filter/add',
defaults = {
'conn' : load_db.db_get(),
'tool' : 'plus_name_filter',
'name' : None
},
methods = ['GET', 'POST'],
view_func = inter_wiki_add
)
app.add_url_rule(
rule = '/extension_filter',
defaults = {
'conn' : load_db.db_get(),
'tool' : 'extension_filter'
},
view_func = inter_wiki
)
app.add_url_rule(
rule = '/extension_filter/del/<name>',
defaults = {
'conn' : load_db.db_get(),
'tool' : 'del_extension_filter',
'name' : 'Test'
},
view_func = inter_wiki_del
)
app.add_url_rule(
rule = '/extension_filter/add',
defaults = {
'conn' : load_db.db_get(),
'tool' : 'plus_extension_filter',
'name' : None
},
methods = ['GET', 'POST'],
view_func = inter_wiki_add
)
# Func-list
# /list/document/old
@app.route('/old_page')
def list_old_page():
return list_old_page_2(load_db.db_get())
# /list/document/acl
@app.route('/acl_list')
def list_acl():
return list_acl_2(load_db.db_get())
# /list/document/acl/add
@app.route('/acl/<everything:name>', methods = ['POST', 'GET'])
def give_acl(name = None):
return give_acl_2(load_db.db_get(), name)
# /list/document/need
@app.route('/please')
def list_please():
return list_please_2(load_db.db_get())
# /list/document/all
@app.route('/title_index')
def list_title_index():
return list_title_index_2(load_db.db_get())
# /list/document/long
@app.route('/long_page')
def list_long_page():
return list_long_page_2(load_db.db_get(), 'long_page')
# /list/document/short
@app.route('/short_page')
def list_short_page():
return list_long_page_2(load_db.db_get(), 'short_page')
# /list/file
@app.route('/image_file_list')
def list_image_file():
return list_image_file_2(load_db.db_get())
# /list/admin
# /list/admin/list
@app.route('/admin_list')
def list_admin():
return list_admin_2(load_db.db_get())
# /list/admin/auth_use
@app.route('/admin_log', methods = ['POST', 'GET'])
def list_admin_use():
return list_admin_use_2(load_db.db_get())
# /list/user
@app.route('/user_log')
def list_user():
return list_user_2(load_db.db_get())
# /list/user/check
@app.route('/check/<name>')
def give_user_check(name = None):
return give_user_check_2(load_db.db_get(), name)
# /list/user/check/delete
@app.route('/check_delete', methods = ['POST', 'GET'])
def give_user_check_delete():
return give_user_check_delete_2(load_db.db_get())
# Func-auth
# /auth/give
# /auth/give/<name>
@app.route('/admin/<name>', methods = ['POST', 'GET'])
def give_admin(name = None):
return give_admin_2(load_db.db_get(), name)
# /auth/give
# /auth/give/<name>
@app.route('/ban', methods = ['POST', 'GET'])
@app.route('/ban/<name>', methods = ['POST', 'GET'])
def give_user_ban(name = None):
return give_user_ban_2(load_db.db_get(), name)
# /auth/list
@app.route('/admin_group')
def list_admin_group():
return list_admin_group_2(load_db.db_get())
# /auth/list/add/<name>
@app.route('/admin_plus/<name>', methods = ['POST', 'GET'])
def give_admin_groups(name = None):
return give_admin_groups_2(load_db.db_get(), name)
# /auth/list/delete/<name>
@app.route('/delete_admin_group/<name>', methods = ['POST', 'GET'])
def give_delete_admin_group(name = None):
return give_delete_admin_group_2(load_db.db_get(), name)
# /auth/history
# ongoing 반영 필요
@app.route('/block_log')
@app.route('/block_log/<regex("user"):tool>/<name>')
@app.route('/block_log/<regex("admin"):tool>/<name>')
def recent_block(name = 'Test', tool = 'all'):
return recent_block_2(load_db.db_get(), name, tool)
# Func-history
@app.route('/recent_change')
@app.route('/recent_changes')
def recent_change(name = None):
return recent_change_2(load_db.db_get(), name, '')
@app.route('/record/<name>')
def recent_record(name = None):
return recent_change_2(load_db.db_get(), name, 'record')
@app.route('/history/<everything:name>', methods = ['POST', 'GET'])
def recent_history(name = None):
return recent_change_2(load_db.db_get(), name, 'history')
@app.route('/history/tool/<int(signed=True):rev>/<everything:name>')
def recent_history_tool(name = 'Test', rev = 1):
return recent_history_tool_2(load_db.db_get(), name, rev)
@app.route('/history/delete/<int(signed=True):rev>/<everything:name>', methods = ['POST', 'GET'])
def recent_history_delete(name = 'Test', rev = 1):
return recent_history_delete_2(load_db.db_get(), name, rev)
@app.route('/history/hidden/<int(signed=True):rev>/<everything:name>')
def recent_history_hidden(name = 'Test', rev = 1):
return recent_history_hidden_2(load_db.db_get(), name, rev)
@app.route('/history/send/<int(signed=True):rev>/<everything:name>', methods = ['POST', 'GET'])
def recent_history_send(name = 'Test', rev = 1):
return recent_history_send_2(load_db.db_get(), name, rev)
@app.route('/history/reset/<everything:name>', methods = ['POST', 'GET'])
def recent_history_reset(name = 'Test'):
return recent_history_reset_2(load_db.db_get(), name)
@app.route('/history/add/<everything:name>', methods = ['POST', 'GET'])
def recent_history_add(name = 'Test'):
return recent_history_add_2(load_db.db_get(), name)
@app.route('/record/reset/<name>', methods = ['POST', 'GET'])
def recent_record_reset(name = 'Test'):
return recent_record_reset_2(load_db.db_get(), name)
@app.route('/record/topic/<name>')
def recent_record_topic(name = 'Test'):
return recent_record_topic_2(load_db.db_get(), name)
# 거처를 고심중
@app.route('/app_submit', methods = ['POST', 'GET'])
def recent_app_submit():
return recent_app_submit_2(load_db.db_get())
# Func-search
@app.route('/search', methods=['POST'])
def search():
return search_2(load_db.db_get())
@app.route('/goto', methods=['POST'])
@app.route('/goto/<everything:name>', methods=['POST'])
def search_goto(name = 'test'):
return search_goto_2(load_db.db_get(), name)
@app.route('/search/<everything:name>')
def search_deep(name = 'test'):
return search_deep_2(load_db.db_get(), name)
# Func-view
@app.route('/xref/<everything:name>')
def view_xref(name = 'Test'):
return view_xref_2(load_db.db_get(), name)
@app.route('/xref/this/<everything:name>')
def view_xref_this(name = 'Test'):
return view_xref_2(load_db.db_get(), name, xref_type = '2')
@app.route('/raw/<everything:name>')
@app.route('/thread/<int:topic_num>/raw/<int:num>')
def view_raw(name = None, topic_num = None, num = None):
return view_raw_2(load_db.db_get(), name, topic_num, num)
@app.route('/diff/<int:num_a>/<int:num_b>/<everything:name>')
def view_diff(name = 'Test', num_a = 1, num_b = 1):
return view_diff_2(load_db.db_get(), name, num_a, num_b)
@app.route('/down/<everything:name>')
def view_down(name = None):
return view_down_2(load_db.db_get(), name)
@app.route('/w/<everything:name>/doc_rev/<int:doc_rev>')
@app.route('/w/<everything:name>/doc_from/<everything:doc_from>')
@app.route('/w/<everything:name>')
def view_read(name = 'Test', doc_rev = 0, doc_from = ''):
return view_read_2(load_db.db_get(), name, doc_rev, doc_from)
# Func-edit
@app.route('/revert/<everything:name>', methods = ['POST', 'GET'])
def edit_revert(name = None):
return edit_revert_2(load_db.db_get(), name)
@app.route('/edit/<everything:name>', methods = ['POST', 'GET'])
@app.route('/edit/<everything:name>/doc_section/<int:section>', methods = ['POST', 'GET'])
def edit(name = 'Test', section = 0):
return edit_2(load_db.db_get(), name, section)
@app.route('/backlink_reset/<everything:name>')
def edit_backlink_reset(name = 'Test'):
return edit_backlink_reset_2(load_db.db_get(), name)
@app.route('/delete/<everything:name>', methods = ['POST', 'GET'])
def edit_delete(name = None):
return edit_delete_2(load_db.db_get(), name)
@app.route('/delete/doc_file/<everything:name>', methods = ['POST', 'GET'])
def edit_delete_file(name = 'test.jpg'):
return edit_delete_file_2(load_db.db_get(), name)
@app.route('/delete/doc_mutiple', methods = ['POST', 'GET'])
def edit_delete_mutiple():
return edit_delete_mutiple_2(load_db.db_get())
@app.route('/move/<everything:name>', methods = ['POST', 'GET'])
def edit_move(name = None):
return edit_move_2(load_db.db_get(), name)
# Func-topic
@app.route('/recent_discuss')
def recent_discuss():
return recent_discuss_2(load_db.db_get(), 'normal')
@app.route('/recent_discuss/close')
def recent_discuss_close():
return recent_discuss_2(load_db.db_get(), 'close')
@app.route('/recent_discuss/open')
def recent_discuss_open():
return recent_discuss_2(load_db.db_get(), 'open')
@app.route('/thread/<int:topic_num>/b/<int:num>')
def topic_block(topic_num = 1, num = 1):
return topic_block_2(load_db.db_get(), topic_num, num)
@app.route('/thread/<int:topic_num>/notice/<int:num>')
def topic_top(topic_num = 1, num = 1):
return topic_top_2(load_db.db_get(), topic_num, num)
@app.route('/thread/<int:topic_num>/setting', methods = ['POST', 'GET'])
def topic_stop(topic_num = 1):
return topic_stop_2(load_db.db_get(), topic_num)
@app.route('/thread/<int:topic_num>/acl', methods = ['POST', 'GET'])
def topic_acl(topic_num = 1):
return topic_acl_2(load_db.db_get(), topic_num)
@app.route('/thread/<int:topic_num>/delete', methods = ['POST', 'GET'])
def topic_delete(topic_num = 1):
return topic_delete_2(load_db.db_get(), topic_num)
@app.route('/thread/<int:topic_num>/tool')
def topic_tool(topic_num = 1):
return topic_tool_2(load_db.db_get(), topic_num)
@app.route('/thread/<int:topic_num>/change', methods = ['POST', 'GET'])
def topic_change(topic_num = 1):
return topic_change_2(load_db.db_get(), topic_num)
@app.route('/thread/<int:topic_num>/admin/<int:num>')
def topic_admin(topic_num = 1, num = 1):
return topic_admin_2(load_db.db_get(), topic_num, num)
@app.route('/thread/<int:topic_num>', methods = ['POST', 'GET'])
def topic(topic_num = 1):
return topic_2(load_db.db_get(), topic_num)
@app.route('/topic/<everything:name>', methods = ['POST', 'GET'])
def topic_close_list(name = 'test'):
return topic_close_list_2(load_db.db_get(), name)
# Func-user
@app.route('/change', methods = ['POST', 'GET'])
def user_setting():
return user_setting_2(load_db.db_get(), server_set_var)
@app.route('/change/email', methods = ['POST', 'GET'])
def user_setting_email():
return user_setting_email_2(load_db.db_get())
@app.route('/change/email/check', methods = ['POST', 'GET'])
def user_setting_email_check():
return user_setting_email_check_2(load_db.db_get())
@app.route('/change/pw', methods = ['POST', 'GET'])
def user_setting_pw_change():
return user_setting_pw_change_2(load_db.db_get())
@app.route('/change/head', methods=['GET', 'POST'])
def user_setting_head():
return user_setting_head_2(load_db.db_get())
@app.route('/user')
@app.route('/user/<name>')
def user_info(name = ''):
return user_info_2(load_db.db_get(), name)
@app.route('/count')
@app.route('/count/<name>')
def user_count_edit(name = None):
return user_count_edit_2(load_db.db_get(), name)
@app.route('/alarm')
def user_alarm():
return user_alarm_2(load_db.db_get())
@app.route('/alarm/delete')
def user_alarm_del():
return user_alarm_del_2(load_db.db_get())
@app.route('/watch_list')
def user_watch_list():
return user_watch_list_2(load_db.db_get(), 'watch_list')
@app.route('/watch_list/<everything:name>')
def user_watch_list_name(name = 'Test'):
return user_watch_list_name_2(load_db.db_get(), 'watch_list', name)
@app.route('/star_doc')
def user_star_doc():
return user_watch_list_2(load_db.db_get(), 'star_doc')
@app.route('/star_doc/<everything:name>')
def user_star_doc_name(name = 'Test'):
return user_watch_list_name_2(load_db.db_get(), 'star_doc', name)
# Func-login
# 개편 예정
# login -> login/2fa -> login/2fa/email with login_id
# register -> register/email -> regiter/email/check with reg_id
# pass_find -> pass_find/email with find_id
@app.route('/login', methods = ['POST', 'GET'])
def login_login():
return login_login_2(load_db.db_get())
@app.route('/login/2fa', methods = ['POST', 'GET'])
def login_login_2fa():
return login_login_2fa_2(load_db.db_get())
'''
@app.route('/login/2fa/email', methods = ['POST', 'GET'])
def login_2fa_email():
return login_login_2fa_email_2(load_db.db_get())
'''
@app.route('/register', methods = ['POST', 'GET'])
def login_register():
return login_register_2(load_db.db_get())
@app.route('/register/email', methods = ['POST', 'GET'])
def login_register_email():
return login_register_email_2(load_db.db_get())
@app.route('/register/email/check', methods = ['POST', 'GET'])
def login_register_email_check():
return login_register_email_check_2(load_db.db_get())
@app.route('/register/submit', methods = ['POST', 'GET'])
def login_register_submit():
return login_register_submit_2(load_db.db_get())
# 개편 필요
@app.route('/pass_find', methods = ['POST', 'GET'])
def login_pass_find():
return login_pass_find_2(load_db.db_get(), 'pass_find')
@app.route('/pass_find/email', methods = ['POST', 'GET'])
def login_pass_find_email():
return login_pass_find_email_2(load_db.db_get(), 'check_key')
@app.route('/logout')
def login_logout():
return login_logout_2(load_db.db_get())
# Func-vote
@app.route('/vote/<int:num>', methods = ['POST', 'GET'])
def vote_select(num = 1):
return vote_select_2(load_db.db_get(), str(num))
@app.route('/vote/end/<int:num>')
def vote_end(num = 1):
return vote_end_2(load_db.db_get(), str(num))
@app.route('/vote/close/<int:num>')
def vote_close(num = 1):
return vote_close_2(load_db.db_get(), str(num))
@app.route('/vote')
@app.route('/vote/list')
@app.route('/vote/list/<int:num>')