Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.3.0版本无法打开后端管理网页,显示一片空白 #12

Closed
Georgebillion opened this issue Jan 23, 2022 · 43 comments
Closed

Comments

@Georgebillion
Copy link

No description provided.

@Georgebillion
Copy link
Author

使用的是pip的更新版本,自动更新到1.3.0后管理网页无法显示,后转成1.2.4版本后报错无法启动

@acgnhiki
Copy link
Owner

试下卸载重装

@Georgebillion
Copy link
Author

试下卸载重装

重装还是一样,还是空白页面,用pip升级的

@Georgebillion
Copy link
Author

试下卸载重装

我已经重装了2遍了,包括把pip的依赖库删除重装也是一样,pip uninstall也是空白,从1.3.0开始就打不开管理页面,升级后刷新原有打开的页面显示not found

@acgnhiki
Copy link
Owner

直接用 url 访问也不行吗? 看下是不是被防火墙拦截了

@Georgebillion
Copy link
Author

直接用 url 访问也不行吗? 看下是不是被防火墙拦截了

防火墙我是关闭的

@acgnhiki
Copy link
Owner

那你下载打包好的,试下看看能不能访问。

@Georgebillion
Copy link
Author

那你下载打包好的,试下看看能不能访问。

我试一下吧

@Georgebillion
Copy link
Author

那你下载打包好的,试下看看能不能访问。

但是我想分端口的话,用打包好的怎么分端口啊?

@Georgebillion
Copy link
Author

