diff --git a/.eslintrc.json b/.eslintrc.json index 90984b76b..ca6035fa1 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -24,6 +24,7 @@ "rules": { "comma-dangle": ["error", "always-multiline"], "handle-callback-err": 0, + "indent": 0, "jsx-quotes": ["error", "prefer-double"], "new-cap": 0, "no-multi-spaces": 0, diff --git a/build/icon.ico b/build/icon.ico new file mode 100644 index 000000000..f8a33ff7c Binary files /dev/null and b/build/icon.ico differ diff --git a/flow-typed/publish.js b/flow-typed/publish.js index 1de7a4b43..27f626c6d 100644 --- a/flow-typed/publish.js +++ b/flow-typed/publish.js @@ -3,7 +3,7 @@ declare type UpdatePublishFormData = { filePath?: string, contentIsFree?: boolean, - price?: { + fee?: { amount: number, currency: string, }, @@ -23,7 +23,7 @@ declare type UpdatePublishFormData = { licenseUrl?: string, licenseType?: string, uri?: string, - replace?: boolean, + nsfw: boolean, }; declare type PublishParams = { @@ -43,12 +43,9 @@ declare type PublishParams = { license: ?string, licenseUrl: ?string, fee?: { + amount: string, currency: string, - amount: number, }, - replace?: boolean, - - // This is bad. - // Will be removed for tags soon + claim: StreamClaim, nsfw: boolean, }; diff --git a/package.json b/package.json index 00bd237da..af107dd5b 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,7 @@ "jsmediatags": "^3.8.1", "json-loader": "^0.5.4", "lbry-format": "https://github.com/lbryio/lbry-format.git", - "lbry-redux": "lbryio/lbry-redux#32916b04e4888c06a9bb2b07c57ce6821a4acf1a", + "lbry-redux": "lbryio/lbry-redux#c8126ab21792d7a85e1123a2363af285a0263654", "lbryinc": "lbryio/lbryinc#43d382d9b74d396a581a74d87e4c53105e04f845", "lint-staged": "^7.0.2", "localforage": "^1.7.1", diff --git a/src/platforms/electron/createWindow.js b/src/platforms/electron/createWindow.js index 1d72869e9..79f7ed769 100644 --- a/src/platforms/electron/createWindow.js +++ b/src/platforms/electron/createWindow.js @@ -1,4 +1,3 @@ -import path from 'path'; import { app, BrowserWindow, dialog, shell, screen } from 'electron'; import isDev from 'electron-is-dev'; import windowStateKeeper from 'electron-window-state'; @@ -28,7 +27,7 @@ export default appState => { // If state is undefined, create window as maximized. width: windowState.width === undefined ? width : windowState.width, height: windowState.height === undefined ? height : windowState.height, - icon: 'static/img/tray/default/tray.png', + icon: 'static/img/tray/windows/tray.png', webPreferences: { // Disable renderer process's webSecurity on development to enable CORS. webSecurity: !isDev, diff --git a/src/ui/component/publishForm/view.jsx b/src/ui/component/publishForm/view.jsx index 6c31cad3d..3b2e21f39 100644 --- a/src/ui/component/publishForm/view.jsx +++ b/src/ui/component/publishForm/view.jsx @@ -28,7 +28,7 @@ type Props = { language: string, nsfw: boolean, contentIsFree: boolean, - price: { + fee: { amount: number, currency: string, }, @@ -71,10 +71,13 @@ class PublishForm extends React.PureComponent { } componentDidMount() { - const { thumbnail } = this.props; + const { thumbnail, name, channel, editingURI } = this.props; if (!thumbnail) { this.props.resetThumbnailStatus(); } + if (editingURI) { + this.getNewUri(name, channel); + } } getNewUri(name: string, channel: string) { @@ -156,7 +159,7 @@ class PublishForm extends React.PureComponent { let previousBidAmount = 0; if (myClaimForUri) { - previousBidAmount = myClaimForUri.amount; + previousBidAmount = Number(myClaimForUri.amount); } const totalAvailableBidAmount = previousBidAmount + balance; @@ -217,10 +220,11 @@ class PublishForm extends React.PureComponent { otherLicenseDescription, name: this.props.name || undefined, contentIsFree: this.props.contentIsFree, - price: this.props.price, + fee: this.props.fee, uri: this.props.uri || undefined, channel: this.props.channel, isStillEditing: this.props.isStillEditing, + claim: this.props.myClaimForUri, }; publish(publishParams); @@ -292,7 +296,7 @@ class PublishForm extends React.PureComponent { language, nsfw, contentIsFree, - price, + fee, channel, name, updatePublishForm, @@ -440,11 +444,11 @@ class PublishForm extends React.PureComponent { updatePublishForm({ price: newPrice })} + price={fee} + onChange={newFee => updatePublishForm({ fee: newFee })} /> )} - {price.currency !== 'LBC' && ( + {fee && fee.currency !== 'LBC' && (

{__( 'All content fees are charged in LBC. For non-LBC payment methods, the number of credits charged will be adjusted based on the value of LBRY credits at the time of purchase.' diff --git a/src/ui/modal/modalRemoveFile/index.js b/src/ui/modal/modalRemoveFile/index.js index 59d0cdb70..874671d21 100644 --- a/src/ui/modal/modalRemoveFile/index.js +++ b/src/ui/modal/modalRemoveFile/index.js @@ -1,6 +1,11 @@ import { connect } from 'react-redux'; import { doDeleteFileAndMaybeGoBack } from 'redux/actions/file'; -import { makeSelectTitleForUri, makeSelectClaimIsMine, makeSelectFileInfoForUri } from 'lbry-redux'; +import { + makeSelectTitleForUri, + makeSelectClaimIsMine, + makeSelectFileInfoForUri, + makeSelectClaimForUri, +} from 'lbry-redux'; import { doHideModal } from 'redux/actions/app'; import ModalRemoveFile from './view'; @@ -8,6 +13,7 @@ const select = (state, props) => ({ claimIsMine: makeSelectClaimIsMine(props.uri)(state), title: makeSelectTitleForUri(props.uri)(state), fileInfo: makeSelectFileInfoForUri(props.uri)(state), + claim: makeSelectClaimForUri(props.uri)(state), }); const perform = dispatch => ({ diff --git a/src/ui/modal/modalRemoveFile/view.jsx b/src/ui/modal/modalRemoveFile/view.jsx index 112387f96..368683d1a 100644 --- a/src/ui/modal/modalRemoveFile/view.jsx +++ b/src/ui/modal/modalRemoveFile/view.jsx @@ -4,6 +4,7 @@ import { Modal } from 'modal/modal'; import { FormField } from 'component/common/form'; type Props = { + claim: StreamClaim, claimIsMine: boolean, closeModal: () => void, deleteFile: (string, boolean, boolean) => void, @@ -45,10 +46,11 @@ class ModalRemoveFile extends React.PureComponent { } render() { - const { claimIsMine, closeModal, deleteFile, fileInfo, title } = this.props; + const { claim, claimIsMine, closeModal, deleteFile, fileInfo, title } = this.props; const { deleteChecked, abandonClaimChecked } = this.state; + const { txid, nout } = claim; + const outpoint = fileInfo ? fileInfo.outpoint : `${txid}:${nout}`; - const outpoint = fileInfo ? fileInfo.outpoint : ''; return ( (dispatch: Dis contentIsFree: !fee.amount, author, description, - fee, + fee: { amount: fee.amount, currency: fee.currency }, languages, thumbnail: thumbnail ? thumbnail.url : null, title, uri, uploadThumbnailStatus: thumbnail ? THUMBNAIL_STATUSES.MANUAL : undefined, licenseUrl, - replace: true, + nsfw: isClaimNsfw(claim), }; // Make sure custom liscence's are mapped properly @@ -203,6 +204,7 @@ export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getStat fee, uri, nsfw, + claim, } = params; // get the claim id from the channel name, we will use that instead @@ -214,36 +216,58 @@ export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getStat channel_id?: string, bid: number, file_path?: string, - fee?: { amount: string, currency: string }, tags: Array, + locations?: Array, + license_url?: string, + thumbnail_url?: string, + release_time?: number, + fee_currency?: string, + fee_amount?: string, } = { name, bid: creditsToString(bid), title, license, - license_url: licenseUrl, languages: [language], description, - thumbnail_url: thumbnail, - tags: [], + tags: (claim && claim.value.tags) || [], + locations: claim && claim.value.locations, }; // Temporary solution to keep the same publish flow with the new tags api // Eventually we will allow users to enter their own tags on publish // `nsfw` will probably be removed + + if (licenseUrl) { + publishPayload.license_url = licenseUrl; + } + + if (thumbnail) { + publishPayload.thumbnail_url = thumbnail; + } + + if (claim && claim.value.release_time) { + publishPayload.release_time = Number(claim.value.release_time); + } + if (nsfw) { - publishPayload.tags.push('mature'); + if (!publishPayload.tags.includes('mature')) { + publishPayload.tags.push('mature'); + } + } else { + const indexToRemove = publishPayload.tags.indexOf('mature'); + if (indexToRemove > -1) { + publishPayload.tags.splice(indexToRemove, 1); + } } if (channelId) { publishPayload.channel_id = channelId; } - if (fee) { - publishPayload.fee = { - currency: fee.currency, - amount: creditsToString(fee.amount), - }; + if (!contentIsFree && fee && (fee.currency && Number(fee.amount) > 0)) { + publishPayload.fee_currency = fee.currency; + publishPayload.fee_amount = creditsToString(fee.amount); } // Only pass file on new uploads, not metadata only edits. diff --git a/src/ui/redux/reducers/publish.js b/src/ui/redux/reducers/publish.js index 43b70d66c..b49049361 100644 --- a/src/ui/redux/reducers/publish.js +++ b/src/ui/redux/reducers/publish.js @@ -9,7 +9,7 @@ type PublishState = { editingURI: ?string, filePath: ?string, contentIsFree: boolean, - price: { + fee: { amount: number, currency: string, }, @@ -33,7 +33,7 @@ const defaultState: PublishState = { editingURI: undefined, filePath: undefined, contentIsFree: true, - price: { + fee: { amount: 1, currency: 'LBC', }, diff --git a/yarn.lock b/yarn.lock index 62f19613f..1c88b4d11 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6498,9 +6498,9 @@ lazy-val@^1.0.3, lazy-val@^1.0.4: yargs "^13.2.2" zstd-codec "^0.1.1" -lbry-redux@lbryio/lbry-redux#32916b04e4888c06a9bb2b07c57ce6821a4acf1a: +lbry-redux@lbryio/lbry-redux#423123f1c19e61cead67c745d0892a2e4481cb6a: version "0.0.1" - resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/32916b04e4888c06a9bb2b07c57ce6821a4acf1a" + resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/423123f1c19e61cead67c745d0892a2e4481cb6a" dependencies: proxy-polyfill "0.1.6" reselect "^3.0.0" @@ -6696,7 +6696,7 @@ lodash-es@^4.17.11, lodash-es@^4.17.4, lodash-es@^4.2.1: resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.11.tgz#145ab4a7ac5c5e52a3531fb4f310255a152b4be0" integrity sha512-DHb1ub+rMjjrxqlB3H56/6MXtm1lSksDp2rA2cNWjG8mlDUYFhUj3Di2Zn5IwSU87xLv8tNIQ7sSwE/YOX/D/Q== -lodash.assign@^4.0.3, lodash.assign@^4.0.6, lodash.assign@^4.2.0: +lodash.assign@^4.0.3, lodash.assign@^4.0.6: version "4.2.0" resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-4.2.0.tgz#0d99f3ccd7a6d261d19bdaeb9245005d285808e7" integrity sha1-DZnzzNem0mHRm9rrkkUAXShYCOc= @@ -6706,11 +6706,6 @@ lodash.camelcase@^4.3.0: resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" integrity sha1-soqmKIorn8ZRA1x3EfZathkDMaY= -lodash.clonedeep@^4.3.2: - version "4.5.0" - resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" - integrity sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8= - lodash.findkey@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/lodash.findkey/-/lodash.findkey-4.6.0.tgz#83058e903b51cbb759d09ccf546dea3ea39c4718" @@ -6746,11 +6741,6 @@ lodash.memoize@^4.1.2: resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4= -lodash.mergewith@^4.6.0: - version "4.6.1" - resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.1.tgz#639057e726c3afbdb3e7d42741caa8d6e4335927" - integrity sha512-eWw5r+PYICtEBgrBE5hhlT6aAa75f411bgDz/ZL2KZqYV03USvucsxcHUIlGTDTECs1eunpI7HOV7U+WLDvNdQ== - lodash.pickby@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/lodash.pickby/-/lodash.pickby-4.6.0.tgz#7dea21d8c18d7703a27c704c15d3b84a67e33aff" @@ -7375,7 +7365,7 @@ nan@2.12.1: resolved "https://registry.yarnpkg.com/nan/-/nan-2.12.1.tgz#7b1aa193e9aa86057e3c7bbd0ac448e770925552" integrity sha512-JY7V6lRkStKcKTvHO5NVSQRv+RV+FIL5pvDoLiAtSL9pKlC5x9PKQcZDsq7m4FO4d57mkhC6Z+QhAh3Jdk5JFw== -nan@^2.10.0, nan@^2.9.2: +nan@^2.13.2, nan@^2.9.2: version "2.13.2" resolved "https://registry.yarnpkg.com/nan/-/nan-2.13.2.tgz#f51dc7ae66ba7d5d55e1e6d4d8092e802c9aefe7" integrity sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw== @@ -7556,9 +7546,9 @@ node-releases@^1.1.13: semver "^5.3.0" node-sass@^4.11.0: - version "4.11.0" - resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.11.0.tgz#183faec398e9cbe93ba43362e2768ca988a6369a" - integrity sha512-bHUdHTphgQJZaF1LASx0kAviPH7sGlcyNhWade4eVIpFp6tsn7SV8xNMTbsQFpEV9VXpnwTTnNYlfsZXgGgmkA== + version "4.12.0" + resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.12.0.tgz#0914f531932380114a30cc5fa4fa63233a25f017" + integrity sha512-A1Iv4oN+Iel6EPv77/HddXErL2a+gZ4uBeZUy+a8O35CFYTXhgA8MgLCWBtwpGZdCvTvQ9d+bQxX/QC36GDPpQ== dependencies: async-foreach "^0.1.3" chalk "^1.1.1" @@ -7567,12 +7557,10 @@ node-sass@^4.11.0: get-stdin "^4.0.1" glob "^7.0.3" in-publish "^2.0.0" - lodash.assign "^4.2.0" - lodash.clonedeep "^4.3.2" - lodash.mergewith "^4.6.0" + lodash "^4.17.11" meow "^3.7.0" mkdirp "^0.5.1" - nan "^2.10.0" + nan "^2.13.2" node-gyp "^3.8.0" npmlog "^4.0.0" request "^2.88.0"