Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

add/assets as root dir of public files#15219

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
lunny merged 22 commits intogo-gitea:masterfroma1012112796:assets_dir
Apr 28, 2021

Conversation

@a1012112796
Copy link
Member

@a1012112796a1012112796 commentedMar 31, 2021
edited by zeripath
Loading

This PR moves root directory of public files from/ to/assets

⚠️ BREAKING⚠️

All pages and resources rendered fromcustom/public will now be rendered at/assets instead of/. This means that if you have aimpressum.html - you need to update links to this to/assets/impressum.html. Similarly for users of STL renderers and external markup renderers.

Administrators should check custom templates to ensure that these are correct.

If you have previously placedrobots.txt withincustom/public you must move it tocustom instead.

silverwind reacted with hooray emojilunny reacted with heart emoji
Signed-off-by: a1012112796 <1012112796@qq.com>
@a1012112796a1012112796 added the pr/breakingMerging this PR means builds will break. Needs a description what exactly breaks, and how to fix it! labelMar 31, 2021
@zeripath
Copy link
Contributor

I think this is a great idea - just need to double check that this is all of the things.


I do wonder if we should however migrate our URLs to use a non user name allowed character as the root (and explicitly exclude it in the reserved list for future safety)

RFC 3986 allows the following in segments:

  • [A-Za-z0-9_.-]
  • ~
  • %-encoded chars
  • [!$&'()]
  • @

Although: is allowed in some paths its use in relative paths would be a source of trouble. (Similarly& and@ could be troublesome)

I think of these characters! and~ seem the most likely to be unambiguously internal the trouble is I don't know how it would affect markdown.

@GiteaBotGiteaBot added the lgtm/need 2This PR needs two approvals by maintainers to be considered for merging. labelMar 31, 2021
@silverwind
Copy link
Member

silverwind commentedMar 31, 2021
edited
Loading

I thinkassets is a unlikely name for an organization or user and would just go ahead and reserve it while calling out the change in the release notes.

Is the PR complete? I think after it there should only beassets andserviceworker.js as remaining entriesKnownPublicEntries. I think serviceworker probably has to remain on root because of restrictions on that API which I can't find docs for right now.

@silverwind
Copy link
Member

I think we can put serviceworker.js intoassets/serviceworker.js as per:

https://developers.google.com/web/ilt/pwa/introduction-to-service-worker#registration_and_scope

The scope of the service worker determines which files the service worker controls, in other words, from which path the service worker will intercept requests. The default scope is the location of the service worker file, and extends to all directories below. So if service-worker.js is located in the root directory, the service worker will control requests from all files at this domain.

Meaning the serviceworker is restricted to manage files underassets which is ideal in our case as it should not manage anything else.

@zeripath
Copy link
Contributor

zeripath commentedMar 31, 2021
edited
Loading

I thinkassets is a unlikely name for an organization or user and would just go ahead and reserve it while calling out the change in the release notes.

it's been reserved sinceat least#4685#20

silverwind reacted with hooray emoji

@GiteaBotGiteaBot added lgtm/need 1This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2This PR needs two approvals by maintainers to be considered for merging. labelsMar 31, 2021
@a1012112796
Copy link
MemberAuthor

I think this is a great idea - just need to double check that this is all of the things.

I do wonder if we should however migrate our URLs to use a non user name allowed character as the root (and explicitly exclude it in the reserved list for future safety)

RFC 3986 allows the following in segments:

  • [A-Za-z0-9_.-]
  • ~
  • %-encoded chars
  • [!$&'()]
  • @

Although: is allowed in some paths its use in relative paths would be a source of trouble. (Similarly& and@ could be troublesome)

I think of these characters! and~ seem the most likely to be unambiguously internal the trouble is I don't know how it would affect markdown.

yes, If we want all words are useable user org, or repo name. we should make sure all One or two levels of routing has_ as prefix(like_user/xxxxx,_org/xxxx). But in fact, that's not soo usefull...

@a1012112796
Copy link
MemberAuthor

a1012112796 commentedApr 1, 2021
edited
Loading

suggest remove some reserved words. Please check again. Thanks.

  • admin (It's a meaningfull user name, isn't it? :) )
  • debug (not used)
  • error (not used)
  • help (not used)
  • plugins (not used)
  • template (a not verry usefull router for development, suggest rename to_template)

@lunny
Copy link
Member

suggest remove some reserved words. Please check again. Thanks.

  • admin (It's a meaningfull user name, isn't it? :) )
  • debug (not used)
  • error (not used)
  • ghost (I wonder why ...)
  • help (not used)
  • plugins (not used)
  • template (a not verry usefull router for development, suggest rename to_template)

This could be another PR.

a1012112796 reacted with thumbs up emoji

@noerw
Copy link
Member

suggest remove some reserved words. Please check again. Thanks.

@a1012112796 No, of some I know that they are used, the others should be very thoughly checked.
/admin → admin dashboard
ghost → user name of deleted users

zeripath reacted with thumbs up emoji

@lunnylunny added this to the1.15.0 milestoneApr 2, 2021
@lunny
Copy link
Member

lunny commentedApr 9, 2021
edited
Loading

I think there should be something missing, at least oauth2 login logos. maybe you can search "/img to find more.

@silverwind
Copy link
Member