3 validation errors for Settings
recorder -> disconnection_timeout
extra fields not permitted (type=value_error.extra)
recorder -> save_cover
extra fields not permitted (type=value_error.extra)
postprocessing -> inject_extra_metadata
extra fields not permitted (type=value_error.extra)
Traceback (most recent call last):
File "F:\blrec-1.2.4-win64\python-3.10.1-embed-amd64\Lib\site-packages\blrec\cli\main.py", line 83, in main
cli()
File "F:\blrec-1.2.4-win64\python-3.10.1-embed-amd64\Lib\site-packages\typer\main.py", line 214, in call
return get_command(self)(*args, **kwargs)
File "F:\blrec-1.2.4-win64\python-3.10.1-embed-amd64\Lib\site-packages\click\core.py", line 1128, in call
return self.main(*args, **kwargs)
File "F:\blrec-1.2.4-win64\python-3.10.1-embed-amd64\Lib\site-packages\click\core.py", line 1053, in main
rv = self.invoke(ctx)
File "F:\blrec-1.2.4-win64\python-3.10.1-embed-amd64\Lib\site-packages\click\core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "F:\blrec-1.2.4-win64\python-3.10.1-embed-amd64\Lib\site-packages\click\core.py", line 754, in invoke
return _callback(*args, **kwargs)
File "F:\blrec-1.2.4-win64\python-3.10.1-embed-amd64\Lib\site-packages\typer\main.py", line 500, in wrapper
return callback(**use_params) # type: ignore
File "F:\blrec-1.2.4-win64\python-3.10.1-embed-amd64\Lib\site-packages\blrec\cli\main.py", line 69, in cli_main
uvicorn.run(
File "F:\blrec-1.2.4-win64\python-3.10.1-embed-amd64\Lib\site-packages\uvicorn\main.py", line 447, in run
server.run()
File "F:\blrec-1.2.4-win64\python-3.10.1-embed-amd64\Lib\site-packages\uvicorn\server.py", line 68, in run
return asyncio.run(self.serve(sockets=sockets))
File "asyncio\runners.py", line 44, in run
File "asyncio\base_events.py", line 641, in run_until_complete
File "F:\blrec-1.2.4-win64\python-3.10.1-embed-amd64\Lib\site-packages\uvicorn\server.py", line 76, in serve
config.load()
File "F:\blrec-1.2.4-win64\python-3.10.1-embed-amd64\Lib\site-packages\uvicorn\config.py", line 448, in load
self.loaded_app = import_from_string(self.app)
File "F:\blrec-1.2.4-win64\python-3.10.1-embed-amd64\Lib\site-packages\uvicorn\importer.py", line 21, in import_from_string
module = importlib.import_module(module_str)
File "importlib_init
.py", line 126, in import_module
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in call_with_frames_removed
File "F:\blrec-1.2.4-win64\python-3.10.1-embed-amd64\Lib\site-packages\blrec\web_init
.py", line 1, in
from .main import api as app
File "F:\blrec-1.2.4-win64\python-3.10.1-embed-amd64\Lib\site-packages\blrec\web\main.py", line 27, in
_settings = Settings.load(_env_settings.settings_file)
File "F:\blrec-1.2.4-win64\python-3.10.1-embed-amd64\Lib\site-packages\blrec\setting\models.py", line 396, in load
settings = cls.parse_obj(toml.load(path))
File "pydantic\main.py", line 511, in pydantic.main.BaseModel.parse_obj
File "pydantic\main.py", line 331, in pydantic.main.BaseModel.init
pydantic.error_wrappers.ValidationError: 3 validation errors for Settings
recorder -> disconnection_timeout
extra fields not permitted (type=value_error.extra)
recorder -> save_cover
extra fields not permitted (type=value_error.extra)
postprocessing -> inject_extra_metadata
extra fields not permitted (type=value_error.extra)
Press any key to continue . . .
直接报错了

@acgnhiki
Copy link
Owner

新版本的配置文件不能用于旧版本,新版本添加了新的设置与旧版本不兼容。

@acgnhiki
Copy link
Owner

可以试下 pipx

@Georgebillion
Copy link
Author

可以试下 pipx
你的意思是,需要重新设置?

@acgnhiki
Copy link
Owner

用 pipx 安装,可以避免一些库依赖导致的问题。

@acgnhiki
Copy link
Owner

也可以不用重新设置,把新版本添加的设置删了就可以:打开 settings.toml 文件搜索并删除 disconnection_timeout、save_cover、inject_extra_metadata 这几个设置所在的行。

@Georgebillion
Copy link
Author

也可以不用重新设置,把新版本添加的设置删了就可以:打开 settings.toml 文件搜索并删除 disconnection_timeout、save_cover、inject_extra_metadata 这几个设置所在的行。

1.2.4打包的可以用,1.3.0的网页还是不行
麻烦看一下能不能改?

@acgnhiki
Copy link
Owner

1.3.0 网页还访问不了?换个浏览器试试,试下清一下网站数据。
2022-01-24_095512

@Georgebillion
Copy link
Author

我试试吧

@acgnhiki
Copy link
Owner

打包好的也可以分端口,自己改下 run.bat 的 set port=2233
要多开就复制出多个 run.bat 文件然后改不同的端口并指定不同的保存目录和设置文件

@Georgebillion
Copy link
Author

1.3.1版本无法打开后端管理页面,显示空白,通过调试台发现下面提示:
Please enable JavaScript to continue using this application.

@Georgebillion
Copy link
Author

chrome提示有3个错误

@acgnhiki
Copy link
Owner

1.3.1版本无法打开后端管理页面,显示空白,通过调试台发现下面提示: Please enable JavaScript to continue using this application.

你的浏览器禁用了 JavaScript 。。。没 JavaScript 前端应用还怎么运行 。。。

@Georgebillion
Copy link
Author

1.3.1版本无法打开后端管理页面,显示空白,通过调试台发现下面提示: Please enable JavaScript to continue using this application.

你的浏览器禁用了 JavaScript 。。。没 JavaScript 前端应用还怎么运行 。。。

但是我检查发现并没有禁用

@Georgebillion
Copy link
Author

1.3.1版本无法打开后端管理页面,显示空白,通过调试台发现下面提示: Please enable JavaScript to continue using this application.

你的浏览器禁用了 JavaScript 。。。没 JavaScript 前端应用还怎么运行 。。。
然后顺带检查了一下缓存,也是清理过了,打开JS后也是空白

@Georgebillion
Copy link
Author

chrome/egde均无法打开,IE同理

@Georgebillion
Copy link
Author

GET http://127.0.0.1:2233/tasks 404 (Not Found)
runtime.c48b962c8225f379.js:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.
polyfills.4b08448aee19bb22.js:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.
main.7a4da5a70e652c3f.js:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec..
chrome浏览器F12下查看到的错误

@acgnhiki
Copy link
Owner

GET http://127.0.0.1:2233/tasks 404 (Not Found) runtime.c48b962c8225f379.js:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec. polyfills.4b08448aee19bb22.js:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec. main.7a4da5a70e652c3f.js:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.. chrome浏览器F12下查看到的错误

在隐私窗口不带扩展的环境下访问也会吗?

@Georgebillion
Copy link
Author

不带扩展的隐私模式下也是一样

@Georgebillion
Copy link
Author

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.
:2233/polyfills.4b08448aee19bb22.js:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.
:2233/main.7a4da5a70e652c3f.js:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.

@Georgebillion
Copy link
Author

已拦截载入自“http://127.0.0.1:2233/runtime.c48b962c8225f379.js”的模块,它使用了不允许的 MIME 类型(“text/plain”)。
127.0.0.1:2233
来源为“http://127.0.0.1:2233/runtime.c48b962c8225f379.js”的模块载入失败。 127.0.0.1:2233:13:1
已拦截载入自“http://127.0.0.1:2233/polyfills.4b08448aee19bb22.js”的模块,它使用了不允许的 MIME 类型(“text/plain”)。
127.0.0.1:2233
来源为“http://127.0.0.1:2233/polyfills.4b08448aee19bb22.js”的模块载入失败。 127.0.0.1:2233:13:1
已拦截载入自“http://127.0.0.1:2233/main.7a4da5a70e652c3f.js”的模块,它使用了不允许的 MIME 类型(“text/plain”)。
127.0.0.1:2233
来源为“http://127.0.0.1:2233/main.7a4da5a70e652c3f.js”的模块载入失败。 127.0.0.1:2233:13:1
FirefoxF12下的报错信息

@Georgebillion
Copy link
Author

@Georgebillion
Copy link
Author

火狐申请直接报304错误

@acgnhiki
Copy link
Owner

看一下你的请求是不是也是这样的
2022-01-30_004059

@Georgebillion
Copy link
Author

请求网址: http://localhost:2234/runtime.c48b962c8225f379.js
请求方法: GET
状态代码: 200 OK
远程地址: [::1]:2234
引荐来源网址政策: strict-origin-when-cross-origin
access-control-allow-credentials: true
content-length: 2920
content-type: text/plain; charset=utf-8
date: Mon, 31 Jan 2022 11:17:52 GMT
etag: a551d4a7f967a82da3bc8c0ea78ddf64
last-modified: Thu, 27 Jan 2022 10:49:11 GMT
server: uvicorn
Accept: /
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Cache-Control: no-cache
Connection: keep-alive
DNT: 1
Host: localhost:2234
Origin: http://localhost:2234
Pragma: no-cache
Referer: http://localhost:2234/
sec-ch-ua: " Not;A Brand";v="99", "Google Chrome";v="97", "Chromium";v="97"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
Sec-Fetch-Dest: script
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36

@Georgebillion
Copy link
Author

请求在上面

@acgnhiki
Copy link
Owner

acgnhiki commented Feb 5, 2022

你的网络请求可能被篡改过,uvicorn 返回的 content-typeapplication/javascript 而不是 text/plain; charset=utf-8

~$ curl --head http://localhost:2233/runtime.c48b962c8225f379.js
HTTP/1.1 200 OK
date: Sat, 05 Feb 2022 03:46:10 GMT
server: uvicorn
content-type: application/javascript
content-length: 2920
last-modified: Fri, 21 Jan 2022 09:47:57 GMT
etag: 4f1bdb8f64e204a860b5dc4c2c6ffca7

@Georgebillion
Copy link
Author

问题是这是chrome直接访问的啊
我没改过啊

@Georgebillion
Copy link
Author

date: Sat, 05 Feb 2022 12:43:19 GMT
server: uvicorn
content-type: text/plain; charset=utf-8
content-length: 2920
last-modified: Thu, 27 Jan 2022 10:49:11 GMT
etag: a551d4a7f967a82da3bc8c0ea78ddf64

@acgnhiki
Copy link
Owner

acgnhiki commented Feb 5, 2022

问题是这是chrome直接访问的啊 我没改过啊

那我就不知道了~ 我这里不同设备都试过了,都不会出现这种问题,应该可以确定不是程序的问题。

@cafrew
Copy link

cafrew commented Mar 19, 2022

我这里也出现了这个问题,浏览器的错误信息和题主的一样,换系统、换浏览器、都可以复现。
有没有什么办法可以让浏览器把 text/plain 识别成 application/javascript,或者其他方法,我也在找原因

@cafrew
Copy link

cafrew commented Mar 19, 2022

问题已解决
原因:https://stackoverflow.com/questions/59355194/python-flask-error-failed-to-load-module-script-strict-mime-type-checking-i
方法:
打开注册表 HKEY_CLASSES_ROOT/.js,打开Content Type,把"text/plain"改成"application/javascript"

@acgnhiki
Copy link
Owner

新装的系统 HKEY_CLASSES_ROOT/.js 是没有 Content Type 这个值的,可能是有什么软件修改了?

golang/go#32350 (comment)

@Georgebillion
Copy link
Author

问题已解决 原因:https://stackoverflow.com/questions/59355194/python-flask-error-failed-to-load-module-script-strict-mime-type-checking-i 方法: 打开注册表 HKEY_CLASSES_ROOT/.js,打开Content Type,把"text/plain"改成"application/javascript"

此方法有效,已在1.5.0版本中成功打开后端面板,可能是flask模块问题???

acgnhiki pushed a commit that referenced this issue Apr 24, 2022
resolve #12
resolve #27
fix #39
fix #41
fix #47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants