class User(flask_login.UserMixin):
def __init__(self, username):
self.username = username
self.id = username
@staticmethod
def get(username):
return User(username)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Type Guard | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author Chuang Yu | |
// @match *://*/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=google.com | |
// @grant none | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: void(function() { | |
/*删除书影音*/ | |
/*you can replace this with "movie" or "music"*/ | |
var douban_type = "book"; | |
var send_delete = function(sid) { | |
$.post_withck("https://" + douban_type+ ".douban.com/j/mine/j_cat_ui", | |
{sid: sid}) | |
}; | |
if ($("a.d_link").length > 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Surge for Mac 配置文件 | |
# 显示 Finder 隐藏文件,将 .surge.conf 文件复制到 ~/ 也就是「个人」目录下。 | |
[General] | |
# warning, notify, info, verbose | |
loglevel = notify | |
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local, e.crashlytics.com, apple.cn | |
bypass-tun = 0.0.0.0/8, 1.0.0.0/9, 1.160.0.0/11, 1.192.0.0/11, 10.0.0.0/8, 14.0.0.0/11, 14.96.0.0/11, 14.128.0.0/11, 14.192.0.0/11, 27.0.0.0/10, 27.96.0.0/11, 27.128.0.0/9, 36.0.0.0/10, 36.96.0.0/11, 36.128.0.0/9, 39.0.0.0/11, 39.64.0.0/10, 39.128.0.0/10, 42.0.0.0/8, 43.224.0.0/11, 45.64.0.0/10, 47.64.0.0/10, 49.0.0.0/9, 49.128.0.0/11, 49.192.0.0/10, 54.192.0.0/11, 58.0.0.0/9, 58.128.0.0/11, 58.192.0.0/10, 59.32.0.0/11, 59.64.0.0/10, 59.128.0.0/9, 60.0.0.0/10, 60.160.0.0/11, 60.192.0.0/10, 61.0.0.0/10, 61.64.0.0/11, 61.128.0.0/10, 61.224.0.0/11, 100.64.0.0/10, 101.0.0.0/9, 101.128.0.0/11, 101.192.0.0/10, 103.0.0.0/10, 103.192.0.0/10, 106.0.0.0/9, 106.224.0.0/11, 110.0.0.0/7, 112.0.0.0/9, 112.128.0.0/11, 112.192.0.0/10, 113.0.0.0/9, 113.128.0.0/11, 113.192.0.0/ |
写在内部没有出错,登录之后再 去 /login 页面 会返回一个 json。
@app.route('/login', methods=['GET', 'POST'])
def login():
if request.method == 'GET':
if flask_login.current_user is not None and flask_login.current_user.is_authenticated:
return jsonify({'status': False, 'cause': 'already logged in'})
如果用装饰器,则flask_login失效:登录请求发送后,不返回login()里写的返回值,却会立刻返回装饰器里的json,当然,此时 flask_login.current_user.is_authenticated == True
,但是奇怪的是并没有登录成功。再进入/login 也不会被 before_login_only 拦截下来。
#try gist It is my first time to use gist as a blog. I'd like to share with the world ideas and methods.