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