hymbz / ComicReadScript

为漫画站增加双页阅读模式及优化使用体验。
https://comic-read.pages.dev/
GNU Affero General Public License v3.0
563 stars 25 forks source link

翻译问题 #95

Closed zouhai44 closed 10 months ago

zouhai44 commented 10 months ago

2台电脑 一台部署了翻译 在本地可以实现翻译 另一台电脑 改url 会出现加载出错 。 docker 后台会有数据显示 证明翻译出错 本地的没有的事

zouhai44 commented 10 months ago

另一台电脑改url会出现加载错误。docker后台有数据显示翻译成功 但是加载出错

hymbz commented 10 months ago

是因为什么才需要改 url?F12 的控制台里有报错信息吗?

hymbz commented 10 months ago

另外,直接用 manga-image-translator 的 web ui 翻译可以正常显示吗?

zouhai44 commented 10 months ago

目的:我有个云电脑 我想用他来搭个翻译服务 不想在本机用 用manga-image-translator 可以 实现翻译 本地 和 另一台机子都可以 但是用 ComicReadScript 用你的方法 本地部署的可以用 但是 另一台机子修改url 会显示加载出错

zouhai44 commented 10 months ago

image image 本地事可以的 (云电脑) image image image image

这是另一台电脑

zouhai44 commented 10 months ago

image

hymbz commented 10 months ago

感谢截图,知道问题所在了。是因为图片直接用了 manga-image-translator 提供的图片 url,结果触发了 cors。

这是哪个网站?我看下我这边能否复现。

zouhai44 commented 10 months ago

本地部署的可以实现 翻译 用局域网的另一台不行 我试过了k 网站不行 和 e站这个也不行

hymbz commented 10 months ago

已更新修复

zouhai44 commented 10 months ago

我试下 谢谢 大佬··

EnergoStalin commented 10 months ago

I also was recently accessing image-manga-translator deployment on colab through localtunnel with local nginx proxy cause tunnel need either additional header or non standard user-agent. It can be done simpler through ability to specify custom headers or have js request modifier field like that.

(request) => { /* some logic with request before send it to custom url */ }

Current setup with local proxy

nginx.conf

daemon off;

events {}

error_log /dev/stderr info;

http {
    server {
        listen 5003;
        access_log /dev/stdout;

        location / {
            client_max_body_size 100M;
            proxy_set_header Bypass-Tunnel-Reminder yes;
            proxy_pass https://great-years-smell.loca.lt;
        }
    }
}

Setup can be done a lot better in terms of connection speed but the point of this to directly link to service exposed on colab. This is a pretty questionable use case tho because running through such services with inconsistent url and additional rules is generally bad idea while you have option not to do so.

So i wonder is request modifier or custom header needed feature or not. There's may be even some predefined request modifiers in case of running behind such services.

hymbz commented 10 months ago

@EnergoStalin

So i wonder is request modifier or custom header needed feature or not.

I think it's not necessary, but I can't be sure. Because of the translation, I can't quite understand what you mean.

Perhaps you can take a look at my code implementation? selfhosted.ts

EnergoStalin commented 10 months ago

I think it's not necessary

Same. It's mostly just fun fact. Not actual feature description or request. The speed of colab & localtunnel solution sucks like i said earlier cause either google or localtunnel significantly throttle traffic on top of that you always have random url with localtunnel on each start. So you could possibly win with this setup only when you don't have enough gpu memory and with small image ~1mb if cotrans unavailable or under high load.