mirror of
https://gitea.com/gitea/docs.git
synced 2025-06-15 22:13:54 +00:00
Fix CAD Files Preview section (#200)
CAD Preview section is broken on live website (bad markup usage). Hopefully fixed it :D Thanks a lot Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-on: https://gitea.com/gitea/docs/pulls/200 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: recoolcz <petrvanek31@gmail.com> Co-committed-by: recoolcz <petrvanek31@gmail.com>
This commit is contained in:
@ -172,15 +172,16 @@ You can implement your own CAD file viewer inside your Gitea instance.
|
||||
This implementation supports 3D preview for of these file formats:
|
||||
'3dm', '3ds', '3mf', 'amf', 'bim', 'brep', 'dae', 'fbx', 'fcstd', 'glb',
|
||||
'gltf', 'ifc', 'igs', 'iges', 'stp', 'step', 'stl', 'obj', 'off', 'ply', 'wrl'
|
||||
(Only v2 for .gltf files)
|
||||
|
||||
|
||||
Add template
|
||||
Part 1: Add template
|
||||
|
||||
In $GITEA_CUSTOM we need to add our template.
|
||||
This template needs to be saved in "$GITEA_CUSTOM/templates/custom/".
|
||||
Here create file "footer.tmpl" and add following text into it:
|
||||
|
||||
```<script>
|
||||
```
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
// Supported 3D file types
|
||||
const fileTypes = ['3dm', '3ds', '3mf', 'amf', 'bim', 'brep', 'dae', 'fbx', 'fcstd', 'glb', 'gltf', 'ifc', 'igs', 'iges', 'step', 'stl', 'obj', 'off', 'ply', 'wrl'];
|
||||
@ -238,39 +239,44 @@ Here create file "footer.tmpl" and add following text into it:
|
||||
```
|
||||
|
||||
|
||||
Add public files
|
||||
Part 2: Add public files
|
||||
|
||||
Now we need to download latest version of O3DV. Go to "$GITEA_CUSTOM/public/assets/".
|
||||
Create folder using (and cd into it):
|
||||
|
||||
```mkdir o3dv
|
||||
```
|
||||
mkdir o3dv
|
||||
cd o3dv
|
||||
```
|
||||
|
||||
Copy latest release zip link from [`GitHub`](https://github.com/kovacsv/Online3DViewer/releases) (v0.15.0 as of now).
|
||||
Here use e.g. wget to download the file:
|
||||
```wget https://github.com/kovacsv/Online3DViewer/releases/download/0.15.0/o3dv.zip
|
||||
```
|
||||
wget https://github.com/kovacsv/Online3DViewer/releases/download/0.15.0/o3dv.zip
|
||||
```
|
||||
|
||||
Use e.g. unzip to unzip the archive:
|
||||
```unzip o3dv.zip
|
||||
```
|
||||
unzip o3dv.zip
|
||||
```
|
||||
|
||||
|
||||
Folder permissions
|
||||
Part 3: Folder permissions
|
||||
|
||||
Now the last thing. Change permissions on the "footer.tmpl":
|
||||
```chown git:git $GITEA_CUSTOM/templates/custom/footer.tmpl
|
||||
```
|
||||
chown git:git $GITEA_CUSTOM/templates/custom/footer.tmpl
|
||||
chmod 770 $GITEA_CUSTOM/templates/custom/footer.tmpl
|
||||
```
|
||||
|
||||
And on the public folder:
|
||||
```chown -R git:git $GITEA_CUSTOM/public
|
||||
```
|
||||
chown -R git:git $GITEA_CUSTOM/public
|
||||
```
|
||||
|
||||
Now we have everything ready! Restart you gitea instance to apply these changes and you can test it in your browser.
|
||||
Now we have everything ready! Restart you gitea instance to apply these changes and test it in your browser.
|
||||
|
||||
You should end-up with a folder structure similar to:
|
||||
You should end-up with a folder structure similar to this:
|
||||
|
||||
```
|
||||
$GITEA_CUSTOM/templates
|
||||
|
Reference in New Issue
Block a user