1. 12 May, 2022 1 commit
    • silverwind's avatar
      Introduce eslint-plugin-jquery (#19690) · e45738e3
      silverwind authored
      Introduce the plugin that allows us to gradually forbid jQuery code.
      I've enabled all rules that already pass.
      
      Next step will be to go through each rule and fix the issues by using
      native DOM equivalents, which I think can be done in separate PRs, but
      if prefered I could also start here.
      e45738e3
  2. 10 May, 2022 1 commit
    • silverwind's avatar
      Update JS dependencies (#19675) · 3c658dff
      silverwind authored
      * Update JS dependencies
      
      - Update all JS dependencies minus vue and vue-loader
      - Adapt to jest 28
      - Add new eslint rules
      - Tested Mermaid and Swagger-UI
      
      * switch to @happy-dom/jest-environment for faster tests
      
      * bump eslint env to es2022
      3c658dff
  3. 01 Apr, 2022 1 commit
    • silverwind's avatar
      Update JS dependencies (#19281) · 1eb0da58
      silverwind authored
      - Upgrade all JS dependencies minus vue and vue-loader
      - Adapt to breaking change of octicons
      - Update eslint rules
      - Tested Swagger UI, sortablejs and prod build
      1eb0da58
  4. 25 Feb, 2022 1 commit
    • silverwind's avatar
      Update JS dependencies (#18898) · 65689f6b
      silverwind authored
      - Updated all JS dependencies minus Vue (update 2 to 3 requires a ton of
        work and is probably blocked by dependencies)
      - Tested editor, swagger-ui
      65689f6b
  5. 28 Jan, 2022 1 commit
  6. 18 Jan, 2022 1 commit
  7. 14 Jan, 2022 1 commit
  8. 04 Dec, 2021 1 commit
  9. 22 Nov, 2021 1 commit
  10. 11 Nov, 2021 1 commit
  11. 19 Oct, 2021 1 commit
  12. 15 Oct, 2021 1 commit
  13. 12 Oct, 2021 1 commit
    • wxiaoguang's avatar
      Add user status filter to admin user management page (#16770) · 7bcbdd07
      wxiaoguang authored
      It makes Admin's life easier to filter users by various status.
      
      * introduce window.config.PageData to pass template data to javascript module and small refactor
      
      move legacy window.ActivityTopAuthors to window.config.PageData.ActivityTopAuthors
      make HTML structure more IDE-friendly in footer.tmpl and head.tmpl
      remove incorrect <style class="list-search-style"></style> in head.tmpl
      use log.Error instead of log.Critical in admin user search
      
      * use LEFT JOIN instead of SubQuery when admin filters users by 2fa. revert non-en locale.
      
      * use OptionalBool instead of status map
      
      * refactor SearchUserOptions.toConds to SearchUserOptions.toSearchQueryBase
      
      * add unit test for user search
      
      * only allow admin to use filters to search users
      7bcbdd07
  14. 17 Aug, 2021 1 commit
  15. 05 Aug, 2021 1 commit
    • zeripath's avatar
      Restore Accessibility for Dropdown (#16576) · 6e6f23b3
      zeripath authored
      
      * Restore #10096/#8638 and re-fix #15172
      
      This PR restores the vendored and patched dropdow from #8638. It
      however, abandons the calls to `click()` using instead the default
      dropdown click calls instead. This prevents the issue of the dropdown
      grabbing focus permanently however, this may have negative effects on
      the effect of focus on the dropdowns.
      
      Of note, the behaviour of the template selector dropdown on the repo
      creation page is slightly odd - I don't believe that this odd behaviour
      is caused by this PR but rather by the feed source for this. I suspect
      that the dropdown should be adding a delete button to its selection.
      
      Fix #15172
      References: #7057
      Signed-off-by: default avatarAndrew Thornton <art27@cantab.net>
      
      * leverage fomantic-build instead
      Signed-off-by: default avatarAndrew Thornton <art27@cantab.net>
      
      * as per jookia
      Signed-off-by: default avatarAndrew Thornton <art27@cantab.net>
      6e6f23b3
  16. 13 May, 2021 1 commit
  17. 24 Apr, 2021 1 commit
  18. 08 Apr, 2021 1 commit
    • silverwind's avatar
      Add frontend testing, require node 12 (#15315) · 0d1a5e0f
      silverwind authored
      - Add basic frontend unit testing infrastructure using jest in ESM mode
      - Rename 'make test' to 'make test-backend'
      - Introduce 'make test-frontend' and 'make test' that runs both
      - Bump Node.js requirement to v12. v10 will be EOL in less than a month.
      - Convert all build-related JS files to ESM.
      
      I opted to run frontend tests run as part of the compliance pipeline because
      they complete fast and are not platform-specific like the golang tests.
      0d1a5e0f
  19. 30 Mar, 2021 1 commit
  20. 22 Mar, 2021 1 commit
    • silverwind's avatar
      Update JS dependencies (#15033) · 1a03fa7a
      silverwind authored
      * Update JS dependencies
      
      - Update all JS dependencies
      - For octicons, rename trashcan to trash
      - For svgo, migrate to v2 api, output seems to have slightly changed but icons look the same
      - For stylelint, update config, fix custom property duplicates
      - For monaco, drop legacy Edge support
      - For eslint, enable new rules, fix new issues
      - For less-loader, remove deprecated import syntax
      
      * update svgo usage in generate-images and rebuild logo.svg with it
      1a03fa7a
  21. 27 Dec, 2020 1 commit
    • silverwind's avatar
      Update JS dependencies and webpack (#14118) · 50a2dd52
      silverwind authored
      
      * Update JS dependencies
      
      - Update all JS dependencies
      - Adapt webpack config for version 5
      - Update to Less 4.0, adapting usage of removed mixin syntax
      - Enable new ESLint rules and fix discovered issues
      
      * update license-webpack-plugin to fix missing licenses
      
      * update license-webpack-plugin once more to get webpack into the license output
      
      * switch to license-checker-webpack-plugin again for performance
      
      * update deps again
      Co-authored-by: default avatarLauris BH <lauris@nix.lv>
      50a2dd52
  22. 29 Nov, 2020 1 commit
    • silverwind's avatar
      Update JS dependencies and misc tweaks (#13741) · e81edc02
      silverwind authored
      
      * 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: default avatartechknowlogick <techknowlogick@gitea.io>
      e81edc02
  23. 27 Nov, 2020 1 commit
    • silverwind's avatar
      Enable linting of JS inside templates (#13708) · 7ab36335
      silverwind authored
      
      Indentation-related rules are disabled because indent templates with
      tabs but our lint rules expect spaces.
      
      Also had to exclude a few files where using template variables in the JS
      is causing syntax errors for the JS parser. I don't think there's a way
      to solve this otherwise.
      Co-authored-by: default avatarLauris BH <lauris@nix.lv>
      7ab36335
  24. 07 Nov, 2020 1 commit
    • silverwind's avatar
      Add Vue linting (#13447) · 7c47e240
      silverwind authored
      
      * Add Vue linting
      
      Turns out the .vue files were not linted at all, so I added that as well
      as re-indented the file to 2-space and fixed all reasonable issues that
      cam up except one case of a unintended side effect for which I have no
      idea how to fix it, so the rule was disabled.
      
      * misc tweaks
      
      * update lockfile
      
      * use overrides to include .vue files
      
      * treat warnings as errors on lint-frontend
      
      * also treat stylelint warnings as errors
      
      * use equal sign syntax
      Co-authored-by: default avatarLauris BH <lauris@nix.lv>
      Co-authored-by: default avatarLunny Xiao <xiaolunwen@gmail.com>
      7c47e240
  25. 21 Oct, 2020 1 commit
  26. 03 Sep, 2020 1 commit
    • silverwind's avatar
      Update JS dependencies (#12702) · 844d9b46
      silverwind authored
      - Added some new octicons
      - Add explicit less dependency as required by upstream
      - Enable es2021 environment in eslint
      844d9b46
  27. 29 Aug, 2020 1 commit
    • silverwind's avatar
      Update eslint config (#12609) · 7187fdbb
      silverwind authored
      - Remove unneeded "Tribute" global
      - Separate Node and Browser environments
      - Update environment to es2020 to enable new globals like "BigInt"
      7187fdbb
  28. 27 Jul, 2020 1 commit
  29. 26 Jul, 2020 1 commit
    • silverwind's avatar
      Rework 'make generate-images' (#12316) · 7cf23399
      silverwind authored
      * Rework 'make generate-images'
      
      - Remove external dependencies and replace it with a node script that
        does does the same.
      - Move detail removal from gitea-sm.png to favicon.png
      - Remove favicon.ico and its generation, it is unused and we already serve
        favicon.png in its place.
      
      Fixes: https://github.com/go-gitea/gitea/issues/12314
      
      * use proper centering value for preserveAspectRatio
      
      * fix lint
      
      * use fabric
      
      * better linting fix
      
      * fix typo
      
      * mention detail-remove class in docs
      7cf23399
  30. 08 Jul, 2020 1 commit
  31. 05 Jul, 2020 1 commit
  32. 03 Jul, 2020 1 commit
  33. 09 Jun, 2020 1 commit
    • silverwind's avatar
      rework eslint config (#11615) · 19db3f4f
      silverwind authored
      
      * rework eslint config
      
      - use explicit config that only enables rules
      - upgrade eslint to 7.1.0
      - add new plugins with selected rules enabled
      - fix discovered issues, remove global wipPrefixes
      
      * remove if
      
      * undo template change
      
      * add disabled rules as well for easier config updating
      
      * add missing disabled rule
      
      * update eslint and plugins
      
      * fix new violation
      
      * remove deprecated rules
      Co-authored-by: default avatarLauris BH <lauris@nix.lv>
      19db3f4f
  34. 24 May, 2020 1 commit
    • silverwind's avatar
      Fix serviceworker output file and misc improvements (#11562) · 3761bdb6
      silverwind authored
      * Fix serviceworker output file and misc improvements
      
      - Fix output file location for production build
      - Cache more asset types: fonts and worker variants
      - Parallelize a few tasks during initalization
      - Only invalidate caches starting with our prefix
      - Remove public/serviceworker.js before building
      - Remove font preloads, they cause strange cors issues
      - Misc eslint config adjustments
      
      * remove webpack output files on watch-frontend
      3761bdb6
  35. 22 May, 2020 1 commit
  36. 14 May, 2020 1 commit
    • silverwind's avatar
      Switch code editor to Monaco (#11366) · 9249c810
      silverwind authored
      
      * Switch code editor to Monaco
      
      This switches out CodeMirror for Monaco which is based on the same code
      base as VS code and should work pretty similar to it.
      
      It does add a few async chunks, totalling around 10MB to our build. It
      currently supports around 65 languages and in the default configuration,
      each language would emit one ugly [number].js chunk, so I opted to
      combine them all into a single file for now.
      
      CodeMirror is still being used under the hood by SimpleMDE so it can not
      be removed yet.
      
      * inline editorconfig, fix diff, use for markdown, remove more dead code
      
      * refactors, remove jquery usage
      
      * use tab_width
      
      * fix intellisense
      
      * rename function for clarity
      
      * misc tweaks, enable webpack progress display
      
      * only use --progress on dev build
      
      * remove useless borders in arc-green
      
      * fix typo
      
      * remove obsolete comment
      
      * small refactor
      
      * fix file creation and various refactors
      
      * unset useTabStops too when no editorconfig
      
      * small refactor
      
      * disable webpack's [big] warnings
      
      * remove useless await
      
      * fix dark theme check
      
      * rename chunk to 'monaco'
      
      * add to .gitignore and delete webpack dest before build
      
      * increase editor height
      
      * support more editorconfig properties
      
      * remove empty element filter
      
      * rename
      Co-authored-by: default avatarJohn Olheiser <john.olheiser@gmail.com>
      9249c810
  37. 28 Apr, 2020 1 commit
    • mrsdizzie's avatar
      Support unicode emojis and remove emojify.js (#11032) · 4563eb87
      mrsdizzie authored
      * Support unicode emojis and remove emojify.js
      
      This PR replaces all use of emojify.js and adds unicode emoji support to various areas of gitea.
      
      This works in a few ways:
      
      First it adds emoji parsing support into gitea itself. This allows us to
      
       * Render emojis from valid alias (:smile:)
       * Detect unicode emojis and let us put them in their own class with proper aria-labels and styling
       * Easily allow for custom "emoji"
       * Support all emoji rendering and features without javascript
       * Uses plain unicode and lets the system render in appropriate emoji font
       * Doesn't leave us relying on external sources for updates/fixes/features
      
      That same list of emoji is also used to create a json file which replaces the part of emojify.js that populates the emoji search tribute. This file is about 35KB with GZIP turned on and I've set it to load after the page renders to not hinder page load time (and this removes loading emojify.js also)
      
      For custom "emoji" it uses a pretty simple scheme of just looking for /emojis/img/name.png where name is something a user has put in the "allowed reactions" setting we already have. The gitea reaction that was previously hard coded into a forked copy of emojify.js is included and works as a custom reaction under this method.
      
      The emoji data sourced here is from https://github.com/github/gemoji which is the gem library Github uses for their emoji rendering (and a data source for other sites). So we should be able to easily render any emoji and :alias: that Github can, removing any errors from migrated content. They also update it as well, so we can sync when there are new unicode emoji lists released.
      
      I've included a slimmed down and slightly modified forked copy of https://github.com/knq/emoji to make up our own emoji module. The code is pretty straight forward and again allows us to have a lot of flexibility in what happens.
      
      I had seen a few comments about performance in some of the other threads if we render this ourselves, but there doesn't seem to be any issue here. In a test it can parse, convert, and render 1,000 emojis inside of a large markdown table in about 100ms on my laptop (which is many more emojis than will ever be in any normal issue). This also prevents any flickering and other weirdness from using javascript to render some things while using go for others.
      
      Not included here are image fall back URLS. I don't really think they are necessary for anything new being written in 2020. However, managing the emoji ourselves would allow us to add these as a feature later on if it seems necessary.
      
      Fixes: https://github.com/go-gitea/gitea/issues/9182
      Fixes: https://github.com/go-gitea/gitea/issues/8974
      Fixes: https://github.com/go-gitea/gitea/issues/8953
      Fixes: https://github.com/go-gitea/gitea/issues/6628
      Fixes: https://github.com/go-gitea/gitea/issues/5130
      
      
      
      * add new shared function emojiHTML
      
      * don't increase emoji size in issue title
      
      * Update templates/repo/issue/view_content/add_reaction.tmpl
      Co-Authored-By: default avatar6543 <6543@obermui.de>
      
      * Support for emoji rendering in various templates
      
      * Render code and review comments as they should be
      
      * Better way to handle mail subjects
      
      * insert unicode from tribute selection
      
      * Add template helper for plain text when needed
      
      * Use existing replace function I forgot about
      
      * Don't include emoji greater than Unicode Version 12
      
      Only include emoji and aliases in JSON
      
      * Update build/generate-emoji.go
      
      * Tweak regex slightly to really match everything including random invisible characters. Run tests for every emoji we have
      
      * final updates
      
      * code review
      
      * code review
      
      * hard code gitea custom emoji to match previous behavior
      
      * Update .eslintrc
      Co-Authored-By: default avatarsilverwind <me@silverwind.io>
      
      * disable preempt
      Co-authored-by: default avatarsilverwind <me@silverwind.io>
      Co-authored-by: default avatar6543 <6543@obermui.de>
      Co-authored-by: default avatarLauris BH <lauris@nix.lv>
      Co-authored-by: default avatarguillep2k <18600385+guillep2k@users.noreply.github.com>
      4563eb87
  38. 24 Apr, 2020 1 commit
  39. 13 Apr, 2020 1 commit
    • silverwind's avatar
      Move syntax highlighting to web worker (#11017) · 27e3cddf
      silverwind authored
      
      This should eliminate page freezes when loading big files/diff.
      `highlightBlock` is needed to preserve existing nodes when highlighting
      and for that, highlight.js needs access to the DOM API so I added a DOM
      implementation to make it work, which adds around 300kB to the output
      file size of the lazy-loaded `highlight.js`.
      Co-authored-by: default avatarLauris BH <lauris@nix.lv>
      27e3cddf
  40. 11 Mar, 2020 1 commit