We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 43c371f commit 0427f63Copy full SHA for 0427f63
websockify/token_plugins.py
@@ -65,6 +65,23 @@ def lookup(self, token):
65
66
return super().lookup(token)
67
68
+class TokenFileName(BasePlugin):
69
+ # source is a directory
70
+ # token is filename
71
+ # contents of file is host:port
72
+ def __init__(self, src):
73
+ super().__init__(src)
74
+ if not os.path.isdir(src):
75
+ raise Exception("TokenFileName plugin requires a directory")
76
+
77
+ def lookup(self, token):
78
+ token = os.path.basename(token)
79
+ path = os.path.join(self.source, token)
80
+ if os.path.exists(path):
81
+ return open(path).read().strip().split(':')
82
+ else:
83
+ return None
84
85
86
class BaseTokenAPI(BasePlugin):
87
# source is a url with a '%s' in it where the token
0 commit comments