def qr():
     file_path = request.values.get("filepath")
     printv(file_path, hash(file_path))
     file_name = str(hash(file_path)) + ".png"
     printv(file_name)
     network_path = "http://{}:{}".format(
         network.get_host_ip(),
         request.host[request.host.find(":") + 1:]) + file_path
     printv("network_path", network_path)
     return render_template("qrcode.html",
                            filepath=myqrcode.generateCode(
                                network_path, file_name)[1],
                            filename=file_path,
                            user_settings=file_handler.get_settings())
示例#2
0
    def file(filename):
        printv("files/" + filename)
        local_path = os.path.join(os.getcwd(), 'files', filename)
        printv(local_path)
        is_admin = network.checkIP(request.remote_addr)

        if os.path.isfile(local_path):
            return send_file(local_path)
        elif os.path.isdir(local_path):
            return render_template('index.html',
                                   cwd=local_path.replace('\\', "\\\\")
                                   if platform == "win32" else local_path,
                                   dirs=file_handler.get_dir(local_path),
                                   is_admin=is_admin,
                                   user_settings=file_handler.get_settings(),
                                   ip=network.get_host_ip())
        else:
            abort(404)
示例#3
0
 def open_setting():
     if network.checkIP(request.remote_addr):
         return render_template("settings.html",
                                user_settings=file_handler.get_settings())
     else:
         return abort(403)