3d model files detection should be done by the frontend
This commit is contained in:
parent
08ee045eba
commit
e76fdcab6c
@ -175,9 +175,6 @@ func (i *FileInfo) detectType(modify, saveContent bool) error {
|
|||||||
case strings.HasPrefix(mimetype, "image"):
|
case strings.HasPrefix(mimetype, "image"):
|
||||||
i.Type = "image"
|
i.Type = "image"
|
||||||
return nil
|
return nil
|
||||||
case is3DModelFile(i.Extension):
|
|
||||||
i.Type = "3dobject"
|
|
||||||
return nil
|
|
||||||
case isBinary(buffer[:n], n) || i.Size > 10*1024*1024: // 10 MB
|
case isBinary(buffer[:n], n) || i.Size > 10*1024*1024: // 10 MB
|
||||||
i.Type = "blob"
|
i.Type = "blob"
|
||||||
return nil
|
return nil
|
||||||
@ -202,21 +199,6 @@ func (i *FileInfo) detectType(modify, saveContent bool) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func is3DModelFile(ext string) bool {
|
|
||||||
switch strings.ToLower(ext) {
|
|
||||||
case
|
|
||||||
".obj",
|
|
||||||
".json",
|
|
||||||
".stl",
|
|
||||||
".dae",
|
|
||||||
".ply",
|
|
||||||
".fbx",
|
|
||||||
".gltf":
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (i *FileInfo) detectSubtitles() {
|
func (i *FileInfo) detectSubtitles() {
|
||||||
if i.Type != "video" {
|
if i.Type != "video" {
|
||||||
return
|
return
|
||||||
|
|||||||
@ -38,7 +38,7 @@
|
|||||||
<template v-if="!loading">
|
<template v-if="!loading">
|
||||||
<div class="preview">
|
<div class="preview">
|
||||||
<ExtendedImage v-if="req.type == 'image'" :src="raw"></ExtendedImage>
|
<ExtendedImage v-if="req.type == 'image'" :src="raw"></ExtendedImage>
|
||||||
<ThreeViewer v-else-if="req.type == '3dobject'" :src="raw"></ThreeViewer>
|
<ThreeViewer v-else-if="is3DModelFile(req)" :src="raw"></ThreeViewer>
|
||||||
<audio v-else-if="req.type == 'audio'" :src="raw" autoplay controls></audio>
|
<audio v-else-if="req.type == 'audio'" :src="raw" autoplay controls></audio>
|
||||||
<video v-else-if="req.type == 'video'" :src="raw" autoplay controls>
|
<video v-else-if="req.type == 'video'" :src="raw" autoplay controls>
|
||||||
<track
|
<track
|
||||||
@ -76,7 +76,6 @@ import ExtendedImage from './ExtendedImage'
|
|||||||
import ThreeViewer from './ThreeViewer'
|
import ThreeViewer from './ThreeViewer'
|
||||||
|
|
||||||
const mediaTypes = [
|
const mediaTypes = [
|
||||||
"3dobject",
|
|
||||||
"image",
|
"image",
|
||||||
"video",
|
"video",
|
||||||
"audio",
|
"audio",
|
||||||
@ -234,6 +233,9 @@ export default {
|
|||||||
},
|
},
|
||||||
toggleSize () {
|
toggleSize () {
|
||||||
this.fullSize = !this.fullSize
|
this.fullSize = !this.fullSize
|
||||||
|
},
|
||||||
|
is3DModelFile (req) {
|
||||||
|
return ThreeViewer.methods.is3DModelFile(req)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,8 @@ import { mapState } from 'vuex'
|
|||||||
import url from '@/utils/url'
|
import url from '@/utils/url'
|
||||||
import { baseURL } from '@/utils/constants'
|
import { baseURL } from '@/utils/constants'
|
||||||
|
|
||||||
|
const ThreeDModelExtRegExp = new RegExp(/\.(obj|stl|dae|ply|fbx|gltf)$/);
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
ModelCollada,
|
ModelCollada,
|
||||||
@ -56,6 +58,9 @@ export default {
|
|||||||
this.rotating = true
|
this.rotating = true
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
is3DModelFile (req) {
|
||||||
|
return ThreeDModelExtRegExp.test(req.extension);
|
||||||
|
},
|
||||||
onLoad () {
|
onLoad () {
|
||||||
this.loadingPreview = false
|
this.loadingPreview = false
|
||||||
this.rotate();
|
this.rotate();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user