mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-02-12 15:39:58 +08:00
修复ssl问题(不使用https)
This commit is contained in:
parent
4b12424221
commit
83803ddb73
@ -15,6 +15,7 @@ See the Mulan PSL v2 for more details.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from typing import Optional, Literal, Tuple
|
from typing import Optional, Literal, Tuple
|
||||||
|
from nonebot import logger
|
||||||
import httpx
|
import httpx
|
||||||
import time
|
import time
|
||||||
|
|
||||||
@ -39,7 +40,7 @@ class ConvertChannel:
|
|||||||
|
|
||||||
class L2PChannel(ConvertChannel):
|
class L2PChannel(ConvertChannel):
|
||||||
|
|
||||||
URL = "https://www.latex2png.com"
|
URL = "http://www.latex2png.com"
|
||||||
|
|
||||||
async def get_to_convert(
|
async def get_to_convert(
|
||||||
self,
|
self,
|
||||||
@ -94,9 +95,9 @@ class L2PChannel(ConvertChannel):
|
|||||||
start_time = time.time_ns()
|
start_time = time.time_ns()
|
||||||
latex2png = (
|
latex2png = (
|
||||||
client.get(
|
client.get(
|
||||||
"https://www.latex2png.com{}"
|
"http://www.latex2png.com{}"
|
||||||
+ client.post(
|
+ client.post(
|
||||||
"https://www.latex2png.com/api/convert",
|
"http://www.latex2png.com/api/convert",
|
||||||
json={
|
json={
|
||||||
"auth": {"user": "guest", "password": "guest"},
|
"auth": {"user": "guest", "password": "guest"},
|
||||||
"latex": "\\\\int_{a}^{b} x^2 \\\\, dx = \\\\frac{b^3}{3} - \\\\frac{a^3}{5}\n",
|
"latex": "\\\\int_{a}^{b} x^2 \\\\, dx = \\\\frac{b^3}{3} - \\\\frac{a^3}{5}\n",
|
||||||
@ -228,7 +229,7 @@ class JRTChannel(ConvertChannel):
|
|||||||
joeraut = (
|
joeraut = (
|
||||||
client.get(
|
client.get(
|
||||||
client.post(
|
client.post(
|
||||||
"https://www.latex2png.com/api/convert",
|
"http://www.latex2png.com/api/convert",
|
||||||
json={
|
json={
|
||||||
"latexInput": "\\\\int_{a}^{b} x^2 \\\\, dx = \\\\frac{b^3}{3} - \\\\frac{a^3}{5}",
|
"latexInput": "\\\\int_{a}^{b} x^2 \\\\, dx = \\\\frac{b^3}{3} - \\\\frac{a^3}{5}",
|
||||||
"outputFormat": "PNG",
|
"outputFormat": "PNG",
|
||||||
@ -256,6 +257,7 @@ class ConvertLatex:
|
|||||||
def __init__(self, channel: Optional[ConvertChannel] = None) -> None:
|
def __init__(self, channel: Optional[ConvertChannel] = None) -> None:
|
||||||
|
|
||||||
if channel is None:
|
if channel is None:
|
||||||
|
logger.info("正在选择 LaTeX 转换服务频道,请稍等...")
|
||||||
self.channel = self.auto_choose_channel()
|
self.channel = self.auto_choose_channel()
|
||||||
else:
|
else:
|
||||||
self.channel = channel
|
self.channel = channel
|
||||||
|
Loading…
x
Reference in New Issue
Block a user