1.MinIO上传添加content type

2.KindEditor异步刷新vue组件值


Former-commit-id: 11e69fca7ce94c8580437ee3b842a8bdaaef085f
Former-commit-id: 8aa86bcda0a361eb98356f8c5681839b86b3c3df
TSXN
wanggang 5 years ago
parent 7d5572d932
commit c790b4bb5b

@ -2,15 +2,16 @@ using Infrastructure.Extensions;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.StaticFiles;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Minio; using Minio;
using System; using System;
using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.Net.Http; using System.Net.Http;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Collections.Generic;
namespace Infrastructure.Web.Mvc namespace Infrastructure.Web.Mvc
{ {
@ -96,9 +97,9 @@ namespace Infrastructure.Web.Mvc
private string UploadMinIO(IFormFile file) private string UploadMinIO(IFormFile file)
{ {
using var stream = file.OpenReadStream(); using var stream = file.OpenReadStream();
var ext = GetExtension(file.FileName); var ext = Path.GetExtension(file.FileName);
var md5 = GetFileNameHash(stream); var md5 = GetFileNameHash(stream);
var name = $"{md5}.{ext}"; var name = $"{md5}{ext}";
var endpoint = this._cfg["minio:endpoint"]; var endpoint = this._cfg["minio:endpoint"];
var accessKey = this._cfg["minio:accessKey"]; var accessKey = this._cfg["minio:accessKey"];
var secretKey = this._cfg["minio:secretKey"]; var secretKey = this._cfg["minio:secretKey"];
@ -139,7 +140,8 @@ namespace Infrastructure.Web.Mvc
{ {
ex.PrintStack(); ex.PrintStack();
stream.Position = 0; stream.Position = 0;
minio.PutObjectAsync(bucketName, name, stream, stream.Length); new FileExtensionContentTypeProvider().Mappings.TryGetValue(ext, out string contenttype);
minio.PutObjectAsync(bucketName, name, stream, stream.Length, contenttype);
} }
var path = $"/{bucketName}/{name}"; var path = $"/{bucketName}/{name}";
return $"/dfs{path}"; return $"/dfs{path}";

@ -16,7 +16,10 @@
width: '100%', width: '100%',
allowImageUpload: true, allowImageUpload: true,
uploadJson: vm.uploadUrl, uploadJson: vm.uploadUrl,
formatUploadUrl: false formatUploadUrl: false,
afterChange: function () {
vm.$emit('update:value', this.html());
}
}); });
}, },
computed: { computed: {

@ -31,7 +31,7 @@
</nav> </nav>
<aside class="main-sidebar sidebar-dark-primary elevation-4"> <aside class="main-sidebar sidebar-dark-primary elevation-4">
<a class="brand-link" href="/"> <a class="brand-link" href="/">
<img class="brand-image img-circle elevation-3" :src="data.logo" /> <img class="brand-image img-circle" :src="data.logo" />
<span class="brand-text font-weight-light">{{data.name}}</span> <span class="brand-text font-weight-light">{{data.name}}</span>
</a> </a>
<div class="sidebar" v-if="data.username"> <div class="sidebar" v-if="data.username">
@ -374,8 +374,7 @@
</a>--> </a>-->
</div> </div>
<footer class="main-footer"> <footer class="main-footer">
<strong> <strong v-html="data.copyright.replace('{0}',new Date().getFullYear())">
{{data.copyright.replace('{0}',new Date().getFullYear())}}
</strong> </strong>
<div class="float-right d-none d-sm-inline-block"> <div class="float-right d-none d-sm-inline-block">
<b>version: client-{{version}} server-{{data.version}}</b> <b>version: client-{{version}} server-{{data.version}}</b>

@ -1,4 +1,4 @@
user root; user root;
worker_processes 4; worker_processes 4;
#error_log logs/error.log; #error_log logs/error.log;
#error_log logs/error.log notice; #error_log logs/error.log notice;
@ -12,6 +12,11 @@ events {
http { http {
include mime.types; include mime.types;
default_type application/octet-stream; default_type application/octet-stream;
types {
application/vnd.android.package-archive apk;
application/iphone pxl ipa;
text/plain plist;
}
sendfile on; sendfile on;
keepalive_timeout 65; keepalive_timeout 65;

Loading…
Cancel
Save