silverwind commentedApr 9, 2021
edited
Loading

Patch to fix loading of webpack assets (like label color picker image):

diff --git a/webpack.config.js b/webpack.config.jsindex 53d553825..44d50a45e 100644--- a/webpack.config.js+++ b/webpack.config.js@@ -185,17 +185,17 @@ export default {         test: /\.(ttf|woff2?)$/,         type: 'asset/resource',         generator: {           filename: 'fonts/[name][ext]',-          publicPath: '/', // required to remove css/ path segment+          publicPath: '/assets/', // required to remove css/ path segment         }       },       {         test: /\.png$/i,         type: 'asset/resource',         generator: {           filename: 'img/webpack/[name][ext]',-          publicPath: '/', // required to remove css/ path segment+          publicPath: '/assets/', // required to remove css/ path segment         }       },     ],   },

Copy link
Member

@silverwindsilverwind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Hope we didn't miss any. Guess we will find out later if we did.

a1012112796 reacted with eyes emoji
@GiteaBotGiteaBot added lgtm/doneThis PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1This PR needs approval from one additional maintainer to be merged. labelsApr 10, 2021
@codecov-io
Copy link

Codecov Report

Merging#15219 (13bb69b) intomaster (487f2ee) willincrease coverage by1.62%.
The diff coverage is54.99%.

Impacted file tree graph

@@            Coverage Diff             @@##           master   #15219      +/-   ##==========================================+ Coverage   42.21%   43.83%   +1.62%==========================================  Files         767      677      -90       Lines       81624    81339     -285     ==========================================+ Hits        34458    35657    +1199+ Misses      41531    39910    -1621- Partials     5635     5772     +137
Impacted FilesCoverage Δ
cmd/admin.go0.00% <0.00%> (ø)
cmd/dump.go0.93% <0.00%> (-0.01%)⬇️
cmd/hook.go0.00% <0.00%> (ø)
cmd/serv.go2.61% <0.00%> (-0.02%)⬇️
cmd/web.go0.00% <0.00%> (ø)
cmd/web_graceful.go0.00% <0.00%> (ø)
cmd/web_letsencrypt.go0.00% <0.00%> (ø)
models/admin.go60.31% <ø> (ø)
models/branches.go42.61% <ø> (+1.51%)⬆️
models/commit_status.go61.74% <0.00%> (ø)
... and397 more

Continue to review full report at Codecov.

Legend -Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered byCodecov. Last updated42509a...13bb69b. Read thecomment docs.

@zeripath
Copy link
Contributor

make lgtm work

@a1012112796a1012112796 mentioned this pull requestApr 28, 2021
6 tasks
@codecov-commenter
Copy link

Codecov Report

Merging#15219 (0e36b41) intomaster (cc7d118) willdecrease coverage by0.00%.
The diff coverage is85.71%.

Impacted file tree graph

@@            Coverage Diff             @@##           master   #15219      +/-   ##==========================================- Coverage   43.91%   43.91%   -0.01%==========================================  Files         678      678                Lines       81741    81742       +1     ==========================================- Hits        35900    35895       -5- Misses      39987    39998      +11+ Partials     5854     5849       -5
Impacted FilesCoverage Δ
models/oauth2.go29.16% <ø> (ø)
models/user.go53.06% <ø> (ø)
modules/public/public.go46.57% <ø> (-8.22%)⬇️
routers/user/profile.go42.17% <0.00%> (ø)
models/avatar.go32.30% <100.00%> (ø)
modules/setting/picture.go56.00% <100.00%> (ø)
modules/setting/setting.go49.80% <100.00%> (ø)
modules/templates/helper.go50.08% <100.00%> (ø)
routers/routes/web.go86.47% <100.00%> (+0.01%)⬆️

Continue to review full report at Codecov.

Legend -Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered byCodecov. Last updatecc7d118...0e36b41. Read thecomment docs.

@lunnylunny merged commit1e87761 intogo-gitea:masterApr 28, 2021
@a1012112796a1012112796 deleted the assets_dir branchApril 28, 2021 13:17
silverwind added a commit to silverwind/gitea that referenced this pull requestMay 7, 2021
@silverwindsilverwind mentioned this pull requestMay 7, 2021
6543 pushed a commit that referenced this pull requestMay 7, 2021
silverwind added a commit to silverwind/gitea that referenced this pull requestMay 9, 2021
Fixes another regression fromgo-gitea#15219.
@silverwindsilverwind mentioned this pull requestMay 9, 2021
zeripath pushed a commit that referenced this pull requestMay 9, 2021
Fixes another regression from#15219.
@noerwnoerw mentioned this pull requestMay 21, 2021
@go-giteago-gitea locked and limited conversation to collaboratorsJun 4, 2021
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@silverwindsilverwindsilverwind approved these changes

+1 more reviewer

@zeripathzeripathzeripath approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

lgtm/doneThis PR has enough approvals to get merged. There are no important open reservations anymore.pr/breakingMerging this PR means builds will break. Needs a description what exactly breaks, and how to fix it!

Projects

None yet

Milestone

1.15.0

Development

Successfully merging this pull request may close these issues.

8 participants

@a1012112796@zeripath@silverwind@lunny@noerw@codecov-io@codecov-commenter@GiteaBot

[8]ページ先頭

©2009-2025 Movatter.jp