diff --git a/spring-cloud-starter/src/main/java/com/jmsoftware/maf/springcloudstarter/controller/RedirectController.java b/spring-cloud-starter/src/main/java/com/jmsoftware/maf/springcloudstarter/controller/RedirectController.java index 24763dfb..a9432ae8 100644 --- a/spring-cloud-starter/src/main/java/com/jmsoftware/maf/springcloudstarter/controller/RedirectController.java +++ b/spring-cloud-starter/src/main/java/com/jmsoftware/maf/springcloudstarter/controller/RedirectController.java @@ -33,7 +33,7 @@ private void postConstruct() { @ApiOperation(value = "/home", notes = "Home page") public void handleHomeRequest(HttpServletResponse response) throws IOException { // Redirect to home page - response.sendRedirect("static/home.html"); + response.sendRedirect("static/home/index.html"); } @GetMapping("/doc") @@ -47,6 +47,6 @@ public void handleDocRequest(HttpServletResponse response) throws IOException { @ApiOperation(value = "/webjars/bycdao-ui/images/api.ico", notes = "Favicon redirection") public void handleFaviconRequest(HttpServletResponse response) throws IOException { // Redirect to a customized favicon - response.sendRedirect("/static/icon/favicon.ico"); + response.sendRedirect("/static/asset/favicon.ico"); } } diff --git a/spring-cloud-starter/src/main/java/com/jmsoftware/maf/springcloudstarter/minio/MinioHelper.java b/spring-cloud-starter/src/main/java/com/jmsoftware/maf/springcloudstarter/minio/MinioHelper.java index bdd194b1..ac21cab5 100644 --- a/spring-cloud-starter/src/main/java/com/jmsoftware/maf/springcloudstarter/minio/MinioHelper.java +++ b/spring-cloud-starter/src/main/java/com/jmsoftware/maf/springcloudstarter/minio/MinioHelper.java @@ -218,7 +218,8 @@ public String getPresignedObjectUrl(@NotBlank String bucket, @NotBlank String ob @SneakyThrows public ObjectWriteResponse composeObject(@NotBlank String bucket, @NotBlank String object, - @NotEmpty List sources,@Nullable Map headers) { + @NotEmpty List sources, + @Nullable Map headers) { if (!this.bucketExists(bucket)) { return null; } diff --git a/universal-ui/src/main/resources/static/icon/favicon.ico b/universal-ui/src/main/resources/static/asset/favicon.ico similarity index 100% rename from universal-ui/src/main/resources/static/icon/favicon.ico rename to universal-ui/src/main/resources/static/asset/favicon.ico diff --git a/universal-ui/src/main/resources/static/image/muscle-and-fitness-server-social-image.png b/universal-ui/src/main/resources/static/asset/muscle-and-fitness-server-social-image.png similarity index 100% rename from universal-ui/src/main/resources/static/image/muscle-and-fitness-server-social-image.png rename to universal-ui/src/main/resources/static/asset/muscle-and-fitness-server-social-image.png diff --git a/universal-ui/src/main/resources/static/style/home.css b/universal-ui/src/main/resources/static/home/index.css similarity index 100% rename from universal-ui/src/main/resources/static/style/home.css rename to universal-ui/src/main/resources/static/home/index.css diff --git a/universal-ui/src/main/resources/static/home.html b/universal-ui/src/main/resources/static/home/index.html similarity index 92% rename from universal-ui/src/main/resources/static/home.html rename to universal-ui/src/main/resources/static/home/index.html index 3ebba95f..57076e1e 100644 --- a/universal-ui/src/main/resources/static/home.html +++ b/universal-ui/src/main/resources/static/home/index.html @@ -4,8 +4,8 @@ UNSET - - + +
@@ -18,7 +18,7 @@ {{ applicationName }} + src="../asset/muscle-and-fitness-server-social-image.png">
Create New Person @@ -74,5 +74,5 @@ - + diff --git a/universal-ui/src/main/resources/static/script/home.js b/universal-ui/src/main/resources/static/home/index.js similarity index 100% rename from universal-ui/src/main/resources/static/script/home.js rename to universal-ui/src/main/resources/static/home/index.js diff --git a/universal-ui/src/main/resources/static/large-file-upload/index.css b/universal-ui/src/main/resources/static/large-file-upload/index.css new file mode 100644 index 00000000..7843e6ac --- /dev/null +++ b/universal-ui/src/main/resources/static/large-file-upload/index.css @@ -0,0 +1,72 @@ +* { + box-sizing: border-box; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; +} + +body { + font-family: 'Montserrat', sans-serif; + background: #535c68; +} + +.wrapper { + margin: auto; + max-width: 640px; + padding-top: 60px; + text-align: center; +} + +.container { + background-color: #f9f9f9; + padding: 20px; + border-radius: 10px; + /*border: 0.5px solid rgba(130, 130, 130, 0.25);*/ + /*box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1), + 0 0 0 1px rgba(0, 0, 0, 0.1);*/ +} + +h1 { + color: #130f40; + font-family: 'Varela Round', sans-serif; + letter-spacing: -.5px; + font-weight: 700; + padding-bottom: 10px; +} + +.upload-container { + background-color: rgb(239, 239, 239); + border-radius: 6px; + padding: 10px; +} + +.border-container { + border: 5px dashed rgba(198, 198, 198, 0.65); + /* border-radius: 4px; */ + padding: 20px; +} + +.border-container p { + color: #130f40; + font-weight: 600; + font-size: 1.1em; + letter-spacing: -1px; + margin-top: 30px; + margin-bottom: 0; + opacity: 0.65; +} + +#file-browser { + text-decoration: none; + color: rgb(22,42,255); + border-bottom: 3px dotted rgba(22, 22, 255, 0.85); +} + +#file-browser:hover { + color: rgb(0, 0, 255); + border-bottom: 3px dotted rgba(0, 0, 255, 0.85); +} + +.icons { + color: #95afc0; + opacity: 0.55; +} diff --git a/universal-ui/src/main/resources/static/large-file-upload/index.html b/universal-ui/src/main/resources/static/large-file-upload/index.html new file mode 100644 index 00000000..2a28a0de --- /dev/null +++ b/universal-ui/src/main/resources/static/large-file-upload/index.html @@ -0,0 +1,33 @@ + + + + + Large File Upload Demo + + + + + +
+
+
+

Upload a file

+
+
+
+ + + +
+ +

Drag and drop files here, or browse your computer.

+
+
+
+
+
+ + + + + diff --git a/universal-ui/src/main/resources/static/large-file-upload/index.js b/universal-ui/src/main/resources/static/large-file-upload/index.js new file mode 100644 index 00000000..5e756d83 --- /dev/null +++ b/universal-ui/src/main/resources/static/large-file-upload/index.js @@ -0,0 +1,85 @@ +// 64 megabytes +const BYTES_PER_CHUNK = 64 * 1048576 +// noinspection JSUnresolvedFunction +new Vue({ + el: '#app', + data: { + appInfo: null, + videoSource: '', + split: window.location.href.split('/') + }, + methods: { + async onFilePicked(event) { + const files = event.target.files + const blob = files[0] + console.info('blob', blob) + let startByte = 0 + let endByte = 0 + let index = 0 + const slices = Math.ceil(blob.size / BYTES_PER_CHUNK) + const uploadResourceChunkPayload = { + bucket: '', + filename: blob.name + } + const objectList = [] + while (startByte < blob.size) { + endByte = startByte + BYTES_PER_CHUNK + if (endByte > blob.size) { + endByte = blob.size + } + const response = await this.uploadResourceChunk(blob, index, startByte, endByte, uploadResourceChunkPayload) + objectList.push(response.data.object) + console.info('response', response) + if (index === 0) { + uploadResourceChunkPayload.bucket = response.data.bucket + console.warn('Set uploadResourceChunkPayload', uploadResourceChunkPayload) + } + startByte = endByte + index++ + if (index >= slices) { + if (slices === 1) { + console.error(`The slices count is ${slices}, should not be Uploaded by chunk`) + } + console.info(`Finished uploading all chunks. index >= slices. index = ${index}, slice = ${slices}`); + const mergeResponse = await this.mergeResourceChunk(uploadResourceChunkPayload.bucket, objectList); + console.info('Finished merging all chunks', mergeResponse); + } + } + }, + async uploadResourceChunk(blob, index, start, end, uploadResourceChunkPayload) { + console.info(`uploadFile blog: ${blob}, index: ${index}, start: ${start}, end: ${end}, uploadResourceChunkPayload: `, uploadResourceChunkPayload) + const formData = new FormData() + formData.append('bucket', uploadResourceChunkPayload.bucket) + formData.append('chunkNumber', index) + formData.append('filename', uploadResourceChunkPayload.filename) + formData.append('file', blob.slice(start, end)) + const url = `${this.split[0]}//${this.split[2]}/upload/chunk` + const resp = await fetch(url, { + method: 'POST', + body: formData, + headers: { + 'Content-Disposition': `form-data; name="file"; filename="${blob.name}"` + } + }) + return await resp.json() + }, + async mergeResourceChunk(bucket, objectList) { + const mergeResourcePayload = { + 'bucket': bucket, + 'objectList': objectList + } + const url = `${this.split[0]}//${this.split[2]}/merge/chunk` + const resp = await fetch(url, { + method: 'PUT', + body: JSON.stringify(mergeResourcePayload), + headers: { + 'Content-Type': 'application/json' + } + }) + return await resp.json() + } + }, + mounted() { + console.log('mounted') + } +}); diff --git a/universal-ui/src/main/resources/static/script/404.js b/universal-ui/src/main/resources/static/script/404.js deleted file mode 100644 index 5401ce54..00000000 --- a/universal-ui/src/main/resources/static/script/404.js +++ /dev/null @@ -1,12 +0,0 @@ -// noinspection JSUnusedGlobalSymbols -const vm = new Vue({ - el: '#app', - data: {}, - methods: { - handleClickGoToHome: function () { - const currentUrl = window.location.href; - const split = currentUrl.split('/'); - window.location.href = `${split[0]}//${split[2]}/${split[3]}`; - } - } -}); diff --git a/universal-ui/src/main/resources/static/style/404.css b/universal-ui/src/main/resources/static/style/404.css deleted file mode 100644 index 09a4e9bc..00000000 --- a/universal-ui/src/main/resources/static/style/404.css +++ /dev/null @@ -1,89 +0,0 @@ -* { - margin: 0; - padding: 0; - box-sizing: border-box -} - -html { - font-size: 12px; - font-family: Ubuntu, simHei, sans-serif; - font-weight: 400 -} - -body { - font-size: 1rem -} - -button { - outline: none; - padding: 5px 8px; - color: #fff; - border: 1px solid #BCBCBC; - border-radius: 3px; - background-color: #009A61; - cursor: pointer; -} - -button:hover { - opacity: 0.8; -} - -#app { - margin: 48px auto 0; - max-width: 640px; - -webkit-perspective: 500px; -} - -.text-center { - text-align: center; -} - -.message-box { - background-color: firebrick; - max-width: 700px; - padding: 20px; - border-radius: 8px; - margin: 48px auto 20px; -} - -.slide-in-bck-center { - animation: slide-in-bck-center 1.2s cubic-bezier(0.250, 0.460, 0.450, 0.940) both; -} - -@keyframes slide-in-bck-center { - 0% { - transform: translateZ(600px); - opacity: 0; - } - 100% { - transform: translateZ(0); - opacity: 1; - } -} - -.message-text { - font-size: xx-large; - text-align: center; - color: ivory; -} - -.social-image { - width: 600px; - border-radius: 8px; -} - -.message-title { - text-align: center; - display: block; - font-size: 48px; - text-shadow: black 2px 2px 6px; -} - -.server-name { - color: gold; -} - -.go-to { - display: inline-block; - margin-bottom: 6px; -} diff --git a/universal-ui/src/main/resources/static/style/video.css b/universal-ui/src/main/resources/static/video/index.css similarity index 100% rename from universal-ui/src/main/resources/static/style/video.css rename to universal-ui/src/main/resources/static/video/index.css diff --git a/universal-ui/src/main/resources/static/video.html b/universal-ui/src/main/resources/static/video/index.html similarity index 83% rename from universal-ui/src/main/resources/static/video.html rename to universal-ui/src/main/resources/static/video/index.html index 8377d095..a4a85380 100644 --- a/universal-ui/src/main/resources/static/video.html +++ b/universal-ui/src/main/resources/static/video/index.html @@ -4,8 +4,8 @@ ExRx.net Crawler Server - - + +
@@ -21,5 +21,5 @@
- + diff --git a/universal-ui/src/main/resources/static/script/video.js b/universal-ui/src/main/resources/static/video/index.js similarity index 83% rename from universal-ui/src/main/resources/static/script/video.js rename to universal-ui/src/main/resources/static/video/index.js index 3a155900..e2cf00d2 100644 --- a/universal-ui/src/main/resources/static/script/video.js +++ b/universal-ui/src/main/resources/static/video/index.js @@ -6,8 +6,7 @@ const vm = new Vue({ videoSource: '' }, async mounted() { - const currentUrl = window.location.href; - const split = currentUrl.split('/'); + const split = window.location.href.split('/'); this.videoSource = `${split[0]}//${split[2]}/${split[3]}/test-table/demo-video`; const baseUrl = `${split[0]}//${split[2]}`; const response = await fetch(`${baseUrl}/common/app-info`); diff --git a/universal-ui/src/main/resources/static/style/websocket.css b/universal-ui/src/main/resources/static/websocket/index.css similarity index 100% rename from universal-ui/src/main/resources/static/style/websocket.css rename to universal-ui/src/main/resources/static/websocket/index.css diff --git a/universal-ui/src/main/resources/static/websocket.html b/universal-ui/src/main/resources/static/websocket/index.html similarity index 94% rename from universal-ui/src/main/resources/static/websocket.html rename to universal-ui/src/main/resources/static/websocket/index.html index a9a476e0..5b476ba0 100644 --- a/universal-ui/src/main/resources/static/websocket.html +++ b/universal-ui/src/main/resources/static/websocket/index.html @@ -3,7 +3,7 @@ Spring Boot WebSocket Chat Application | CalliCoder - +