Spaces:
Build error
Build error
Download auth.lua from UnschooledGamer/idk-man: direct link, hf CLI and curl.
- Browser
- Download file 475 Bytes
-
https://huggingface.co/spaces/UnschooledGamer/idk-man/resolve/main/auth.lua
- Command line
-
hf download hf://spaces/UnschooledGamer/idk-man/auth.lua
-
curl -L -o auth.lua https://huggingface.co/spaces/UnschooledGamer/idk-man/resolve/main/auth.lua
475 Bytes
| local json = require("json") | |
| local config = require('../utils/config') | |
| return function(req, res, go) | |
| local pass = req.headers["authorization"] | |
| p('[addon - auth]', req.path) | |
| -- Just for Hugging Face | |
| if req.path == '/' then | |
| res.code = 200 | |
| return | |
| end | |
| if pass ~= config.server.password then | |
| res.body = json.encode({ error = "Authorization failed" }) | |
| res.code = 401 | |
| res.headers["Content-Type"] = "application/json" | |
| return | |
| end | |
| go() | |
| end | |