Clean invisible chars and adjust "__" for server and client use (#715)
* Rewrite __ to be usable on server side * Add changelog entry * Clean invisible characters from primaryModValue * Revert "Rewrite __ to be usable on server side" This reverts commit 53f63c01f3b56c5530955323612826c0ac5dc5d3. * Make pass-through placeholder for __ fn until it can be adapted for node. * Switch messagages to inline interpolation until i18n done Co-authored-by: Thomas Zarebczan <tzarebczan@users.noreply.github.com>
This commit is contained in:
parent
2eadd986b4
commit
179bd44665
2 changed files with 9 additions and 4 deletions
|
@ -28,6 +28,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
- Fix playlist preview thumbnail ([#7178](https://github.com/lbryio/lbry-desktop/pull/7178)
|
||||
- Fixed “Your Account” popup on mobile ([#7172](https://github.com/lbryio/lbry-desktop/pull/7172))
|
||||
- Fix disable-support for comments ([#7245](https://github.com/lbryio/lbry-desktop/pull/7245))
|
||||
- Fix issue with extra characters appended to url ([#715](https://github.com/OdyseeTeam/odysee-frontend/pull/715))
|
||||
- Supress erroneous dependency warnings ([#711](https://github.com/OdyseeTeam/odysee-frontend/pull/711))
|
||||
|
||||
## [0.51.2] - [2021-08-20]
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
// Disabled flow in this copy. This copy is for uncompiled web server ES5 require()s.
|
||||
|
||||
// Placeholder until i18n can be adapted for node usage
|
||||
const __ = (msg) => msg;
|
||||
|
||||
const isProduction = process.env.NODE_ENV === 'production';
|
||||
const channelNameMinLength = 1;
|
||||
const claimIdMaxLength = 40;
|
||||
|
@ -60,12 +63,13 @@ function parseURI(url, requireProto = false) {
|
|||
const [
|
||||
streamNameOrChannelName,
|
||||
primaryModSeparator,
|
||||
primaryModValue,
|
||||
rawPrimaryModValue,
|
||||
pathSep, // eslint-disable-line no-unused-vars
|
||||
possibleStreamName,
|
||||
secondaryModSeparator,
|
||||
secondaryModValue,
|
||||
] = rest;
|
||||
const primaryModValue = rawPrimaryModValue && rawPrimaryModValue.replace(/[^\x00-\x7F]/g, '');
|
||||
const searchParams = new URLSearchParams(qs || '');
|
||||
const startTime = searchParams.get('t');
|
||||
|
||||
|
@ -96,7 +100,7 @@ function parseURI(url, requireProto = false) {
|
|||
|
||||
if (channelName.length < channelNameMinLength) {
|
||||
throw new Error(
|
||||
__(`Channel names must be at least %channelNameMinLength% characters.`, {
|
||||
__(`Channel names must be at least ${channelNameMinLength} characters.`, {
|
||||
channelNameMinLength,
|
||||
})
|
||||
);
|
||||
|
@ -145,7 +149,7 @@ function parseURIModifier(modSeperator, modValue) {
|
|||
|
||||
if (modSeperator) {
|
||||
if (!modValue) {
|
||||
throw new Error(__(`No modifier provided after separator %modSeperator%.`, { modSeperator }));
|
||||
throw new Error(__(`No modifier provided after separator ${modSeperator}.`, { modSeperator }));
|
||||
}
|
||||
|
||||
if (modSeperator === MOD_CLAIM_ID_SEPARATOR || MOD_CLAIM_ID_SEPARATOR_OLD) {
|
||||
|
@ -158,7 +162,7 @@ function parseURIModifier(modSeperator, modValue) {
|
|||
}
|
||||
|
||||
if (claimId && (claimId.length > claimIdMaxLength || !claimId.match(/^[0-9a-f]+$/))) {
|
||||
throw new Error(__(`Invalid claim ID %claimId%.`, { claimId }));
|
||||
throw new Error(__(`Invalid claim ID ${claimId}.`, { claimId }));
|
||||
}
|
||||
|
||||
if (claimSequence && !claimSequence.match(/^-?[1-9][0-9]*$/)) {
|
||||
|
|
Loading…
Reference in a new issue