1. 02 May, 2020 5 commits
  2. 01 May, 2020 2 commits
  3. 30 Apr, 2020 14 commits
  4. 29 Apr, 2020 2 commits
    • n0emis's avatar
      Don't allow registration via the web form, when AllowOnlyExternalRegistration is True (#11248) · 33738ff9
      n0emis authored
      * Don't allow registration via the web form, when AllowOnlyExternalRegistration is True
      
      * Show Disabled Registration message if DisableRegistration or AllowOnlyExternalRegistration options are true
      Unverified
      33738ff9
    • Alexander Scheel's avatar
      Fix sanitizer config - multiple rules (#11133) · 1bf9e44b
      Alexander Scheel authored
      
      In #9888, it was reported that my earlier pull request #9075 didn't quite function as expected. I was quite hopeful the `ValuesWithShadow()` worked as expected (and, I thought my testing showed it did) but I guess not. @zeripath proposed an alternative syntax which I like:
      
      ```ini
      [markup.sanitizer.1]
      ELEMENT=a
      ALLOW_ATTR=target
      REGEXP=something
      [markup.sanitizer.2]
      ELEMENT=a
      ALLOW_ATTR=target
      REGEXP=something
      ```
      
      This was quite easy to adopt into the existing code. I've done so in a semi-backwards-compatible manner:
      
       - The value from `.Value()` is used for each element.
       - We parse `[markup.sanitizer]` and all `[markup.sanitizer.*]` sections and add them as rules.
      
      This means that existing configs will load one rule (not all rules). It also means people can use string identifiers (`[markup.sanitiser.KaTeX]`) if they prefer, instead of numbered ones.
      Co-authored-by: default avatarAndrew Thornton <art27@cantab.net>
      Co-authored-by: default avatarguillep2k <18600385+guillep2k@users.noreply.github.com>
      Unverified
      1bf9e44b
  5. 28 Apr, 2020 4 commits
    • 6543's avatar
    • 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>
      Unverified
      4563eb87
    • mrsdizzie's avatar
      Disable new signal-based asynchronous goroutine preemption from GO 1.14 in git env (#11237) · 922a2390
      mrsdizzie authored
      As seen in trouble shooting #11032 the new feature of Go 1.14 is causing several second delays in startup in certain situations. Debugging shows it spending several seconds handling SIGURG commands during init:
      
      ```
      6922:04:51.984234 trace init() ./modules/queue/unique_queue_wrapped.go
      remote: ) = 69 <0.000012>
      remote: [pid 15984] 22:04:51 write(1, "\ttime taken: 236.761\302\265s\n\n", 25    time taken: 236.761µs
      remote:
      remote: ) = 25 <0.000011>
      remote: [pid 15984] 22:04:51 --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=15984, si_uid=0} ---
      remote: [pid 15984] 22:04:52 --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=15984, si_uid=0} ---
      remote: [pid 15984] 22:04:52 --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=15984, si_uid=0} ---
      ```
      
      This causes up to 20 seconds added to a push in some cases as it happens for each call of the gitea hook command. This is likely the cause of #10661 as well and would start to effect users once we release 1.12 which would be the first release compiled with Go 1.14. I suspect this is just a slight issue with the upstream implementatation as there have been a few very similar bugs fixed and reported:
      
       https://github.com/golang/go/issues/37741
       https://github.com/golang/go/issues/37942
      
      We should revisit this in the future and see if a newer version of Go has solved it, but for now disable this option in the environment that gitea hook runs in to avoid it.
      Unverified
      922a2390
    • zeripath's avatar
      Make the PushCreate test declarative (#11229) · 1f0b797d
      zeripath authored
      Reduce the code duplication in the PushCreate test and switch
      to a declarative format.
      
      * Instead of explicitly creating the repository re-use functions from the other declarative tests and add comments
      * Ensure that the test repository is deleted at the end of test
      * Slightly reorder the sub-tests
      
      Also reduce the code duplication in MergeFork and add some comments there too and make doGitCloneFail be self-contained.
      
      Signed-off-by: Andrew Thornton art27@cantab.net
      Unverified
      1f0b797d
  6. 27 Apr, 2020 6 commits
  7. 26 Apr, 2020 1 commit
  8. 25 Apr, 2020 1 commit
  9. 24 Apr, 2020 5 commits