diff options
| -rw-r--r-- | CREDITS.md | 1 | ||||
| -rw-r--r-- | app/views/feed/add.phtml | 2 | ||||
| -rw-r--r-- | app/views/helpers/feed/update.phtml | 2 | ||||
| -rw-r--r-- | p/scripts/extra.js | 9 |
4 files changed, 9 insertions, 5 deletions
diff --git a/CREDITS.md b/CREDITS.md index 5f73f7399..11d4168ca 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -289,6 +289,7 @@ People are sorted by name so please keep this order. * [tonitonae](https://github.com/tonitonae): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:tonitonae) * [Troy Engel](https://github.com/troyengel): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:troyengel) * [TryAllTheThings](https://github.com/tryallthethings): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:tryallthethings) +* [Tsung-Han Yu](https://github.com/johan456789): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:johan456789), [Web](https://tsunghanyu.com/) * [Twilek-de](https://github.com/Twilek-de): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:Twilek-de) * [Uncovery](https://github.com/uncovery): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:uncovery) * [upskaling](https://github.com/upskaling): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:upskaling) diff --git a/app/views/feed/add.phtml b/app/views/feed/add.phtml index a30ce19a1..1fd659688 100644 --- a/app/views/feed/add.phtml +++ b/app/views/feed/add.phtml @@ -50,7 +50,7 @@ <a class="btn open-url" target="_blank" rel="noreferrer" href="<?= $this->feed->url() ?>" data-input="url" title="<?= _t('gen.action.open_url') ?>"><?= _i('link') ?></a> </div> <br /> - <a class="btn" target="_blank" rel="noreferrer" href="https://validator.w3.org/feed/check.cgi?url=<?= $this->feed->url() ?>"><?= _t('sub.feed.validator') ?></a> + <a class="btn open-url" target="_blank" rel="noreferrer" data-input="url" data-prefix="https://validator.w3.org/feed/check.cgi?url=" data-encode="1" href="https://validator.w3.org/feed/check.cgi?url=<?= $this->feed->url() ?>"><?= _t('sub.feed.validator') ?></a> </div> </div> <div class="form-group"> diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtml index 3cdeb3f35..001b88c1f 100644 --- a/app/views/helpers/feed/update.phtml +++ b/app/views/helpers/feed/update.phtml @@ -95,7 +95,7 @@ <input type="url" name="url" id="url" value="<?= $this->feed->url() ?>" required="required" /> <a class="btn open-url" target="_blank" rel="noreferrer" href="<?= $this->feed->url() ?>" data-input="url" title="<?= _t('gen.action.open_url') ?>"><?= _i('link') ?></a> </div> - <a class="btn" target="_blank" rel="noreferrer" href="https://validator.w3.org/feed/check.cgi?url=<?= + <a class="btn open-url" target="_blank" rel="noreferrer" data-input="url" data-prefix="https://validator.w3.org/feed/check.cgi?url=" data-encode="1" href="https://validator.w3.org/feed/check.cgi?url=<?= rawurlencode(htmlspecialchars_decode($this->feed->url(), ENT_QUOTES)) ?>"><?= _t('sub.feed.validator') ?></a> </div> </div> diff --git a/p/scripts/extra.js b/p/scripts/extra.js index 6f896f959..43bbd89f5 100644 --- a/p/scripts/extra.js +++ b/p/scripts/extra.js @@ -395,11 +395,14 @@ function close_slider_listener(ev) { } // </slider> -// overwrites the href attribute from the url input +// updates href from the input value, with optional prefix/encoding function updateHref(ev) { const urlField = document.getElementById(this.getAttribute('data-input')); - const url = urlField.value; - if (url.length > 0) { + const rawUrl = urlField.value; + const prefix = this.getAttribute('data-prefix') || ''; + const shouldEncode = this.getAttribute('data-encode') === '1'; + const url = prefix + (shouldEncode ? encodeURIComponent(rawUrl) : rawUrl); + if (rawUrl.length > 0) { this.href = url; return true; } else { |
