Commit graph

25 commits

Author SHA1 Message Date
silverwind bf933f5ca4
Add interface{} to any replacement to make fmt, exclude *.pb.go (#30461)
Since https://github.com/go-gitea/gitea/pull/25686, a few `interface{}`
have sneaked into the codebase. Add this replacement to `make fmt` to
prevent this from happening again.

Ideally a linter would do this, but I haven't found any suitable.

(cherry picked from commit c77e8140bc2ac6521dbebfb77613dce2648bfcb8)

Conflicts:
	- .gitattributes
	  Trivial conflict resolved by picking our choice of language
          for `*.tmpl` files.
2024-04-15 20:01:36 +02:00
Gusted 32697b6a25
[META] Use correct language for .tmpl
- Upstream chosen `Handlebars` as language for the templates, presumenly
because Github doesn't have an syntax highlighter for Go.
- Forgejo does have syntax highlighting support for Go templates, so use that.

(cherry picked from commit a79718522d)
(cherry picked from commit 380d847e5c)
(cherry picked from commit 4126a9672d)
(cherry picked from commit afde0ed822)
(cherry picked from commit 6ddaca0061)
(cherry picked from commit 454b2f6b35)
(cherry picked from commit 58c10e1f93)
(cherry picked from commit 19ec0a5536)
(cherry picked from commit c3717ae4de)
(cherry picked from commit 6c74bbe575)
(cherry picked from commit 9cb48db780)
(cherry picked from commit 19cb774553)
(cherry picked from commit ac35eb83cd)
(cherry picked from commit 986a306d22)
(cherry picked from commit cd841848ee)
(cherry picked from commit 9fd13853df)
(cherry picked from commit 4fa3942c19)
(cherry picked from commit da23365e0f)
(cherry picked from commit 72d189e4c4)
(cherry picked from commit d9f2a915c2)
(cherry picked from commit d8773a323d)
(cherry picked from commit aedaafe947)
(cherry picked from commit f6ce73da17)
(cherry picked from commit f2cdb2fa66)
(cherry picked from commit 810a983f4b)
(cherry picked from commit 1550d00198)
2024-02-05 14:44:33 +01:00
wxiaoguang faa28b5a44
Move public asset files to the proper directory (#25907)
Move `public/*` to `public/assets/*`

Some old PRs (like #15219) introduced inconsistent directory system.

For example: why the local directory "public" is accessed by
`http://site/assets`? How to serve the ".well-known" files properly in
the public directory?

For convention rules, the "public" directory is widely used for the
website's root directory. It shouldn't be an exception for Gitea.

So, this PR makes the things consistent:

* `http://site/assets/foo` means `{CustomPath}/public/assets/foo`.
* `{CustomPath}/public/.well-known` and `{CustomPath}/public/robots.txt`
can be used in the future.

This PR is also a prerequisite for a clear solution for:
* #21942
* #25892 
* discourse.gitea.io: [.well-known path serving custom files behind
proxy?](https://discourse.gitea.io/t/well-known-path-serving-custom-files-behind-proxy/5445/1)

This PR is breaking for users who have custom "public" files (CSS/JS).
After getting approvals, I will update the documents.

----

## ⚠️ BREAKING ⚠️

If you have files in your "custom/public/" folder, please move them to
"custom/public/assets/".

---------

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Giteabot <teabot@gitea.io>
2023-07-18 18:06:43 +02:00
silverwind 69b1e2f103
Remove more unused Fomantic variants (#25292)
Save another 50KB of CSS by removing unused and useless Fomantic
variants.

Removed the last instance if a `tertiary` button and fixed a TODO:

<img width="509" alt="Screenshot 2023-06-15 at 22 34 36"
src="https://github.com/go-gitea/gitea/assets/115237/8a16ae7b-2b17-439b-a096-60a52724e3d6">
2023-06-17 08:15:33 +00:00
silverwind e4e98979ff
Add PDF rendering via PDFObject (#24086)
Use [PDFObject](https://pdfobject.com/) to embed PDFs, replacing our
outdated PDF.js copy we vendor (the last non-webpack vendoring).

[Commit
1](673e0263da)
is the PDFObject integration
[Commit
2](9336f5769d)
is the removal of PDF.js

<img width="1251" alt="Screenshot 2023-05-27 at 09 57 52"
src="https://github.com/go-gitea/gitea/assets/115237/169ce50c-bd1d-4bb0-86e5-1710bd0400a9">
<img width="1257" alt="Screenshot 2023-05-27 at 10 12 50"
src="https://github.com/go-gitea/gitea/assets/115237/318f7ee9-fb11-4093-83e7-17475aa70629">


Fallback for unsupporting browsers (most mobile ones, except Firefox
Mobile):

<img width="358" alt="Screenshot 2023-05-27 at 09 43 34"
src="https://github.com/go-gitea/gitea/assets/115237/8c12d7ba-57d6-4228-89a0-5fef9fad0cbb">

---------

Co-authored-by: Giteabot <teabot@gitea.io>
2023-05-29 12:10:00 +00:00
wxiaoguang 76138ca5a9
Revert "Mark models/fixtures as generated (#24775)" (#24782)
They are not generated in some cases (although they can).

And we should keep an eye on these files when reviewing.

When reviewing, files can be marked as "Viewed" and then it is
collapsed.
2023-05-18 08:12:39 +00:00
silverwind 71451ab844
Mark models/fixtures as generated (#24775)
Makes diffs like https://github.com/go-gitea/gitea/pull/24676/files more
readable. I'm not sure if those are actually generated, but they are
good to collapse in diffs anyways.
2023-05-17 22:59:12 +02:00
JakobDev 07aaa145dc
Mark /templates/swagger/v1_json.tmpl as generated file (#24306) 2023-04-24 13:18:24 -04:00
Yarden Shoham 75b9845420
Mark public/img/svg/*.svg as generated files (#24193)
These files are generated using `make svg`
2023-04-18 13:52:18 -04:00
silverwind 94037ada24
Hook go-licenses into tidy again (#21353)
Running it as part of the build is really unnecessary because we have a
valid output file in the repo and assuming go dependencies do not change
unless go.mod also changes, tidy really is the best target to run the
license generation after.

Also, regenerate the file as I missed to do so during the chroma update,
and mark all json files in assets as generated.
2022-10-10 20:45:02 +02:00
silverwind 48ef12b27c
Move eslintrc/stylelintrc to non-deprecated extensions (#20110) 2022-06-24 14:09:53 +02:00
silverwind 90b4d385dd
Update .gitattributes for .tmpl files (#18576)
There are a few .tmpl files outside the templates directory. Match these
as well by using `*.tmpl` glob in `.gitattributes`. Also, sort the file
alphabetically.
2022-02-03 15:30:26 +00:00
silverwind 108f1aab5c
Add js vendor directory to .gitattributes (#18350) 2022-01-21 23:42:38 +08:00
silverwind 3a3cbcfdf0
Set correct language for Dockerfile variants (#17999) 2021-12-16 04:52:01 -05:00
silverwind 360d8e7c23
Remove unused Fomantic sidebar module (#16853)
* Remove unused Fomantic sidebar module

The [Sidebar](https://fomantic-ui.com/modules/sidebar.html) module seems
currently unused (at least I can't find any reference to it in templates
or js), so remove it from the Fomantic build.

* remove useless minified fomantic build files

* mark fomantic build files as being generated
2021-08-29 21:57:07 +02:00
silverwind e81edc02b9
Update JS dependencies and misc tweaks (#13741)
* Update JS dependencies and misc tweaks

- Update all JS dependencies minus webpack
- Adapt CodeMirrors styling to new CSS parent introduced by EasyMDE
- Set eslint parser to latest and add new eslint 7.14 rule
- Speed up npm install by disabling audit and fund checks
- Move fomantic-ui to optional dependencies to further speed up npm
- Enable syntax highlighting on GH for .eslintrc and .stylelintrc
- Makefile cleanups

* disable audit in npmrc

* add missing dash

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-11-29 16:39:36 -05:00
silverwind 7a30e97002
Enable syntax highlighting for *.tmpl on GitHub (#13571)
Go templates are syntactically very similar to handlebars, this enabled
their syntax highlighting on GitHub.

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-11-15 14:34:06 -05:00
silverwind 46ef562a16
Update vendored .gitattributes (#12322)
These `linguist-vendored` attributes are only for the language stats
seen on github and they mostly haven't been updated with file
reorganizations. Move them to the two actually vendored directories.

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-07-27 00:17:01 -04:00
Lunny Xiao 4f63f283c4
Rename scripts to build and add revive command as a new build tool command (#10942)
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-04-03 22:29:12 +03:00
silverwind 848502d04c
Exclude vendor dirs from git CRLF normalization (#10911)
* Exclude vendor dirs from git CRLF normalization

Should get rid of a few warnings like at the end of `lint-backend` like
https://drone.gitea.io/go-gitea/gitea/23117/1/4

* make vendor

Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-04-01 09:33:49 +03:00
silverwind 1718a9591c Ensure LF on checkouts and in editors (#9259)
This will ensure our repo is always checked out with LF line endings
which should help Windows users who have line ending normalization
enabled.

Additionally, added the LF preference to .editorconfig.
2019-12-05 23:09:01 +02:00
Lunny Xiao 8f1c311b90 ignore static files statstics for linguist 2016-12-27 16:49:25 +01:00
Thomas Boerger b3abc2775f
Dropped more or less useless files 2016-11-28 14:36:35 +01:00
Unknwon 72dd299ca0 Update .gitattributes 2016-08-06 10:36:40 -07:00
Unknwon 9266f28822 Fix GitHub wrong repo language detection 2016-07-21 18:20:03 +08:00