Discuz论坛头像上传助手

突破图片尺寸、GIF帧数限制,无损上传

< Feedback on Discuz论坛头像上传助手

Question/comment

§
Posted: 23.12.2023
Edited: 23.12.2023

我在 https://www.parao0.com/ 这个论坛上使用时会报错,导致无法上传

userscript.html?name=Discuz%25E8%25AE%25BA%25E5%259D%259B%25E5%25A4%25B4%25E5%2583%258F%25E4%25B8%258A%25E4%25BC%25A0%25E5%258A%25A9%25E6%2589%258B.user.js&id=f6d7c4cb-048d-4197-8e60-0ee877c5dd81:97 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'src')
    at userscript.html?name=Discuz%25E8%25AE%25BA%25E5%259D%259B%25E5%25A4%25B4%25E5%2583%258F%25E4%25B8%258A%25E4%25BC%25A0%25E5%258A%25A9%25E6%2589%258B.user.js&id=f6d7c4cb-048d-4197-8e60-0ee877c5dd81:97:74
    at Proxy.<anonymous> (userscript.html?name=Discuz%25E8%25AE%25BA%25E5%259D%259B%25E5%25A4%25B4%25E5%2583%258F%25E4%25B8%258A%25E4%25BC%25A0%25E5%258A%25A9%25E6%2589%258B.user.js&id=f6d7c4cb-048d-4197-8e60-0ee877c5dd81:470:3)
    at Gt (<anonymous>:9:89)
    at userscript.html?name=Discuz%25E8%25AE%25BA%25E5%259D%259B%25E5%25A4%25B4%25E5%2583%258F%25E4%25B8%258A%25E4%25BC%25A0%25E5%258A%25A9%25E6%2589%258B.user.js&id=f6d7c4cb-048d-4197-8e60-0ee877c5dd81:1:88
    at window.__f__lqhrx3g6.ou6 (userscript.html?name=Discuz%25E8%25AE%25BA%25E5%259D%259B%25E5%25A4%25B4%25E5%2583%258F%25E4%25B8%258A%25E4%25BC%25A0%25E5%258A%25A9%25E6%2589%258B.user.js&id=f6d7c4cb-048d-4197-8e60-0ee877c5dd81:1:351)
    at Gt (<anonymous>:9:89)
    at o (<anonymous>:78:23)
    at <anonymous>:80:411
    at f (<anonymous>:74:452)

点进报错提示之后是下面的代码

const swfUrl = new URL(data ? data[data.indexOf('src')+1] : swf_mycamera.src);
const maxSize = parseInt(swfUrl.searchParams.get('uploadSize') || 2048, 10) * 1024;

尝试把上面这两个const移动到前面if (!html5mode && !swf_mycamera)的条件内后能加载出选择框了,但是点击 大头像/中头像/小头像 的选择框选择完文件后,图片没有加载到页面中

§
Posted: 23.12.2023
Edited: 23.12.2023

补充,我是在Chrome上的Tampermonkey环境

const swfUrl = new URL(data ? data[data.indexOf('src')+1] : swf_mycamera.src);
const maxSize = parseInt(swfUrl.searchParams.get('uploadSize') || 2048, 10) * 1024;

和GPT一起摸索了一下,上面这两行等网页加载出来之后再在Console手动执行的话是能够获取到结果的,但是Tampermonkey脚本运行时不行。我临时通过把swfUrl设置为网页上对应的URL完成了头像上传。

不知道这是不是个兼容问题,大佬有空的时候能不能帮忙看一下~

Post reply

Sign in to post a reply.