2021-03-11 19:13:27 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-11-03 12:29:30 +05:30
|
|
|
scope path: :uploads do
|
2021-11-18 22:05:49 +05:30
|
|
|
# Note attachments and User/Group/Project/Topic avatars
|
2017-09-10 17:25:29 +05:30
|
|
|
get "-/system/:model/:mounted_as/:id/:filename",
|
2022-08-27 11:52:29 +05:30
|
|
|
to: "uploads#show",
|
2023-03-17 16:20:25 +05:30
|
|
|
constraints: { model: %r{note|user|group|project|projects\/topic|achievements\/achievement}, mounted_as: /avatar|attachment/, filename: %r{[^/]+} }
|
2016-11-03 12:29:30 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
# show uploads for models, snippets (notes) available for now
|
2017-09-10 17:25:29 +05:30
|
|
|
get '-/system/:model/:id/:secret/:filename',
|
2017-08-17 22:00:37 +05:30
|
|
|
to: 'uploads#show',
|
2019-07-07 11:18:12 +05:30
|
|
|
constraints: { model: /personal_snippet|user/, id: /\d+/, filename: %r{[^/]+} }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
# show temporary uploads
|
|
|
|
get '-/system/temp/:secret/:filename',
|
|
|
|
to: 'uploads#show',
|
2018-03-17 18:26:18 +05:30
|
|
|
constraints: { filename: %r{[^/]+} }
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2016-11-03 12:29:30 +05:30
|
|
|
# Appearance
|
2017-09-10 17:25:29 +05:30
|
|
|
get "-/system/:model/:mounted_as/:id/:filename",
|
2022-08-27 11:52:29 +05:30
|
|
|
to: "uploads#show",
|
2023-03-17 16:20:25 +05:30
|
|
|
constraints: { model: /appearance/, mounted_as: /logo|header_logo|pwa_icon|favicon/, filename: /.+/ },
|
2019-02-15 15:39:39 +05:30
|
|
|
as: 'appearance_upload'
|
2016-11-03 12:29:30 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
# create uploads for models, snippets (notes) available for now
|
2017-09-10 17:25:29 +05:30
|
|
|
post ':model',
|
2017-08-17 22:00:37 +05:30
|
|
|
to: 'uploads#create',
|
2019-07-07 11:18:12 +05:30
|
|
|
constraints: { model: /personal_snippet|user/, id: /\d+/ },
|
2017-08-17 22:00:37 +05:30
|
|
|
as: 'upload'
|
2019-09-04 21:01:54 +05:30
|
|
|
|
|
|
|
post ':model/authorize',
|
|
|
|
to: 'uploads#authorize',
|
|
|
|
constraints: { model: /personal_snippet|user/ }
|
2022-06-21 17:19:12 +05:30
|
|
|
|
|
|
|
# Alert Metric Images
|
|
|
|
get "-/system/:model/:mounted_as/:id/:filename",
|
2022-08-27 11:52:29 +05:30
|
|
|
to: "uploads#show",
|
|
|
|
constraints: { model: /alert_management_metric_image/, mounted_as: /file/, filename: %r{[^/]+} },
|
2022-06-21 17:19:12 +05:30
|
|
|
as: 'alert_metric_image_upload'
|
2016-11-03 12:29:30 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
# Redirect old note attachments path to new uploads path.
|
|
|
|
get "files/note/:id/:filename",
|
2022-08-27 11:52:29 +05:30
|
|
|
to: redirect("uploads/note/attachment/%{id}/%{filename}"),
|
|
|
|
constraints: { filename: %r{[^/]+} }
|