api_setting.py 942 B

1234567891011121314151617181920212223242526
  1. from .tool.func import *
  2. from .user_setting_skin_set_main import user_setting_skin_set_main_set_list
  3. def api_setting(name = 'markup'):
  4. with get_db_connect() as conn:
  5. curs = conn.cursor()
  6. # from other
  7. ok_list_1 = ['markup']
  8. ok_list_1 += [for_a for for_a in user_setting_skin_set_main_set_list()]
  9. # from html_filter
  10. ok_list_2 = ['inter_wiki']
  11. if name in ok_list_1:
  12. curs.execute(db_change('select data from other where name = ?'), [name])
  13. rep_data = curs.fetchall()
  14. if rep_data:
  15. return flask.jsonify({ name : rep_data })
  16. elif name in ok_list_2:
  17. curs.execute(db_change("select html, plus, plus_t from html_filter where kind = ?"), [name])
  18. rep_data = curs.fetchall()
  19. if rep_data:
  20. return flask.jsonify({ name : rep_data })
  21. return flask.jsonify({})