Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide configuration to allow camo-media proxying #12802

Merged
merged 13 commits into from
Mar 29, 2022

Conversation

zeripath
Copy link
Contributor

@zeripath zeripath commented Sep 10, 2020

Provide configuration to switch on camouflaging of images by capturing and replacing all <img src="..."> attributes with camouflaged urls.

Fix #916

Signed-off-by: Andrew Thornton art27@cantab.net

@zeripath zeripath added the pr/wip This PR is not ready for review label Sep 10, 2020
Fix go-gitea#916

Signed-off-by: Andrew Thornton <art27@cantab.net>
@codecov-commenter
Copy link

Codecov Report

Merging #12802 into master will decrease coverage by 0.01%.
The diff coverage is 11.11%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #12802      +/-   ##
==========================================
- Coverage   43.23%   43.21%   -0.02%     
==========================================
  Files         650      651       +1     
  Lines       72048    72119      +71     
==========================================
+ Hits        31150    31168      +18     
- Misses      35852    35904      +52     
- Partials     5046     5047       +1     
Impacted Files Coverage Δ
modules/markup/camo.go 0.00% <0.00%> (ø)
modules/markup/html.go 77.60% <0.00%> (-0.75%) ⬇️
modules/setting/setting.go 47.84% <100.00%> (+0.22%) ⬆️
modules/indexer/stats/queue.go 64.70% <0.00%> (-11.77%) ⬇️
modules/auth/ldap/ldap.go 46.81% <0.00%> (-8.79%) ⬇️
modules/indexer/stats/db.go 43.47% <0.00%> (-8.70%) ⬇️
modules/charset/charset.go 68.53% <0.00%> (-4.50%) ⬇️
modules/queue/workerpool.go 58.77% <0.00%> (-1.23%) ⬇️
modules/log/event.go 56.60% <0.00%> (-0.95%) ⬇️
routers/repo/view.go 37.47% <0.00%> (-0.65%) ⬇️
... and 17 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 33ac0cc...742d357. Read the comment docs.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Sep 10, 2020
@zeripath
Copy link
Contributor Author

This will need testing to ensure that I've created this correctly and that it is doing the correct thing.

One of the things that would be good is if we could camo media urls for images stored on gitea itself however there is an issue with permissions which makes the whole thing a bit more complex.

@stale
Copy link

stale bot commented Nov 9, 2020

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 months. Thank you for your contributions.

@stale stale bot added the issue/stale label Nov 9, 2020
modules/markup/html.go Outdated Show resolved Hide resolved
@stale stale bot removed the issue/stale label May 1, 2021
modules/markup/html.go Outdated Show resolved Hide resolved
@6543 6543 added this to the 1.17.0 milestone Mar 29, 2022
@6543 6543 added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Mar 29, 2022
@6543
Copy link
Member

6543 commented Mar 29, 2022

a smal unit test would be nice ...

... I'll have a look at this

@6543 6543 self-assigned this Mar 29, 2022
@6543 6543 force-pushed the fix-916-go-camo-media-proxy branch from 8ff8a01 to 3285a32 Compare March 29, 2022 02:18
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Mar 29, 2022
@6543 6543 requested a review from lunny March 29, 2022 02:28
@6543 6543 removed the pr/wip This PR is not ready for review label Mar 29, 2022
@GiteaBot GiteaBot removed the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Mar 29, 2022
@GiteaBot GiteaBot added the lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. label Mar 29, 2022
custom/conf/app.example.ini Outdated Show resolved Hide resolved
@wxiaoguang
Copy link
Contributor

wxiaoguang commented Mar 29, 2022

Is it a general mechanism and does it benefit most users? (maybe it's fine to protect privacy)

After reading the context, I found the camo https://github.com/atmos/camo was dead since 2017 ...... do we really need to support outdated systems? Hmm, https://github.com/cactus/go-camo is a successor.

I would like to keep Gitea itself clear and simple (indeed, not too complex) ..... if the method is general, it's fine to me.

modules/markup/camo.go Outdated Show resolved Hide resolved
@6543
Copy link
Member

6543 commented Mar 29, 2022

👋

@6543 6543 merged commit 97625b4 into go-gitea:main Mar 29, 2022
Codeberg-org pushed a commit to Codeberg-org/gitea that referenced this pull request Mar 29, 2022
* Provide configuration to allow camo-media proxying

Fix go-gitea#916

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
zjjhot added a commit to zjjhot/gitea that referenced this pull request Mar 30, 2022
* giteaoffical/main: (31 commits)
  Add Package Registry (go-gitea#16510)
  Show messages for users if the ROOT_URL is wrong, show JavaScript errors (go-gitea#18971)
  [skip ci] Updated translations via Crowdin
  Make git.OpenRepository accept Context (go-gitea#19260)
  Use full output of git show-ref --tags to get tags for PushUpdateAddTag (go-gitea#19235)
  When conflicts have been previously detected ensure that they can be resolved (go-gitea#19247)
  More commit info from API (go-gitea#19252)
  Move some issue methods as functions (go-gitea#19255)
  Move project files into models/project sub package (go-gitea#17704)
  Granular webhook events in editHook (go-gitea#19251)
  Provide configuration to allow camo-media proxying (go-gitea#12802)
  Move init repository related functions to modules (go-gitea#19159)
  Move organization related structs into sub package (go-gitea#18518)
  Refactor repo clone button and repo clone links, fix JS error on empty repo page (go-gitea#19208)
  Show last cron messages on monitor page (go-gitea#19223)
  Allow API to create file on empty repo (go-gitea#19224)
  Use goproxy.io instead of goproxy.cn (go-gitea#19242)
  New cron task: delete old system notices (go-gitea#19219)
  Let web and API routes have different auth methods group (go-gitea#19168)
  Only send webhook events to active system webhooks and only deliver to active hooks (go-gitea#19234)
  ...
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
@zeripath zeripath deleted the fix-916-go-camo-media-proxy branch December 29, 2022 19:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mixed-content issues
7 participants