add 'lbry-first' tag to lbry-first publishes
This commit is contained in:
parent
0f80568acd
commit
1523bbd33f
4 changed files with 52 additions and 34 deletions
24
dist/bundle.es.js
vendored
24
dist/bundle.es.js
vendored
|
@ -1261,14 +1261,17 @@ const LbryFirst = {
|
||||||
upload: (params = {}) => {
|
upload: (params = {}) => {
|
||||||
// Only upload when originally publishing for now
|
// Only upload when originally publishing for now
|
||||||
if (!params.file_path) {
|
if (!params.file_path) {
|
||||||
return {};
|
return new Promise();
|
||||||
}
|
}
|
||||||
const uploadParams = {};
|
|
||||||
uploadParams.Title = params.title;
|
const uploadParams = {
|
||||||
uploadParams.Description = params.description;
|
Title: params.title,
|
||||||
uploadParams.FilePath = params.file_path;
|
Description: params.description,
|
||||||
uploadParams.Category = '';
|
FilePath: params.file_path,
|
||||||
uploadParams.Keywords = '';
|
Category: '',
|
||||||
|
Keywords: ''
|
||||||
|
};
|
||||||
|
|
||||||
return lbryFirstCallWithResult('youtube.Upload', uploadParams);
|
return lbryFirstCallWithResult('youtube.Upload', uploadParams);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1350,7 +1353,6 @@ function apiCall$1(method, params, resolve, reject) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function lbryFirstCallWithResult(name, params = {}) {
|
function lbryFirstCallWithResult(name, params = {}) {
|
||||||
console.log(`LbryFirst: calling ${name}`);
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
apiCall$1(name, params, result => {
|
apiCall$1(name, params, result => {
|
||||||
resolve(result);
|
resolve(result);
|
||||||
|
@ -4681,6 +4683,10 @@ const doPublish = (success, fail) => (dispatch, getState) => {
|
||||||
publishPayload.thumbnail_url = thumbnail;
|
publishPayload.thumbnail_url = thumbnail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (useLBRYUploader) {
|
||||||
|
publishPayload.tags.push('lbry-first');
|
||||||
|
}
|
||||||
|
|
||||||
// Set release time to curret date. On edits, keep original release/transaction time as release_time
|
// Set release time to curret date. On edits, keep original release/transaction time as release_time
|
||||||
if (myClaimForUriEditing && myClaimForUriEditing.value.release_time) {
|
if (myClaimForUriEditing && myClaimForUriEditing.value.release_time) {
|
||||||
publishPayload.release_time = Number(myClaimForUri.value.release_time);
|
publishPayload.release_time = Number(myClaimForUri.value.release_time);
|
||||||
|
@ -4710,7 +4716,7 @@ const doPublish = (success, fail) => (dispatch, getState) => {
|
||||||
// Only pass file on new uploads, not metadata only edits.
|
// Only pass file on new uploads, not metadata only edits.
|
||||||
// The sdk will figure it out
|
// The sdk will figure it out
|
||||||
if (filePath) publishPayload.file_path = filePath;
|
if (filePath) publishPayload.file_path = filePath;
|
||||||
// if (useLBRYUploader) return LbryFirst.upload(publishPayload);
|
|
||||||
return lbryProxy.publish(publishPayload).then(response => {
|
return lbryProxy.publish(publishPayload).then(response => {
|
||||||
if (!useLBRYUploader) {
|
if (!useLBRYUploader) {
|
||||||
return success(response);
|
return success(response);
|
||||||
|
|
10
flow-typed/LbryFirst.js
vendored
10
flow-typed/LbryFirst.js
vendored
|
@ -71,9 +71,9 @@ declare type UploadResponse = {
|
||||||
|
|
||||||
declare type HasYTAuthResponse = {
|
declare type HasYTAuthResponse = {
|
||||||
HashAuth: boolean,
|
HashAuth: boolean,
|
||||||
}
|
};
|
||||||
|
|
||||||
declare type YTSignupResponse = {}
|
declare type YTSignupResponse = {};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Types used in the generic LbryFirst object that is exported
|
// Types used in the generic LbryFirst object that is exported
|
||||||
|
@ -93,7 +93,7 @@ declare type LbryFirstTypes = {
|
||||||
stop: () => Promise<string>,
|
stop: () => Promise<string>,
|
||||||
status: () => Promise<StatusResponse>,
|
status: () => Promise<StatusResponse>,
|
||||||
version: () => Promise<VersionResponse>,
|
version: () => Promise<VersionResponse>,
|
||||||
upload: (params: {}) => Promise<UploadResponse>,
|
upload: any => Promise<?UploadResponse>,
|
||||||
hasYTAuth: () =>Promise<HasYTAuthResponse>,
|
hasYTAuth: () => Promise<HasYTAuthResponse>,
|
||||||
ytSignup: () =>Promise<YTSignupResponse>,
|
ytSignup: () => Promise<YTSignupResponse>,
|
||||||
};
|
};
|
||||||
|
|
|
@ -23,7 +23,8 @@ const LbryFirst: LbryFirstTypes = {
|
||||||
},
|
},
|
||||||
|
|
||||||
unsetApiHeader: key => {
|
unsetApiHeader: key => {
|
||||||
Object.keys(LbryFirst.apiRequestHeaders).includes(key) && delete LbryFirst.apiRequestHeaders['key'];
|
Object.keys(LbryFirst.apiRequestHeaders).includes(key) &&
|
||||||
|
delete LbryFirst.apiRequestHeaders['key'];
|
||||||
},
|
},
|
||||||
// Allow overriding Lbry methods
|
// Allow overriding Lbry methods
|
||||||
overrides: {},
|
overrides: {},
|
||||||
|
@ -40,17 +41,26 @@ const LbryFirst: LbryFirstTypes = {
|
||||||
version: () => lbryFirstCallWithResult('version', {}),
|
version: () => lbryFirstCallWithResult('version', {}),
|
||||||
|
|
||||||
// Upload to youtube
|
// Upload to youtube
|
||||||
upload: (params = {}) => {
|
upload: (params: { title: string, description: string, file_path: ?string } = {}) => {
|
||||||
// Only upload when originally publishing for now
|
// Only upload when originally publishing for now
|
||||||
if (!params.file_path) {
|
if (!params.file_path) {
|
||||||
return {};
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
const uploadParams = {};
|
|
||||||
uploadParams.Title = params.title;
|
const uploadParams: {
|
||||||
uploadParams.Description = params.description;
|
Title: string,
|
||||||
uploadParams.FilePath = params.file_path;
|
Description: string,
|
||||||
uploadParams.Category = '';
|
FilePath: string,
|
||||||
uploadParams.Keywords = '';
|
Category: string,
|
||||||
|
Keywords: string,
|
||||||
|
} = {
|
||||||
|
Title: params.title,
|
||||||
|
Description: params.description,
|
||||||
|
FilePath: params.file_path,
|
||||||
|
Category: '',
|
||||||
|
Keywords: '',
|
||||||
|
};
|
||||||
|
|
||||||
return lbryFirstCallWithResult('youtube.Upload', uploadParams);
|
return lbryFirstCallWithResult('youtube.Upload', uploadParams);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -111,14 +121,14 @@ function checkAndParse(response) {
|
||||||
|
|
||||||
export function apiCall(method: string, params: ?{}, resolve: Function, reject: Function) {
|
export function apiCall(method: string, params: ?{}, resolve: Function, reject: Function) {
|
||||||
const counter = new Date().getTime();
|
const counter = new Date().getTime();
|
||||||
params = [params];
|
const paramsArray = [params];
|
||||||
const options = {
|
const options = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: LbryFirst.apiRequestHeaders,
|
headers: LbryFirst.apiRequestHeaders,
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
jsonrpc: '2.0',
|
jsonrpc: '2.0',
|
||||||
method,
|
method,
|
||||||
params,
|
params: paramsArray,
|
||||||
id: counter,
|
id: counter,
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
@ -137,7 +147,6 @@ export function apiCall(method: string, params: ?{}, resolve: Function, reject:
|
||||||
}
|
}
|
||||||
|
|
||||||
function lbryFirstCallWithResult(name: string, params: ?{} = {}) {
|
function lbryFirstCallWithResult(name: string, params: ?{} = {}) {
|
||||||
console.log(`LbryFirst: calling ${name}`);
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
apiCall(
|
apiCall(
|
||||||
name,
|
name,
|
||||||
|
|
|
@ -323,6 +323,10 @@ export const doPublish = (success: Function, fail: Function) => (
|
||||||
publishPayload.thumbnail_url = thumbnail;
|
publishPayload.thumbnail_url = thumbnail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (useLBRYUploader) {
|
||||||
|
publishPayload.tags.push('lbry-first');
|
||||||
|
}
|
||||||
|
|
||||||
// Set release time to curret date. On edits, keep original release/transaction time as release_time
|
// Set release time to curret date. On edits, keep original release/transaction time as release_time
|
||||||
if (myClaimForUriEditing && myClaimForUriEditing.value.release_time) {
|
if (myClaimForUriEditing && myClaimForUriEditing.value.release_time) {
|
||||||
publishPayload.release_time = Number(myClaimForUri.value.release_time);
|
publishPayload.release_time = Number(myClaimForUri.value.release_time);
|
||||||
|
@ -352,14 +356,13 @@ export const doPublish = (success: Function, fail: Function) => (
|
||||||
// Only pass file on new uploads, not metadata only edits.
|
// Only pass file on new uploads, not metadata only edits.
|
||||||
// The sdk will figure it out
|
// The sdk will figure it out
|
||||||
if (filePath) publishPayload.file_path = filePath;
|
if (filePath) publishPayload.file_path = filePath;
|
||||||
// if (useLBRYUploader) return LbryFirst.upload(publishPayload);
|
|
||||||
return Lbry.publish(publishPayload)
|
return Lbry.publish(publishPayload).then(response => {
|
||||||
.then((response) => {
|
if (!useLBRYUploader) {
|
||||||
if (!useLBRYUploader) {
|
return success(response);
|
||||||
return success(response);
|
}
|
||||||
}
|
return LbryFirst.upload(publishPayload).then(success(response), success(response));
|
||||||
return LbryFirst.upload(publishPayload).then(success(response), success(response));
|
}, fail);
|
||||||
}, fail);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Calls file_list until any reflecting files are done
|
// Calls file_list until any reflecting files are done
|
||||||
|
|
Loading…
Reference in a new issue