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

你这个七牛用的姿势好像不太对啊,协议没地方配置啊,默认http就报错了。 #5

Open
ieras opened this issue Dec 29, 2022 · 10 comments

Comments

@ieras
Copy link

ieras commented Dec 29, 2022

如下:
Mixed Content: The page at 'https://*****/admin/wp_posts/44/edit' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://up-cn-east-2.qiniup.com/'. This request has been blocked; the content must be served over HTTPS.
希望能改进一下!
另外为啥不用 zgldh/qiniu-laravel-storage 这个呢?感觉这个用的更多~

@weiwait
Copy link
Owner

weiwait commented Dec 30, 2022

如下: Mixed Content: The page at 'https://*****/admin/wp_posts/44/edit' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://up-cn-east-2.qiniup.com/'. This request has been blocked; the content must be served over HTTPS. 希望能改进一下! 另外为啥不用 zgldh/qiniu-laravel-storage 这个呢?感觉这个用的更多~

你的域名配置成https试试

@ieras
Copy link
Author

ieras commented Dec 30, 2022

如下: Mixed Content: The page at 'https://*****/admin/wp_posts/44/edit' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://up-cn-east-2.qiniup.com/'. This request has been blocked; the content must be served over HTTPS. 希望能改进一下! 另外为啥不用 zgldh/qiniu-laravel-storage 这个呢?感觉这个用的更多~

你的域名配置成https试试

我看源码意思是这样,但是我怕配了还是请求http的七牛上传,配置如下
image

@ieras
Copy link
Author

ieras commented Dec 30, 2022

大佬,可否开源一下前端代码啊?

@weiwait
Copy link
Owner

weiwait commented Dec 30, 2022

github仓库中有的

@ieras
Copy link
Author

ieras commented Dec 30, 2022

github仓库中有的

我看都是压缩打包后的前端代码

@weiwait
Copy link
Owner

weiwait commented Dec 30, 2022

github仓库中有的

我看都是压缩打包后的前端代码

https://github.com/weiwait/dcat-vue-frontend

@ieras
Copy link
Author

ieras commented Dec 30, 2022

github仓库中有的

我看都是压缩打包后的前端代码

https://github.com/weiwait/dcat-vue-frontend

谢谢

@ieras
Copy link
Author

ieras commented Dec 30, 2022

七牛这里我改了一下代码,使用laravel内置的获取协议方法确定用http还是http 如果可以一起更新上吧!当然如果有更好的方法那更好一些!辛苦大佬啦

$config = new Config();
                $scheme = request()->server->get('REQUEST_SCHEME');
                $config->useHTTPS = ($scheme=='https');
                $url = $config->getUpHost(
                    config('filesystems.disks.qiniu.access_key'),
                    config('filesystems.disks.qiniu.bucket')
                );

@weiwait
Copy link
Owner

weiwait commented Dec 30, 2022

七牛这里我改了一下代码,使用laravel内置的获取协议方法确定用http还是http 如果可以一起更新上吧!当然如果有更好的方法那更好一些!辛苦大佬啦

$config = new Config();
                $scheme = request()->server->get('REQUEST_SCHEME');
                $config->useHTTPS = ($scheme=='https');
                $url = $config->getUpHost(
                    config('filesystems.disks.qiniu.access_key'),
                    config('filesystems.disks.qiniu.bucket')
                );

更新了

@ieras
Copy link
Author

ieras commented Jan 1, 2023

Storage::disk('qiniu')->getAdapter()->getUploadToken($request['filename'], 3600);
咱们插件 没使用 zgldh/qiniu-laravel-storage
但是dcat-admin 文档里推荐使用的是 zgldh/qiniu-laravel-storage
这俩会造成冲突,会有如下报错,这应该是和laravel的扩展加载顺序有关

//Call to undefined method zgldh\\QiniuStorage\\QiniuAdapter::getUploadToken()

咱们是直连三方云,就是用到一个获取token的方法,真心建议直接沿用dcat-admin 推荐的那个扩展

Storage::disk('qiniu')->getAdapter()->uploadToken($request['filename'], 3600);

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

2 participants