1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

Added freeCAD files as default allowed extensions

also: refactored some ruby code
This commit is contained in:
Sylvain 2019-11-25 16:12:23 +01:00
parent 68b17cbe9a
commit 48b811d2b5
6 changed files with 20 additions and 31 deletions

View File

@ -12,6 +12,7 @@
- Calendar management: improved legend style
- Handle Ctrl^C in upgrade scripts
- Updated moment-timezone
- Added freeCAD files as default allowed extensions
- Fix a bug: unable to remove the picture from a training
- Fix a security issue: updated loofah to fix [CVE-2019-15587](https://github.com/advisories/GHSA-c3gv-9cxf-6f57)
- Fix a security issue: updated angular to 1.7.9 to fix [CVE-2019-10768](https://github.com/advisories/GHSA-89mq-4x47-5v83)

View File

@ -1,4 +1,9 @@
# frozen_string_literal: true
# Main image for project documentation
class ProjectImage < Asset
include ImageValidatorConcern
mount_uploader :attachment, ProjectImageUploader
validates :attachment, file_mime_type: { content_type: /image/ }
end

View File

@ -1,4 +1,9 @@
# frozen_string_literal: true
# Images for the documentation of a project step
class ProjectStepImage < Asset
include ImageValidatorConcern
mount_uploader :attachment, ProjectImageUploader
validates :attachment, file_mime_type: { content_type: /image/ }
end

View File

@ -1,16 +1,14 @@
# frozen_string_literal: true
# CarrierWave uploader for project image.
# This file defines the parameters for these uploads.
class ProjectImageUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
# include CarrierWave::RMagick
include CarrierWave::MiniMagick
include UploadHelper
# Choose what kind of storage to use for this uploader:
storage :file
after :remove, :delete_empty_dirs
# storage :fog
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
"#{base_store_dir}/#{model.id}"
@ -20,38 +18,18 @@ class ProjectImageUploader < CarrierWave::Uploader::Base
"uploads/#{model.class.to_s.underscore}"
end
# Provide a default URL as a default if there hasn't been a file uploaded:
# def default_url
# # For Rails 3.1+ asset pipeline compatibility:
# # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
#
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
# end
# Process files as they are uploaded:
# process :scale => [200, 300]
#
# def scale(width, height)
# # do something
# end
# Create different versions of your uploaded files:
# version :normal do
# process :resize_to_fit => [312, 270]
# end
version :large do
process :resize_to_fit => [1000, 700]
process resize_to_fit: [1000, 700]
end
version :medium do
process :resize_to_fit => [700, 400]
process resize_to_fit: [700, 400]
end
# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
def extension_white_list
%w(jpg jpeg gif png)
%w[jpg jpeg gif png]
end
# Override the filename of the uploaded files:

View File

@ -91,7 +91,7 @@ LOG_LEVEL: 'debug'
DISK_SPACE_MB_ALERT: '100'
SUPERADMIN_EMAIL: 'admin@sleede.com'
ALLOWED_EXTENSIONS: pdf ai eps cad math svg stl dxf dwg obj step iges igs 3dm 3dmf doc docx png ino scad fcad skp sldprt sldasm slddrw slddrt tex latex ps
ALLOWED_EXTENSIONS: pdf ai eps cad math svg stl dxf dwg obj step iges igs 3dm 3dmf doc docx png ino scad fcad skp sldprt sldasm slddrw slddrt tex latex ps fcstd fcstd1
ALLOWED_MIME_TYPES: application/pdf application/postscript application/illustrator image/x-eps image/svg+xml application/sla application/dxf application/acad application/dwg application/octet-stream application/step application/iges model/iges x-world/x-3dmf application/vnd.openxmlformats-officedocument.wordprocessingml.document image/png text/x-arduino text/plain application/scad application/vnd.sketchup.skp application/x-koan application/vnd-koan koan/x-skm application/vnd.koan application/x-tex application/x-latex
# 5242880 = 5 megabytes

View File

@ -76,7 +76,7 @@ DISK_SPACE_MB_ALERT='100'
SUPERADMIN_EMAIL='admin@sleede.com'
ALLOWED_EXTENSIONS=pdf ai eps cad math svg stl dxf dwg obj step iges igs 3dm 3dmf doc docx png ino scad fcad skp sldprt sldasm slddrw slddrt tex latex ps
ALLOWED_EXTENSIONS=pdf ai eps cad math svg stl dxf dwg obj step iges igs 3dm 3dmf doc docx png ino scad fcad skp sldprt sldasm slddrw slddrt tex latex ps fcstd fcstd1
ALLOWED_MIME_TYPES=application/pdf application/postscript application/illustrator image/x-eps image/svg+xml application/sla application/dxf application/acad application/dwg application/octet-stream application/step application/iges model/iges x-world/x-3dmf application/ application/vnd.openxmlformats-officedocument.wordprocessingml.document image/png text/x-arduino text/plain application/scad application/vnd.sketchup.skp application/x-koan application/vnd-koan koan/x-skm application/vnd.koan application/x-tex application/x-latex
# 5242880 = 5 megabytes