mirror of https://github.com/coddrago/Heroku
Attempt to fix web
parent
c6f59e4eb6
commit
e72e4a28d3
|
@ -145,7 +145,7 @@ def parse_arguments():
|
||||||
parser.add_argument("--no-nickname", "-nn", dest="no_nickname", action="store_true")
|
parser.add_argument("--no-nickname", "-nn", dest="no_nickname", action="store_true")
|
||||||
parser.add_argument("--hosting", "-lh", dest="hosting", action="store_true")
|
parser.add_argument("--hosting", "-lh", dest="hosting", action="store_true")
|
||||||
parser.add_argument("--web-only", dest="web_only", action="store_true")
|
parser.add_argument("--web-only", dest="web_only", action="store_true")
|
||||||
parser.add_argument("--no-web", dest="web", action="store_false")
|
parser.add_argument("--no-web", dest="disable_web", action="store_false")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--data-root",
|
"--data-root",
|
||||||
dest="data_root",
|
dest="data_root",
|
||||||
|
@ -279,9 +279,7 @@ class Hikka:
|
||||||
lambda f: f.startswith("hikka-") and f.endswith(".session"),
|
lambda f: f.startswith("hikka-") and f.endswith(".session"),
|
||||||
os.listdir(
|
os.listdir(
|
||||||
self.arguments.data_root
|
self.arguments.data_root
|
||||||
or os.path.dirname(
|
or os.path.dirname(utils.get_base_dir()),
|
||||||
utils.get_base_dir()
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -289,7 +287,10 @@ class Hikka:
|
||||||
|
|
||||||
phones.update(
|
phones.update(
|
||||||
**(
|
**(
|
||||||
{phone.split(":", maxsplit=1)[0]: phone for phone in self.arguments.phone}
|
{
|
||||||
|
phone.split(":", maxsplit=1)[0]: phone
|
||||||
|
for phone in self.arguments.phone
|
||||||
|
}
|
||||||
if self.arguments.phone
|
if self.arguments.phone
|
||||||
else {}
|
else {}
|
||||||
)
|
)
|
||||||
|
@ -315,7 +316,9 @@ class Hikka:
|
||||||
from . import api_token
|
from . import api_token
|
||||||
except ImportError:
|
except ImportError:
|
||||||
try:
|
try:
|
||||||
api_token = api_token_type(os.environ["api_id"], os.environ["api_hash"])
|
api_token = api_token_type(
|
||||||
|
os.environ["api_id"], os.environ["api_hash"]
|
||||||
|
)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
api_token = None
|
api_token = None
|
||||||
|
|
||||||
|
@ -423,7 +426,15 @@ class Hikka:
|
||||||
connection_retries=None,
|
connection_retries=None,
|
||||||
)
|
)
|
||||||
|
|
||||||
client.start(phone=raise_auth if web_available else lambda: input("Phone: "))
|
client.start(
|
||||||
|
phone=raise_auth
|
||||||
|
if self.web
|
||||||
|
and (
|
||||||
|
not hasattr(self.arguments, "web")
|
||||||
|
or self.arguments.web is not False
|
||||||
|
)
|
||||||
|
else lambda: input("Phone: ")
|
||||||
|
)
|
||||||
client.phone = phone
|
client.phone = phone
|
||||||
|
|
||||||
self.clients.append(client)
|
self.clients.append(client)
|
||||||
|
|
|
@ -160,7 +160,8 @@
|
||||||
var skip_creds = "{{ skip_creds }}" == "True";
|
var skip_creds = "{{ skip_creds }}" == "True";
|
||||||
var auth_required = true;
|
var auth_required = true;
|
||||||
fetch("/check_session", {
|
fetch("/check_session", {
|
||||||
method: "POST"
|
method: "POST",
|
||||||
|
credentials: "include"
|
||||||
})
|
})
|
||||||
.then(response => response.text())
|
.then(response => response.text())
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
|
|
@ -13,6 +13,7 @@ function auth(callback) {
|
||||||
});
|
});
|
||||||
fetch("/web_auth", {
|
fetch("/web_auth", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
credentials: "include",
|
||||||
timeout: 5000
|
timeout: 5000
|
||||||
})
|
})
|
||||||
.then(response => response.text())
|
.then(response => response.text())
|
||||||
|
|
Loading…
Reference in New Issue