Commit Graph

219 Commits

Author SHA1 Message Date
6543
49d7663929
Revert adding htmx until we finaly decide to add it (#28879) 2024-01-21 21:42:35 +08:00
Yarden Shoham
14f6fcf448
Don't do a full page load when clicking the subscribe button (#28871)
- Refactor the form around the subscribe button into its own template
- Use htmx to perform the form submission
- `hx-boost="true"` to prevent the default form submission behavior of a
full page load
- `hx-sync="this:replace"` to replace the current request (in case the
button is clicked again before the response is returned)
  - `hx-target="this"` to replace the form tag with the new form tag
  - `hx-push-url="false"` to disable a change to the URL
  - `hx-swap="show:no-scroll"` to preserve the scroll position
- Change the backend response to return a `<form>` tag instead of a
redirect to the issue page
- Include `htmx.org` in javascript imports

This change introduces htmx with the hope we could use it to make Gitea
more reactive while keeping our "HTML rendered on the server" approach.

# Before


![before](https://github.com/go-gitea/gitea/assets/20454870/4ec3e81e-4dbf-4338-9968-b0655c276d4c)

# After


![after](https://github.com/go-gitea/gitea/assets/20454870/8c8841af-9bfe-40b2-b1cd-cd1f3c90ba4d)

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
2024-01-20 20:44:51 +01:00
Yarden Shoham
9c869b10b5
Bump @github/relative-time-element to 4.3.1 (#28819)
- Fixes https://github.com/go-gitea/gitea/issues/28747

# Before

![image](https://github.com/go-gitea/gitea/assets/20454870/65d8dc84-680f-4c16-9aa1-b5986102e4e7)

# After

![image](https://github.com/go-gitea/gitea/assets/20454870/7cb288e7-ebde-4e94-a10a-cac28d6bdcfd)

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
2024-01-16 22:52:19 +01:00
silverwind
ce55a74374
Update JS dependencies (#28537)
- Update all JS dependencies excluding mcaptcha (breaking changes) and
stylelint (plugin not compatible with v16)
- Regenerate SVGs
- Update markdownlint rule names
- Fix one issue of heading in markdown discovered during lint
- Update for monaco options renames
- Fix stylelint rule length-zero-no-unit for custom properties
- Tested editor, swagger, sorting, vue, lint
2023-12-30 05:29:03 +00:00
silverwind
06dcb251f3
Update JS and PY dependencies (#28120)
- Update all JS and PY dependencies minus `@mcaptcha/vanilla-glue`
- Adapt to eslint rule rename
- Regenerate all SVGs because of [new
optimizations](https://github.com/svg/svgo/releases/tag/v3.0.4) from
svgo.
- Tested mentions, mermaid, vue, api docs
2023-11-20 01:02:57 +01:00
silverwind
abd79ddebf
Update JS dependencies (#27922)
- Update all JS dependencies minus @mcaptcha/vanilla-glue (unsolved
error, see https://github.com/mCaptcha/glue/issues/65)
- Migrate deprecated eslint rules to `@stylistic/eslint-plugin-js`
- Enable and autofix `@stylistic/js/no-multiple-empty-lines`
- Regenerate poetry.lock with latest poetry
- Tested Mermaid, Swagger, Citation, Vue
2023-11-06 21:14:32 +00:00
silverwind
bd58266957
Update and add new eslint plugins (#27698)
- Switch `eslint-plugin-import` to
[`eslint-plugin-i`](https://github.com/un-es/eslint-plugin-i), a fork
with better dependencies
- Update `eslint-plugin-regexp` to 2.0.0 and add new rules
- Add
[`eslint-plugin-vitest`](https://github.com/veritem/eslint-plugin-vitest)
2023-10-19 21:51:56 +02:00
silverwind
0bccf078c9
Update JS and PY dependencies (#27501)
- Update all JS and PY dependencies
- Enable eslint `prefer-object-has-own` and autofix issue
- Fix styling on citation buttons
- Tested citation, mermaid, monaco, swagger, katex

Citation button issue was that these buttons were not filled:

<img width="136" alt="Screenshot 2023-10-07 at 14 05 08"
src="https://github.com/go-gitea/gitea/assets/115237/435f0c91-28ac-46b3-bae4-dad768b29c05">

Co-authored-by: techknowlogick <techknowlogick@gitea.com>
2023-10-08 00:16:20 +00:00
silverwind
ee27b94b2c
Use vitest globals (#27102)
Enable [globals](https://vitest.dev/config/#globals) in vitest, reducing
the noise in test files.
2023-09-27 04:37:13 +00:00
silverwind
a101dbaa79
Update JS and Poetry dependencies and eslint (#27200)
- Update all JS and Poetry dependencies
- Remove deprecated `eslint-plugin-custom-elements` and replace it with
rules from `eslint-plugin-wc`
- Add a convenience `make update` to update both js and py dependencies
- Tested markdown toolbar, swagger and citation
2023-09-22 22:51:48 +02:00
silverwind
5fc2a3f63a
Add missing deps to files-changed (#27100)
The `docs` and `yaml` actions categories need to run when the
dependencies `markdownlin-cli` or `yamllint` change, so add those to the
list of dependencies for these actions.

Fixes: https://github.com/go-gitea/gitea/issues/27098
2023-09-16 13:23:06 +00:00
Chongyi Zheng
7046065c0e
Drop Node.js 16 and update js dependencies (#27094)
- Drop Node.js 16 since it reached EOL
- Upgrade js dependencies
- Two packages have major version bump
  - `updates`: require node 18
- `eslint-plugin-array-func`: require `eslint` 8.40.0, which is
satisfied
- Run `make svg` for `@primer/octicons` update
2023-09-16 11:36:35 +00:00
silverwind
97aa749578
Vendor jquery.are-you-sure with strict mode fixes (#26901)
Extract from https://github.com/go-gitea/gitea/pull/25940 and because
https://github.com/go-gitea/gitea/pull/26743 does seem to need more
work.

This will be required if we are to run our JS in [strict
mode](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode).

Previously, the two variables `$fields` and `$dirtyForms` polluted
`window`:

<img width="1145" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/e0270a0e-b881-4ed7-9cc4-e9ab25c0a2bc">
2023-09-06 00:02:44 +00:00
silverwind
508de3a58d
Fix Uint8Array comparisons and update vitest (#26805)
Compare those `Uint8Array` via conversion to Array which are properly
comparable, so that we don't have to worry about whether `TextEncoder`
and `UInt8Array` from the environment are compatible or not.

---------

Co-authored-by: delvh <dev.lh@web.de>
2023-08-30 01:56:44 +00:00
puni9869
438c7642c7
Updating the js libraries to latest version. (#26795)
As title.

<img width="657" alt="image"
src="https://github.com/go-gitea/gitea/assets/80308335/db8f6c80-78b5-4992-800c-802ee7b9ba6d">
2023-08-30 02:29:13 +08:00
silverwind
21b8ec29aa
Add eslint-plugin-vue-scoped-css (#26720)
Adds
[eslint-plugin-vue-scoped-css](https://github.com/future-architect/eslint-plugin-vue-scoped-css)
and fixes discovered issues which are:

- 1 unused selector
- 3 selectors with `.full.height` parent in a `<style scoped>` block so
the rule could not find the parent. Move these into the unscoped block
instead. They worked before and after.
2023-08-25 13:47:27 +00:00
silverwind
5feef6d5c0
Update JS dependencies (#26586)
- Update all JS dependencies
- Adapt `ansi_up` import for ESM
- Tested Mermaid and Ansi rendering
2023-08-19 10:18:39 +02:00
silverwind
88479e0dfc
Update JS dependencies (#26449)
- Update all JS dependencies
- Tested Monaco and Swagger
2023-08-11 00:29:15 +00:00
silverwind
8e644d3460
Update js and py dependencies (#26243)
- Update all JS and PY dependencies minus
`eslint-plugin-eslint-comments` (because of
https://github.com/eslint-community/eslint-plugin-eslint-comments/issues/89)
- Regenerate SVGs
- Remove depreacted eslint rule
- Tested mermaid and swagger
2023-07-31 01:16:12 +02:00
silverwind
2b6f224336
Update JS dependencies (#26025)
- Update all JS dependencies
- Tweak eslint config, disable SequenceExpression aka. [Comma
operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comma_operator),
remove deprecated rule
- Add new stylelint rule
- Tested Monaco and Swagger
2023-07-21 11:34:10 +08:00
silverwind
38844e0869
Always pass 6-digit hex color to monaco (#25780)
Monaco can not deal with color formats other than 6-digit hex, so we
convert the colors for it via new
[`tinycolor2`](https://github.com/bgrins/TinyColor) dependency (5kB
minzipped).

Also, with the addition of the module, we can replace the existing
`hexToRGBColor` usage, I verified it is compatible with the current
tests before removing the function.

Fixes: https://github.com/go-gitea/gitea/issues/25770
2023-07-09 12:17:22 +02:00
silverwind
429c12fe62
Update JS dependencies, misc tweaks (#25768)
- Update all JS dependencies minus stylelint because of
https://github.com/elirasza/stylelint-stylistic/issues/12
- Misc tweaks to eslint and stylelint configs
- Tested Monaco and Mermaid
2023-07-08 12:26:35 +02:00
silverwind
62f3c0fe76
Switch to vite-string-plugin (#25762)
Switch to
[`vite-string-plugin`](https://github.com/silverwind/vite-string-plugin)
to load SVGs as string during tests. The plugin will also be useful once
we switch to vite.
2023-07-08 04:56:12 +00:00
silverwind
811fc9d49c
Minify CSS with Lightning CSS (#25754)
Replace esbuild's rudimentary CSS minifier with [Lightning
CSS](https://github.com/parcel-bundler/lightningcss), which results in
around 4% smaller CSS bundle size, index.css goes from 608K to 584K.

The module is quite new but has active use in the Parcel bundler, and as
of yesterday is also under experimental support in Vite, so I trust it
that bugs will be sorted out quickly.

Before: `assets by path css/*.css 959 KiB`
After: `assets by path css/*.css 933 KiB`

I did give this a cursory test and everything seems to be in order.
2023-07-07 18:28:48 +00:00
silverwind
b943318617
Update JS dependencies and misc tweaks (#25540)
- Update all JS dependencies
- Enable `declaration-property-unit-disallowed-list` to forbid `em` on
`line-height`
- Rename dependency update targets to `update-js` and `update-py` and
document them
- Remove margin on Asciicast viewer
- Tested Swagger, Katex, Asciicast

<img width="1243" alt="Screenshot 2023-06-27 at 19 51 05"
src="https://github.com/go-gitea/gitea/assets/115237/2d2722a0-2aa7-4f4c-b8bd-17e1f3637b78">
2023-06-27 21:44:17 +02:00
silverwind
c71e8abbc3
Add toasts to UI (#25449)
Fixes https://github.com/go-gitea/gitea/issues/24353

In some case like async success/error, it is useful to show toasts in UI.
2023-06-27 02:45:24 +00:00
silverwind
02ef14bea2
Add make poetry-update, upgrade djlint (#25399)
[updates](https://github.com/silverwind/updates) now supports poetry as
well so we can use it for a new `make poetry-update` to update all
poetry dependencies.
2023-06-26 21:14:00 +00:00
silverwind
d2142ba3c3
Update octicons and use octicon-file-directory-symlink (#25453)
Make use of the [new
octicon](https://github.com/primer/octicons/issues/945) that indicates a
symlink to a directory:

<img width="189" alt="Screenshot 2023-06-22 at 22 50 57"
src="https://github.com/go-gitea/gitea/assets/115237/a70690ea-ebfc-48fe-af23-cdc33bcb2098">
2023-06-22 22:05:52 +00:00
silverwind
93cd579269
Switch to ansi_up for ansi rendering in actions (#25401)
Fixes: https://github.com/go-gitea/gitea/issues/24777
2023-06-22 02:15:19 +00:00
silverwind
1a0a205466
Clean up pyproject.toml and package.json, fix poetry options (#25327)
- Reduce `pyproject.toml` and `package.json` to the minimal required
format, removing unneeded properties. `build-system` is not needed as
per
[this](https://github.com/python-poetry/poetry/issues/8110#issuecomment-1595846841).
- Fix `poetry.toml` options they were wrong previously.
- Add dependencies of poetry files to templates `files-changed`.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
2023-06-18 18:13:08 +00:00
silverwind
f47744c3f1
Update JS dependencies, remove space after emoji completion (#25266)
- Update all JS dependencies
- Enable stylint
[`media-feature-name-value-no-unknown`](https://stylelint.io/user-guide/rules/media-feature-name-value-no-unknown)
- Make use of new features in webpack and text-expander-element
- Tested Swagger and Mermaid

To explain the `text-expander-element` change: Before this version, the
element added a unavoidable space after emoji completion. Now that
https://github.com/github/text-expander-element/pull/36 is in, we gain
control over this space and I opted to remove it for emoji completion
and retain it for `@` mentions.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
2023-06-18 08:38:47 +00:00
silverwind
61e0827f42
Add stylelint-declaration-block-no-ignored-properties (#25284)
Add
[stylelint-declaration-block-no-ignored-properties](https://github.com/kristerkari/stylelint-declaration-block-no-ignored-properties)
and fix discovered issue. There is no visual difference in these markup
code blocks.
2023-06-18 04:22:09 +00:00
silverwind
3ee8970419
add stylelint-stylistic (#25285)
Add
[stylelint-stylistic](https://github.com/elirasza/stylelint-stylistic),
autofix all issues with two manual tweaks. This restores all the
stylistic rules removed in Stylelint 15.
2023-06-17 13:20:32 +00:00
silverwind
263ed09bbf
Update js dependencies (#25137)
- Update all JS dependencies
- Tweak eslint for more generic globs
- Tested mermaid, pdf, monaco

Co-authored-by: Giteabot <teabot@gitea.io>
2023-06-08 10:54:31 +00:00
silverwind
50bd7d0b24
Remove the service worker (#25010)
It's been disabled by default since 1.17
(https://github.com/go-gitea/gitea/pull/18914), and it never really
delivered any benefit except being another cache layer that has its own
unsolved invalidation issues. HTTP cache works, we don't need two cache
layers at the browser for assets.

## ⚠️ BREAKING

You can remove the config `[ui].USE_SERVICE_WORKER` from your `app.ini`
now.
2023-05-31 02:07:04 +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
silverwind
acb13afb79
Update JS dependencies (#24969)
- Update all JS dependencies
- Tested Build, Mermaid and Swagger
2023-05-28 19:47:03 +00:00
silverwind
a9d417341c
Run stylelint on .vue files (#24865)
- Run stylelint on .vue files
- Fix discovered issues
- Suppress warning spam from `declaration-strict-value` rule

Co-authored-by: Giteabot <teabot@gitea.io>
2023-05-23 13:54:21 +00:00
silverwind
bbc1456542
Update JS dependencies (#24815)
- Update all JS dependencies
- Remove `@vue/compiler-sfc` as per [this
notice](https://github.com/vuejs/core/tree/main/packages/compiler-sfc#vuecompiler-sfc),
still builds as normal
- Tested build and text/image copy
2023-05-19 21:58:12 +00:00
silverwind
4aacc3ac78
Add two eslint plugins (#24776)
Add these two plugins and autofix issues:

-
[eslint-plugin-no-use-extend-native](https://github.com/dustinspecker/eslint-plugin-no-use-extend-native)
-
[eslint-plugin-array-func](https://github.com/freaktechnik/eslint-plugin-array-func)
2023-05-18 09:14:31 +08:00
Zettat123
e7c2231dee
Support for status check pattern (#24633)
This PR is to allow users to specify status checks by patterns. Users
can enter patterns in the "Status Check Pattern" `textarea` to match
status checks and each line specifies a pattern. If "Status Check" is
enabled, patterns cannot be empty and user must enter at least one
pattern.
Users will no longer be able to choose status checks from the table. But
a __*`Matched`*__ mark will be added to the matched checks to help users
enter patterns.

Benefits:
- Even if no status checks have been completed, users can specify
necessary status checks in advance.
- More flexible. Users can specify a series of status checks by one
pattern.

Before:

![image](https://github.com/go-gitea/gitea/assets/15528715/635738ad-580c-49cd-941d-c721e5b99be4)

After:

![image](https://github.com/go-gitea/gitea/assets/15528715/16aa7b1b-abf1-4170-9bfa-ae6fc9803a82)

---------

Co-authored-by: silverwind <me@silverwind.io>
2023-05-17 16:11:13 +08:00
silverwind
31ad6181e1
Switch to @eslint-community/eslint-comments (#24736)
[eslint-plugin-eslint-comments](https://github.com/mysticatea/eslint-plugin-eslint-comments)
is unmaintained, switch to the community fork.

See
https://github.com/mysticatea/eslint-plugin-eslint-comments/issues/72
for discussion.
2023-05-15 17:29:23 +00:00
silverwind
f745016092
Add eslint-plugin-eslint-comments (#24690)
Add
[eslint-plugin-eslint-comments](https://github.com/mysticatea/eslint-plugin-eslint-comments)
which prevents some abuse related to eslint comments.
2023-05-12 20:38:17 +00:00
silverwind
a4d6f83b5b
Add eslint-plugin-wc (#24689)
Add [eslint-plugin-wc](https://github.com/43081j/eslint-plugin-wc),
another small set of eslint rules covering web components.
2023-05-12 19:15:49 +00:00
silverwind
b20e5f9cd8
Update JS dependencies (#24685)
- Update all JS dependencies
- Tested citation and various vue components

Also this includes the fix for
https://github.com/webpack/webpack-cli/issues/3778.
2023-05-12 15:47:48 +00:00
yp05327
bc719f549e
Update pin and add pin-slash (#24669)
Continue #23531
Thanks for the update in https://github.com/primer/octicons/issues/940,
@CameronFoxly

![image](https://github.com/go-gitea/gitea/assets/18380374/bc512b20-b656-4bd7-8e70-3a2b7eca9d65)

![image](https://github.com/go-gitea/gitea/assets/18380374/a3863267-6a7a-48d5-8157-9f361fec3fed)
2023-05-12 14:38:59 +08:00
silverwind
d5b2bf9044
Update JS dependencies, add new eslint rules (#24597)
- Update all JS dependencies
- Enable new eslint rules, fix issue (some via autofix)
- Fix some missed eslint rule renames from [unicorn
v25](https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v25.0.0)
- Tested Monaco, Katex, Swagger UI

---------

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Giteabot <teabot@gitea.io>
2023-05-09 02:35:49 +00:00
silverwind
fa506cd571
Remove font-awesome and fomantic icon module (#24471)
Fixes https://github.com/go-gitea/gitea/issues/10410.
This PR removes around 120kB of CSS.
2023-05-01 13:25:54 -04:00
silverwind
50133b02bd
Add eslint-plugin-regexp (#24361)
Add
[`eslint-plugin-regexp`](https://github.com/ota-meshi/eslint-plugin-regexp)
and fix discovered issues. Config is mostly the recommended one, but I
relaxed a few rules.
2023-04-26 22:08:16 -04:00
yp05327
8ea33baa1c
Introduce eslint-plugin-no-jquery/no-event-shorthand (#24198)
https://github.com/go-gitea/gitea/pull/24098#issuecomment-1514010690

---------

Co-authored-by: silverwind <me@silverwind.io>
2023-04-20 05:28:27 -04:00