Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • adaures/castopod
  • mkljczk/castopod-host
  • spaetz/castopod-host
  • PatrykMis/castopod
  • jonas/castopod
  • ajeremias/castopod
  • misuzu/castopod
  • KrzysztofDomanczyk/castopod
  • Behel/castopod
  • nebulon/castopod
  • ewen/castopod
  • NeoluxConsulting/castopod
  • nateritter/castopod-og
  • prcutler/castopod
14 results
Show changes
Commits on Source (2)
# [1.0.0-alpha.34](https://code.podlibre.org/podlibre/castopod/compare/v1.0.0-alpha.33...v1.0.0-alpha.34) (2021-02-11)
### Bug Fixes
* **rss-import:** add Castopod user-agent, handle redirects for downloaded files, add Content namespace ([214243b](https://code.podlibre.org/podlibre/castopod/commit/214243b3fec4937e45ef1ceaba1149004cdf3b44))
# [1.0.0-alpha.33](https://code.podlibre.org/podlibre/castopod/compare/v1.0.0-alpha.32...v1.0.0-alpha.33) (2021-02-10)
......
......@@ -7,7 +7,7 @@
//
// NOTE: this constant is updated upon release with Continuous Integration.
//
defined('CP_VERSION') || define('CP_VERSION', '1.0.0-alpha.33');
defined('CP_VERSION') || define('CP_VERSION', '1.0.0-alpha.34');
//--------------------------------------------------------------------
// App Namespace
......
......@@ -76,6 +76,7 @@ class PodcastImport extends BaseController
->with('errors', $this->validator->getErrors());
}
try {
ini_set('user_agent', 'Castopod/' . CP_VERSION);
$feed = simplexml_load_file(
$this->request->getPost('imported_feed_url')
);
......@@ -98,6 +99,9 @@ class PodcastImport extends BaseController
$nsPodcast = $feed->channel[0]->children(
'https://github.com/Podcastindex-org/podcast-namespace/blob/main/docs/1.0.md'
);
$nsContent = $feed->channel[0]->children(
'http://purl.org/rss/1.0/modules/content/'
);
if ((string) $nsPodcast->locked === 'yes') {
return redirect()
......@@ -313,6 +317,9 @@ class PodcastImport extends BaseController
$nsPodcast = $item->children(
'https://github.com/Podcastindex-org/podcast-namespace/blob/main/docs/1.0.md'
);
$nsContent = $item->children(
'http://purl.org/rss/1.0/modules/content/'
);
$slug = slugify(
$this->request->getPost('slug_field') === 'title'
......@@ -328,13 +335,21 @@ class PodcastImport extends BaseController
}
$slugs[] = $slug;
$itemDescriptionHtml =
$this->request->getPost('description_field') === 'summary'
? $nsItunes->summary
: ($this->request->getPost('description_field') ===
'subtitle_summary'
? $nsItunes->subtitle . '<br/>' . $nsItunes->summary
: $item->description);
$itemDescriptionHtml = null;
switch ($this->request->getPost('description_field')) {
case 'content':
$itemDescriptionHtml = $nsContent->encoded;
break;
case 'summary':
$itemDescriptionHtml = $nsItunes->summary;
break;
case 'subtitle_summary':
$itemDescriptionHtml =
$nsItunes->subtitle . '<br/>' . $nsItunes->summary;
break;
default:
$itemDescriptionHtml = $item->description;
}
$newEpisode = new \App\Entities\Episode([
'podcast_id' => $newPodcastId,
......
......@@ -6,6 +6,8 @@
* @link https://castopod.org/
*/
use CodeIgniter\HTTP\ResponseInterface;
/**
* Saves a file to the corresponding podcast folder in `public/media`
*
......@@ -34,14 +36,50 @@ function save_podcast_media($file, $podcast_name, $media_name)
function download_file($fileUrl)
{
$client = \Config\Services::curlrequest();
$uri = new \CodeIgniter\HTTP\URI($fileUrl);
$response = $client->get($uri, [
'headers' => [
'User-Agent' => 'Castopod/' . CP_VERSION,
],
]);
// redirect to new file location
$newFileUrl = $fileUrl;
while (
in_array(
$response->getStatusCode(),
[
ResponseInterface::HTTP_MOVED_PERMANENTLY,
ResponseInterface::HTTP_FOUND,
ResponseInterface::HTTP_SEE_OTHER,
ResponseInterface::HTTP_NOT_MODIFIED,
ResponseInterface::HTTP_TEMPORARY_REDIRECT,
ResponseInterface::HTTP_PERMANENT_REDIRECT,
],
true
)
) {
$newFileUrl = (string) trim(
$response->getHeader('location')->getValue()
);
$newLocation = new \CodeIgniter\HTTP\URI($newFileUrl);
$response = $client->get($newLocation, [
'headers' => [
'User-Agent' => 'Castopod/' . CP_VERSION,
],
'http_errors' => false,
]);
}
$tmpFilename =
time() .
'_' .
bin2hex(random_bytes(10)) .
'.' .
pathinfo($fileUrl, PATHINFO_EXTENSION);
pathinfo($newFileUrl, PATHINFO_EXTENSION);
$tmpFilePath = WRITEPATH . 'uploads/' . $tmpFilename;
file_put_contents($tmpFilePath, file_get_contents($fileUrl));
file_put_contents($tmpFilePath, $response->getBody());
return new \CodeIgniter\Files\File($tmpFilePath);
}
......
......@@ -25,13 +25,8 @@ return [
'link' => '&lt;link&gt;',
'title' => '&lt;title&gt;',
],
'description_field' => [
'label' => 'Source field used for episode description / show notes',
'description' => '&lt;description&gt;',
'summary' => '&lt;itunes:summary&gt;',
'subtitle_summary' =>
'&lt;itunes:subtitle&gt; + &lt;itunes:summary&gt;',
],
'description_field' =>
'Source field used for episode description / show notes',
'force_renumber' => 'Force episodes renumbering',
'force_renumber_hint' =>
'Use this if your podcast does not have episode numbers but wish to set them during import.',
......
......@@ -26,13 +26,7 @@ return [
'link' => '&lt;link&gt; (adresse)',
'title' => '&lt;title&gt; (titre)',
],
'description_field' => [
'label' => 'Champs pour la description des épisodes',
'description' => '&lt;description&gt;',
'summary' => '&lt;itunes:summary&gt;',
'subtitle_summary' =>
'&lt;itunes:subtitle&gt; + &lt;itunes:summary&gt;',
],
'description_field' => 'Champs pour la description des épisodes',
'force_renumber' => 'Forcer la re-numérotation des épisodes',
'force_renumber_hint' =>
'Utilisez ceci si le podcast à importer ne contient pas de numéros d’épisodes mais que vous souhaitez en ajouter pendant l’import.',
......
......@@ -111,7 +111,7 @@
<?= form_fieldset_close() ?>
<?= form_fieldset('', ['class' => 'flex flex-col mb-4']) ?>
<legend><?= lang('PodcastImport.description_field.label') ?></legend>
<legend><?= lang('PodcastImport.description_field') ?></legend>
<label for="description" class="inline-flex items-center">
<?= form_radio(
[
......@@ -124,9 +124,7 @@
? old('description_field') == 'description'
: true
) ?>
<span class="ml-2"><?= lang(
'PodcastImport.description_field.description'
) ?></span>
<span class="ml-2">&lt;description&gt;</span>
</label>
<label for="summary" class="inline-flex items-center">
<?= form_radio(
......@@ -140,9 +138,7 @@
? old('description_field') == 'summary'
: false
) ?>
<span class="ml-2"><?= lang(
'PodcastImport.description_field.summary'
) ?></span>
<span class="ml-2">&lt;itunes:summary&gt;</span>
</label>
<label for="subtitle_summary" class="inline-flex items-center">
<?= form_radio(
......@@ -156,9 +152,21 @@
? old('description_field') == 'subtitle_summary'
: false
) ?>
<span class="ml-2"><?= lang(
'PodcastImport.description_field.subtitle_summary'
) ?></span>
<span class="ml-2">&lt;itunes:subtitle&gt; + &lt;itunes:summary&gt;</span>
</label>
<label for="content" class="inline-flex items-center">
<?= form_radio(
[
'id' => 'content',
'name' => 'description_field',
'class' => 'form-radio text-green-500',
],
'content',
old('description_field')
? old('description_field') == 'content'
: false
) ?>
<span class="ml-2">&lt;content:encoded&gt;</span>
</label>
<?= form_fieldset_close() ?>
......
{
"name": "podlibre/castopod",
"version": "1.0.0-alpha33",
"version": "1.0.0-alpha34",
"type": "project",
"description": "Castopod is an open-source hosting platform made for podcasters who want engage and interact with their audience.",
"homepage": "https://castopod.org",
......
{
"name": "castopod",
"version": "1.0.0-alpha.33",
"version": "1.0.0-alpha.34",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......
{
"name": "castopod",
"version": "1.0.0-alpha.33",
"version": "1.0.0-alpha.34",
"description": "Castopod is an open-source hosting platform made for podcasters who want engage and interact with their audience.",
"private": true,
"license": "AGPL-3.0-or-later",
......