prettify all the files
This commit is contained in:
parent
202570f286
commit
aaec1f3a48
13 changed files with 368 additions and 353 deletions
18
ui/js/app.js
18
ui/js/app.js
|
@ -1,15 +1,15 @@
|
|||
import store from 'store.js';
|
||||
import lbry from './lbry.js';
|
||||
import store from "store.js";
|
||||
import lbry from "./lbry.js";
|
||||
|
||||
const env = ENV;
|
||||
const config = require(`./config/${env}`);
|
||||
const language = lbry.getClientSetting('language')
|
||||
? lbry.getClientSetting('language')
|
||||
: 'en';
|
||||
const i18n = require('y18n')({
|
||||
directory: 'app/locales',
|
||||
const language = lbry.getClientSetting("language")
|
||||
? lbry.getClientSetting("language")
|
||||
: "en";
|
||||
const i18n = require("y18n")({
|
||||
directory: "app/locales",
|
||||
updateFiles: false,
|
||||
locale: language
|
||||
locale: language,
|
||||
});
|
||||
const logs = [];
|
||||
const app = {
|
||||
|
@ -21,7 +21,7 @@ const app = {
|
|||
log: function(message) {
|
||||
console.log(message);
|
||||
logs.push(message);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
window.__ = i18n.__;
|
||||
|
|
|
@ -4,11 +4,9 @@ import { doFetchCostInfoForUri } from "actions/cost_info";
|
|||
import {
|
||||
makeSelectCostInfoForUri,
|
||||
makeSelectFetchingCostInfoForUri,
|
||||
} from 'selectors/cost_info'
|
||||
import {
|
||||
makeSelectClaimForUri,
|
||||
} from 'selectors/claims'
|
||||
import FilePrice from './view'
|
||||
} from "selectors/cost_info";
|
||||
import { makeSelectClaimForUri } from "selectors/claims";
|
||||
import FilePrice from "./view";
|
||||
|
||||
const makeSelect = () => {
|
||||
const selectCostInfoForUri = makeSelectCostInfoForUri();
|
||||
|
|
|
@ -46,7 +46,9 @@ class UserEmailVerify extends React.PureComponent {
|
|||
{/* render help separately so it always shows */}
|
||||
<div className="form-field__helper">
|
||||
<p>
|
||||
{__("Email")} <Link href="mailto:help@lbry.io" label="help@lbry.io" /> {__("if you did not receive or are having trouble with your code.")}
|
||||
{__("Email")}{" "}
|
||||
<Link href="mailto:help@lbry.io" label="help@lbry.io" />{" "}
|
||||
{__("if you did not receive or are having trouble with your code.")}
|
||||
</p>
|
||||
</div>
|
||||
<div className="form-row-submit form-row-submit--with-footer">
|
||||
|
|
|
@ -13,12 +13,16 @@ class WelcomeModal extends React.PureComponent {
|
|||
<section>
|
||||
<h3 className="modal__header">{__("Welcome to LBRY.")}</h3>
|
||||
<p>
|
||||
{__("Using LBRY is like dating a centaur. Totally normal up top, and")}
|
||||
{__(
|
||||
"Using LBRY is like dating a centaur. Totally normal up top, and"
|
||||
)}
|
||||
{" "}<em>{__("way different")}</em> {__("underneath.")}
|
||||
</p>
|
||||
<p>{__("Up top, LBRY is similar to popular media sites.")}</p>
|
||||
<p>
|
||||
{__("Below, LBRY is controlled by users -- you -- via blockchain and decentralization.")}
|
||||
{__(
|
||||
"Below, LBRY is controlled by users -- you -- via blockchain and decentralization."
|
||||
)}
|
||||
</p>
|
||||
<p>
|
||||
{__("Thank you for making content freedom possible!")}
|
||||
|
@ -50,16 +54,24 @@ class WelcomeModal extends React.PureComponent {
|
|||
{" "}{__("LBRY credits, or")} <em>{__("LBC")}</em>.
|
||||
</p>
|
||||
<p>
|
||||
{__("This reward will show in your Wallet momentarily, probably while you are reading this message.")}
|
||||
{__(
|
||||
"This reward will show in your Wallet momentarily, probably while you are reading this message."
|
||||
)}
|
||||
</p>
|
||||
<p>
|
||||
{__("LBC is used to compensate creators, to publish, and to have say in how the network works.")}
|
||||
{__(
|
||||
"LBC is used to compensate creators, to publish, and to have say in how the network works."
|
||||
)}
|
||||
</p>
|
||||
<p>
|
||||
{__("No need to understand it all just yet! Try watching or downloading something next.")}
|
||||
{__(
|
||||
"No need to understand it all just yet! Try watching or downloading something next."
|
||||
)}
|
||||
</p>
|
||||
<p>
|
||||
{__("Finally, know that LBRY is an early beta and that it earns the name.")}
|
||||
{__(
|
||||
"Finally, know that LBRY is an early beta and that it earns the name."
|
||||
)}
|
||||
</p>
|
||||
</section>
|
||||
</Modal>;
|
||||
|
|
|
@ -10,36 +10,36 @@ jsonrpc.call = function(
|
|||
timeout
|
||||
) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
if (typeof connectFailedCallback !== 'undefined') {
|
||||
if (typeof connectFailedCallback !== "undefined") {
|
||||
if (timeout) {
|
||||
xhr.timeout = timeout;
|
||||
}
|
||||
|
||||
xhr.addEventListener('error', function(e) {
|
||||
xhr.addEventListener("error", function(e) {
|
||||
connectFailedCallback(e);
|
||||
});
|
||||
xhr.addEventListener('timeout', function() {
|
||||
xhr.addEventListener("timeout", function() {
|
||||
connectFailedCallback(
|
||||
new Error(__('XMLHttpRequest connection timed out'))
|
||||
new Error(__("XMLHttpRequest connection timed out"))
|
||||
);
|
||||
});
|
||||
}
|
||||
xhr.addEventListener('load', function() {
|
||||
xhr.addEventListener("load", function() {
|
||||
var response = JSON.parse(xhr.responseText);
|
||||
|
||||
if (response.error) {
|
||||
if (errorCallback) {
|
||||
errorCallback(response.error);
|
||||
} else {
|
||||
var errorEvent = new CustomEvent('unhandledError', {
|
||||
var errorEvent = new CustomEvent("unhandledError", {
|
||||
detail: {
|
||||
connectionString: connectionString,
|
||||
method: method,
|
||||
params: params,
|
||||
code: response.error.code,
|
||||
message: response.error.message,
|
||||
data: response.error.data
|
||||
}
|
||||
data: response.error.data,
|
||||
},
|
||||
});
|
||||
document.dispatchEvent(errorEvent);
|
||||
}
|
||||
|
@ -49,37 +49,37 @@ jsonrpc.call = function(
|
|||
});
|
||||
|
||||
if (connectFailedCallback) {
|
||||
xhr.addEventListener('error', function(event) {
|
||||
xhr.addEventListener("error", function(event) {
|
||||
connectFailedCallback(event);
|
||||
});
|
||||
} else {
|
||||
xhr.addEventListener('error', function(event) {
|
||||
var errorEvent = new CustomEvent('unhandledError', {
|
||||
xhr.addEventListener("error", function(event) {
|
||||
var errorEvent = new CustomEvent("unhandledError", {
|
||||
detail: {
|
||||
connectionString: connectionString,
|
||||
method: method,
|
||||
params: params,
|
||||
code: xhr.status,
|
||||
message: __('Connection to API server failed')
|
||||
}
|
||||
message: __("Connection to API server failed"),
|
||||
},
|
||||
});
|
||||
document.dispatchEvent(errorEvent);
|
||||
});
|
||||
}
|
||||
|
||||
const counter = parseInt(sessionStorage.getItem('JSONRPCCounter') || 0);
|
||||
const counter = parseInt(sessionStorage.getItem("JSONRPCCounter") || 0);
|
||||
|
||||
xhr.open('POST', connectionString, true);
|
||||
xhr.open("POST", connectionString, true);
|
||||
xhr.send(
|
||||
JSON.stringify({
|
||||
jsonrpc: '2.0',
|
||||
jsonrpc: "2.0",
|
||||
method: method,
|
||||
params: params,
|
||||
id: counter
|
||||
id: counter,
|
||||
})
|
||||
);
|
||||
|
||||
sessionStorage.setItem('JSONRPCCounter', counter + 1);
|
||||
sessionStorage.setItem("JSONRPCCounter", counter + 1);
|
||||
|
||||
return xhr;
|
||||
};
|
||||
|
|
|
@ -458,7 +458,6 @@ lbry.claim_list_mine = function(params = {}) {
|
|||
});
|
||||
};
|
||||
|
||||
|
||||
lbry._resolveXhrs = {};
|
||||
lbry.resolve = function(params = {}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
|
|
@ -28,10 +28,10 @@ const lbryuri = {};
|
|||
lbryuri.parse = function(uri, requireProto = false) {
|
||||
// Break into components. Empty sub-matches are converted to null
|
||||
const componentsRegex = new RegExp(
|
||||
'^((?:lbry://)?)' + // protocol
|
||||
'([^:$#/]*)' + // name (stops at the first separator or end)
|
||||
'([:$#]?)([^/]*)' + // modifier separator, modifier (stops at the first path separator or end)
|
||||
'(/?)(.*)' // path separator, path
|
||||
"^((?:lbry://)?)" + // protocol
|
||||
"([^:$#/]*)" + // name (stops at the first separator or end)
|
||||
"([:$#]?)([^/]*)" + // modifier separator, modifier (stops at the first path separator or end)
|
||||
"(/?)(.*)" // path separator, path
|
||||
);
|
||||
const [proto, name, modSep, modVal, pathSep, path] = componentsRegex
|
||||
.exec(uri)
|
||||
|
@ -42,20 +42,20 @@ lbryuri.parse = function(uri, requireProto = false) {
|
|||
|
||||
// Validate protocol
|
||||
if (requireProto && !proto) {
|
||||
throw new Error(__('LBRY URIs must include a protocol prefix (lbry://).'));
|
||||
throw new Error(__("LBRY URIs must include a protocol prefix (lbry://)."));
|
||||
}
|
||||
|
||||
// Validate and process name
|
||||
if (!name) {
|
||||
throw new Error(__('URI does not include name.'));
|
||||
throw new Error(__("URI does not include name."));
|
||||
}
|
||||
|
||||
const isChannel = name.startsWith('@');
|
||||
const isChannel = name.startsWith("@");
|
||||
const channelName = isChannel ? name.slice(1) : name;
|
||||
|
||||
if (isChannel) {
|
||||
if (!channelName) {
|
||||
throw new Error(__('No channel name after @.'));
|
||||
throw new Error(__("No channel name after @."));
|
||||
}
|
||||
|
||||
if (channelName.length < CHANNEL_NAME_MIN_LEN) {
|
||||
|
@ -75,8 +75,8 @@ lbryuri.parse = function(uri, requireProto = false) {
|
|||
throw new Error(
|
||||
__(
|
||||
`Invalid character %s in name: %s.`,
|
||||
nameBadChars.length == 1 ? '' : 's',
|
||||
nameBadChars.join(', ')
|
||||
nameBadChars.length == 1 ? "" : "s",
|
||||
nameBadChars.join(", ")
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -88,11 +88,11 @@ lbryuri.parse = function(uri, requireProto = false) {
|
|||
throw new Error(__(`No modifier provided after separator %s.`, modSep));
|
||||
}
|
||||
|
||||
if (modSep == '#') {
|
||||
if (modSep == "#") {
|
||||
claimId = modVal;
|
||||
} else if (modSep == ':') {
|
||||
} else if (modSep == ":") {
|
||||
claimSequence = modVal;
|
||||
} else if (modSep == '$') {
|
||||
} else if (modSep == "$") {
|
||||
bidPosition = modVal;
|
||||
}
|
||||
}
|
||||
|
@ -105,17 +105,17 @@ lbryuri.parse = function(uri, requireProto = false) {
|
|||
}
|
||||
|
||||
if (claimSequence && !claimSequence.match(/^-?[1-9][0-9]*$/)) {
|
||||
throw new Error(__('Claim sequence must be a number.'));
|
||||
throw new Error(__("Claim sequence must be a number."));
|
||||
}
|
||||
|
||||
if (bidPosition && !bidPosition.match(/^-?[1-9][0-9]*$/)) {
|
||||
throw new Error(__('Bid position must be a number.'));
|
||||
throw new Error(__("Bid position must be a number."));
|
||||
}
|
||||
|
||||
// Validate and process path
|
||||
if (path) {
|
||||
if (!isChannel) {
|
||||
throw new Error(__('Only channel URIs may have a path.'));
|
||||
throw new Error(__("Only channel URIs may have a path."));
|
||||
}
|
||||
|
||||
const pathBadChars = path.match(/[^A-Za-z0-9-]/g);
|
||||
|
@ -123,15 +123,15 @@ lbryuri.parse = function(uri, requireProto = false) {
|
|||
throw new Error(
|
||||
__(
|
||||
`Invalid character %s in path: %s`,
|
||||
count == 1 ? '' : 's',
|
||||
nameBadChars.join(', ')
|
||||
count == 1 ? "" : "s",
|
||||
nameBadChars.join(", ")
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
contentName = path;
|
||||
} else if (pathSep) {
|
||||
throw new Error(__('No path provided after /'));
|
||||
throw new Error(__("No path provided after /"));
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -143,7 +143,7 @@ lbryuri.parse = function(uri, requireProto = false) {
|
|||
...(claimSequence ? { claimSequence: parseInt(claimSequence) } : {}),
|
||||
...(bidPosition ? { bidPosition: parseInt(bidPosition) } : {}),
|
||||
...(claimId ? { claimId } : {}),
|
||||
...(path ? { path } : {})
|
||||
...(path ? { path } : {}),
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -160,13 +160,13 @@ lbryuri.build = function(uriObj, includeProto = true, allowExtraProps = false) {
|
|||
bidPosition,
|
||||
path,
|
||||
contentName,
|
||||
channelName
|
||||
channelName,
|
||||
} = uriObj;
|
||||
|
||||
if (channelName) {
|
||||
const channelNameFormatted = channelName.startsWith('@')
|
||||
const channelNameFormatted = channelName.startsWith("@")
|
||||
? channelName
|
||||
: '@' + channelName;
|
||||
: "@" + channelName;
|
||||
if (!name) {
|
||||
name = channelNameFormatted;
|
||||
} else if (name !== channelNameFormatted) {
|
||||
|
@ -187,19 +187,19 @@ lbryuri.build = function(uriObj, includeProto = true, allowExtraProps = false) {
|
|||
if (path && path !== contentName) {
|
||||
throw new Error(
|
||||
__(
|
||||
'Path and contentName do not match. Only one is required; most likely you wanted contentName.'
|
||||
"Path and contentName do not match. Only one is required; most likely you wanted contentName."
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
(includeProto ? 'lbry://' : '') +
|
||||
(includeProto ? "lbry://" : "") +
|
||||
name +
|
||||
(claimId ? `#${claimId}` : '') +
|
||||
(claimSequence ? `:${claimSequence}` : '') +
|
||||
(bidPosition ? `\$${bidPosition}` : '') +
|
||||
(path ? `/${path}` : '')
|
||||
(claimId ? `#${claimId}` : "") +
|
||||
(claimSequence ? `:${claimSequence}` : "") +
|
||||
(bidPosition ? `\$${bidPosition}` : "") +
|
||||
(path ? `/${path}` : "")
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -223,7 +223,7 @@ lbryuri.isValid = function(uri) {
|
|||
};
|
||||
|
||||
lbryuri.isValidName = function(name, checkCase = true) {
|
||||
const regexp = new RegExp('^[a-z0-9-]+$', checkCase ? '' : 'i');
|
||||
const regexp = new RegExp("^[a-z0-9-]+$", checkCase ? "" : "i");
|
||||
return regexp.test(name);
|
||||
};
|
||||
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
import lbry from './lbry.js';
|
||||
import jsonrpc from './jsonrpc.js';
|
||||
import lbry from "./lbry.js";
|
||||
import jsonrpc from "./jsonrpc.js";
|
||||
|
||||
const queryTimeout = 3000;
|
||||
const maxQueryTries = 2;
|
||||
const defaultServers = [
|
||||
'http://lighthouse7.lbry.io:50005',
|
||||
'http://lighthouse8.lbry.io:50005',
|
||||
'http://lighthouse9.lbry.io:50005'
|
||||
"http://lighthouse7.lbry.io:50005",
|
||||
"http://lighthouse8.lbry.io:50005",
|
||||
"http://lighthouse9.lbry.io:50005",
|
||||
];
|
||||
const path = '/';
|
||||
const path = "/";
|
||||
|
||||
let server = null;
|
||||
let connectTryNum = 0;
|
||||
|
||||
function getServers() {
|
||||
return lbry.getClientSetting('useCustomLighthouseServers')
|
||||
? lbry.getClientSetting('customLighthouseServers')
|
||||
return lbry.getClientSetting("useCustomLighthouseServers")
|
||||
? lbry.getClientSetting("customLighthouseServers")
|
||||
: defaultServers;
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ const lighthouse = new Proxy(
|
|||
call(name, params, resolve, reject);
|
||||
});
|
||||
};
|
||||
}
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -5,9 +5,6 @@ import FileCard from "component/fileCard";
|
|||
import { BusyMessage } from "component/common.js";
|
||||
import ToolTip from "component/tooltip.js";
|
||||
|
||||
|
||||
|
||||
|
||||
const FeaturedCategory = props => {
|
||||
const { category, names } = props;
|
||||
|
||||
|
@ -19,7 +16,9 @@ const FeaturedCategory = props => {
|
|||
category.match(/^community/i) &&
|
||||
<ToolTip
|
||||
label={__("What's this?")}
|
||||
body={__("Community Content is a public space where anyone can share content with the rest of the LBRY community. Bid on the names \"one,\" \"two,\" \"three,\" \"four\" and \"five\" to put your content here!")}
|
||||
body={__(
|
||||
'Community Content is a public space where anyone can share content with the rest of the LBRY community. Bid on the names "one," "two," "three," "four" and "five" to put your content here!'
|
||||
)}
|
||||
className="tooltip--header"
|
||||
/>}
|
||||
</h3>
|
||||
|
|
|
@ -15,7 +15,8 @@ const perform = dispatch => ({
|
|||
back: () => dispatch(doHistoryBack()),
|
||||
navigate: path => dispatch(doNavigate(path)),
|
||||
fetchClaimListMine: () => dispatch(doFetchClaimListMine()),
|
||||
claimFirstChannelReward: () => dispatch(doClaimRewardType(rewards.TYPE_FIRST_CHANNEL)),
|
||||
claimFirstChannelReward: () =>
|
||||
dispatch(doClaimRewardType(rewards.TYPE_FIRST_CHANNEL)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(PublishPage);
|
||||
|
|
|
@ -437,7 +437,8 @@ class PublishPage extends React.PureComponent {
|
|||
return (
|
||||
<span>
|
||||
{__(
|
||||
'A deposit of at least one credit is required to win "%s". However, you can still get a permanent URL for any amount.', this.state.name
|
||||
'A deposit of at least one credit is required to win "%s". However, you can still get a permanent URL for any amount.',
|
||||
this.state.name
|
||||
)}
|
||||
</span>
|
||||
);
|
||||
|
@ -445,7 +446,9 @@ class PublishPage extends React.PureComponent {
|
|||
return (
|
||||
<span>
|
||||
{__(
|
||||
'A deposit of at least "%s" credits is required to win "%s". However, you can still get a permanent URL for any amount.', this.state.topClaimValue, this.state.name
|
||||
'A deposit of at least "%s" credits is required to win "%s". However, you can still get a permanent URL for any amount.',
|
||||
this.state.topClaimValue,
|
||||
this.state.name
|
||||
)}
|
||||
</span>
|
||||
);
|
||||
|
|
|
@ -60,7 +60,8 @@ const RewardsPage = props => {
|
|||
<p>{__("You are not eligible to claim rewards.")}</p>
|
||||
<p>
|
||||
{__("To become eligible, email")}
|
||||
{" "}<Link href="mailto:help@lbry.io" label="help@lbry.io" /> {__("with a link to a public social media profile.")}
|
||||
{" "}<Link href="mailto:help@lbry.io" label="help@lbry.io" />{" "}
|
||||
{__("with a link to a public social media profile.")}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue