main_file.py 861 B

123456789101112131415161718192021
  1. from .tool.func import *
  2. from . import main_error_404
  3. def main_file_2(conn, data):
  4. curs = conn.cursor()
  5. if data == 'easter_egg.html':
  6. return easy_minify(flask.render_template(skin_check(),
  7. imp = ['easter_egg.html', wiki_set(), custom(), other2([0, 0])],
  8. data = open('./views/main_css/file/easter_egg.html', 'r').read(),
  9. menu = 0
  10. ))
  11. elif re.search('\.txt$', data) or data == 'sitemap.xml':
  12. if data == 'robots.txt' and not os.path.exists('robots.txt'):
  13. return flask.Response('User-agent: *\nDisallow: /\nAllow: /$\nAllow: /w/', mimetype='text/plain')
  14. elif os.path.exists(data):
  15. return flask.send_from_directory('./', data)
  16. else:
  17. return main_error_404.main_error_404_2(conn)
  18. else:
  19. return main_error_404.main_error_404_2(conn)