weiwait / dcat-vue

dcat-admin's extension that was build in one package with vue
31 stars 8 forks source link

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

Open ieras opened 1 year ago

ieras commented 1 year ago

如下: 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 commented 1 year ago

如下: 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 commented 1 year ago

如下: 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 commented 1 year ago

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

weiwait commented 1 year ago

github仓库中有的

ieras commented 1 year ago

github仓库中有的

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

weiwait commented 1 year ago

github仓库中有的

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

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

ieras commented 1 year ago

github仓库中有的

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

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

谢谢

ieras commented 1 year ago

七牛这里我改了一下代码,使用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 commented 1 year ago

七牛这里我改了一下代码,使用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 commented 1 year ago

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);