Lbry publish #61

Merged
lemsmyth merged 20 commits from lbry-publish into master 2022-02-14 15:43:56 +01:00
2 changed files with 7 additions and 4 deletions
Showing only changes of commit 9149310a61 - Show all commits

View file

@ -14,8 +14,9 @@ class LBRY_Network_Publisher
* @param string $channel The Claim ID of the channel we are posting to
*/
// NOTE: This is currently sitting at about 150ms, mostly the post parsing
public function publish($post, $channel = null)
{
public function publish( $post, $channel = null, $license ) {
$post_id = $post->ID;
// Get converted markdown into a file
$filepath = LBRY_ABSPATH . 'tmp/' . $post->post_name . time() . '.md';
$file = fopen( $filepath, 'w' );
@ -35,7 +36,7 @@ class LBRY_Network_Publisher
'file_path' => $filepath,
'title' => $post->post_title,
'languages' => array( substr( get_locale(), 0, 2 ) ),
'license' => get_option(LBRY_SETTINGS)[LBRY_LICENSE]
'license' => $license,
);
// Setup channel

View file

@ -1,8 +1,10 @@
<?php
defined('ABSPATH') || die(); // Exit if accessed directly
$url = get_post_meta(get_the_id(), LBRY_CANONICAL_URL, true);
if (!$url) {
// Get channel canonical for backwards compatibility
$channel_id = get_post_meta(get_the_id(), LBRY_POST_CHANNEL, true);
$channel_id = ( get_post_meta( get_the_id(), LBRY_POST_PUB_CHANNEL, true ) ? get_post_meta( get_the_id(), LBRY_POST_PUB_CHANNEL, true ) : get_post_meta( get_the_id(), '_lbry_channel', true ) );
$url = LBRY()->daemon->canonical_url($channel_id);
}