You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gitea/docs/content/doc/advanced
zeripath e46dbec294
Move EventSource to SharedWorker (#12095) (#12130)
* Move EventSource to SharedWorker (#12095)

Backport #12095

Move EventSource to use a SharedWorker. This prevents issues with HTTP/1.1
open browser connections from preventing gitea from opening multiple tabs.

Also allow setting EVENT_SOURCE_UPDATE_TIME to disable EventSource updating

Fix #11978

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>

* Bugfix for shared event source

For some reason our eslint configuration is not working correctly
and a bug has become apparent when trying to backport this to 1.12.

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Re-fix #12095 again

Unfortunately some of the suggested changes to #12095 introduced
bugs which due to caching behaviour of sharedworkers were not caught
on simple tests.

These are as follows:

* Changing from simple for loop to use includes here:

```js
  register(port) {
    if (!this.clients.includes(port)) return;

    this.clients.push(port);

    port.postMessage({
      type: 'status',
      message: `registered to ${this.url}`,
    });
  }
```

The additional `!` prevents any clients from being added and should
read:

```js
    if (this.clients.includes(port)) return;
```

* Dropping the use of jQuery `$(...)` selection and using DOM
`querySelector` here:

```js
async function receiveUpdateCount(event) {
  try {
    const data = JSON.parse(event.data);

    const notificationCount = document.querySelector('.notification_count');
    if (data.Count > 0) {
      notificationCount.classList.remove('hidden');
    } else {
      notificationCount.classList.add('hidden');
    }

    notificationCount.text() = `${data.Count}`;
    await updateNotificationTable();
  } catch (error) {
    console.error(error, event);
  }
}
```

Requires that `notificationCount.text()` be changed to use `textContent`
instead.

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
5 years ago
..
adding-legal-pages.en-us.md Add Privacy Policy and Terms of Service Page (#9513) 5 years ago
api-usage.en-us.md DOCS: add mention of swagger api reference (#8452) 5 years ago
api-usage.zh-cn.md Adapt documentation to renamed ENABLE_SWAGGER option (#5811) 6 years ago
ci-cd.en-us.md Add notice for awesome-gitea (#10612) 5 years ago
cmd-embedded.en-us.md Changed image of openid-connect logo for better look on arc-green theme (#11312) 5 years ago
config-cheat-sheet.en-us.md Move EventSource to SharedWorker (#12095) (#12130) 5 years ago
config-cheat-sheet.zh-cn.md Replace references to cron.update_migration_post_id with cron.update_migration_poster_id in docs (#11068) 5 years ago
customizing-gitea.en-us.md Add documentation to display STL preview (#11181) 5 years ago
customizing-gitea.zh-cn.md Fix translation errors in doc advanced part (zh-cn) (#5112) 6 years ago
external-renderers.en-us.md Fix sanitizer config - multiple rules (#11133) 5 years ago
hacking-on-gitea.en-us.md Few tweaks in the hacking guide (#11345) 5 years ago
hacking-on-gitea.zh-cn.md ZH-CN translation of Advanced part (#5090) 6 years ago
logging-documentation.en-us.md Allow log.xxx.default to set logging settings for the default logger only (#11292) 5 years ago
mail-templates-us.md Add review comments to mail notifications (#8996) 5 years ago
make.en-us.md General documentation cleanup (#3317) 7 years ago
make.fr-fr.md General documentation cleanup (#3317) 7 years ago
make.zh-cn.md ZH-CN translation of Advanced part (#5090) 6 years ago
migrations.en-us.md update (#10079) 5 years ago
oauth2-provider.md Add oauth2 documentation (#6604) 6 years ago
repo-indexer.en-us.md Add detected file language to code search (#10256) 5 years ago
search-engines-indexation.en-us.md More extensive robots.txt docs (#9566) 5 years ago
signing.en-us.md Re-order GPG signing docs and fix code blocks (#10349) 5 years ago
specific-variables.en-us.md Copyedit docs (#6275) 6 years ago
specific-variables.zh-cn.md ZH-CN translation of Advanced part (#5090) 6 years ago
third-party-tools.en-us.md Add notice for awesome-gitea (#10612) 5 years ago
third-party-tools.zh-cn.md Create third-party-tools.zh-cn.md (#6303) 5 years ago