Compare commits

..

No commits in common. "main" and "v0.5.0" have entirely different histories.
main ... v0.5.0

12 changed files with 898 additions and 1133 deletions

View file

@ -1,26 +0,0 @@
name: "Audit dependencies"
on:
push:
branches:
- main
paths:
- '.forgejo/workflows/audit.yml'
- '**/Cargo.toml'
- '**/Cargo.lock'
- '**/audit.toml'
schedule:
- cron: '0 23 * * 6'
workflow_dispatch:
jobs:
audit:
runs-on: rust-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Run cargo audit
run: cargo audit

View file

@ -1,29 +0,0 @@
name: "Check and lint"
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
jobs:
check_lint:
name: Check and lint
runs-on: rust-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Run cargo check
run: cargo check --all-features
- name: Run cargo clippy
run: cargo clippy -- -D warnings
- name: Run cargo fmt
run: cargo fmt --all -- --check
# TODO: Add a test suite first!
# - name: Run cargo test
# run: cargo test --all-features

View file

@ -1,91 +0,0 @@
name: "Release"
on:
push:
tags:
- v*
jobs:
release:
name: "Release"
runs-on: rust-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Determine the repository name and version of the release
run: |
REPO_NAME=$(basename $GITHUB_REPOSITORY)
VERSION=${GITHUB_REF_NAME#v}
echo "Releasing version of $REPO_NAME: $VERSION"
echo "REPO_NAME=$REPO_NAME" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Get the release notes from the changelog
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
RELEASE_NOTES=$(sed -n -e "/^## \[$VERSION\]/,/^## \[/{//"'!'"p;}" CHANGELOG.md | sed -e '1d;$d')
echo "Release notes:"
echo
echo "$RELEASE_NOTES"
echo "RELEASE_NOTES<<$EOF" >> "$GITHUB_ENV"
echo "$RELEASE_NOTES" >> "$GITHUB_ENV"
echo "$EOF" >> "$GITHUB_ENV"
- name: Build a release binary
run: |
# FIXME: This should be figured out in a better manner!
BIN_NAME=${REPO_NAME}-x86_64-unknown-linux-gnu
cargo build --release
mkdir -p dist
cp target/release/${REPO_NAME} dist/${BIN_NAME}
shasum -a 256 dist/${BIN_NAME} > dist/${BIN_NAME}.sha256sum
- name: Release to Forgejo
uses: paul/forgejo-release@main
with:
direction: upload
release-dir: dist
release-notes: '${{ env.RELEASE_NOTES }}'
title: 'Release ${{ env.VERSION }}'
token: '${{ secrets.RELEASE_TOKEN }}'
release-crate:
name: "Release Rust crate"
runs-on: rust-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Run cargo publish
run: cargo publish --registry luon
env:
CARGO_REGISTRIES_LUON_INDEX: 'sparse+${{ github.server_url }}/api/packages/${{ github.repository_owner }}/cargo/'
CARGO_REGISTRIES_LUON_TOKEN: 'Bearer ${{ secrets.CARGO_TOKEN }}'
release-deb:
name: "Release Debian package"
runs-on: rust-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install and run cargo-deb
run: |
unset GITHUB_TOKEN
cargo binstall --only-signed -y cargo-deb
cargo deb
- name: Publish Debian package
env:
DEB_REPO_TOKEN: '${{ secrets.DEB_REPO_TOKEN }}'
run: |
curl --config <(printf "user=%s:%s" paul "${DEB_REPO_TOKEN}") \
--upload-file target/debian/*.deb \
${{ github.server_url }}/api/packages/${{ github.repository_owner }}/debian/pool/bookworm/main/upload

View file

@ -0,0 +1,46 @@
name: "Check and lint using Cargo"
on:
- pull_request
- push
- workflow_dispatch
jobs:
check_lint:
name: Check and lint
runs-on: debian-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install Rust stable toolchain
uses: https://github.com/actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
- name: Run cargo check
uses: https://github.com/actions-rs/cargo@v1
with:
command: check
- name: Run cargo clippy
uses: https://github.com/actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
- name: Run cargo fmt
uses: https://github.com/actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
# TODO: Add a test suite first!
# - name: Run cargo test
# uses: https://github.com/actions-rs/cargo@v1
# with:
# command: test
# args: --all-features

View file

@ -0,0 +1,82 @@
name: "Release"
on:
push:
tags: "v*"
jobs:
release:
name: "Release"
runs-on: debian-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Determine the version of the release
run: |
VERSION=${GITHUB_REF_NAME#v}
echo "Releasing version: $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Install Rust stable toolchain
uses: https://github.com/actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Install cargo-deb
uses: https://github.com/brndnmtthws/rust-action-cargo-binstall@v1
with:
packages: cargo-deb
- name: Run cargo-deb
uses: https://github.com/actions-rs/cargo@v1
with:
command: deb
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: '>=1.20.1'
- name: Release to Gitea
uses: actions/release-action@main
with:
# This is available by default.
api_key: '${{ secrets.RELEASE_TOKEN }}'
files: target/debian/podbringer*.deb
title: 'Release ${{ env.VERSION }}'
release-crate:
name: "Release crate"
runs-on: debian-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Rust stable toolchain
uses: https://github.com/actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Use sparse Cargo index for crates.io
run: echo -e '[registries.crates-io]\nprotocol = "sparse"' >> /root/.cargo/config.toml
- name: Register the Gitea crate registry with Cargo
run: echo -e '[registries.luon]\nindex = "https://git.luon.net/paul/_cargo-index.git"' >> /root/.cargo/config.toml
- name: Run cargo publish
uses: https://github.com/actions-rs/cargo@v1
env:
# This needs to be provided for the repository; no login necessary as a result.
CARGO_REGISTRIES_LUON_TOKEN: '${{ secrets.CARGO_REGISTRIES_LUON_TOKEN }}'
with:
command: publish
args: --registry luon

View file

@ -7,66 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.5.4] - 2024-07-26
### Changed
* Switch to Forgejo Actions; add audit workflow
* Update dependency on `rocket_dyn_templates`
* Update dependency on `youtube_dl`
### Security
* Update dependencies, fixes security advisories:
* [RUSTSEC-2024-0019](https://rustsec.org/advisories/RUSTSEC-2024-0019)
* [RUSTSEC-2024-0332](https://rustsec.org/advisories/RUSTSEC-2024-0332)
* [RUSTSEC-2024-0336](https://rustsec.org/advisories/RUSTSEC-2024-0336)
* [RUSTSEC-2024-0357](https://rustsec.org/advisories/RUSTSEC-2024-0357)
## [0.5.3] - 2024-02-27
### Changed
* Update dependency on `cached`
### Security
* Update dependencies, fixes security advisories:
* [RUSTSEC-2024-0003](https://rustsec.org/advisories/RUSTSEC-2024-0003)
* [RUSTSEC-2023-0072](https://rustsec.org/advisories/RUSTSEC-2024-0072)
* [RUSTSEC-2023-0074](https://rustsec.org/advisories/RUSTSEC-2024-0072)
### Fixed
* Handle paging information begin absent; fixes short feeds for Mixcloud (#17)
## [0.5.2] - 2023-11-03
### Security
* Update dependencies
([RUSTSEC-2020-0071](https://rustsec.org/advisories/RUSTSEC-2020-0071.html))
### Changed
* Switch to Rocket 0.5 RC4
* Update dependency on `cached`
## [0.5.1] - 2023-08-25
### Changed
* Bump the dependency on `youtube_dl`
* Update release Gitea Actions workflow; add seperate job to release Debian
package to the new repository
### Security
* Update dependencies
([RUSTSEC-2023-0034](https://rustsec.org/advisories/RUSTSEC-2023-0034),
[RUSTSEC-2023-0044](https://rustsec.org/advisories/RUSTSEC-2023-0044),
[RUSTSEC-2023-0052](https://rustsec.org/advisories/RUSTSEC-2023-0052))
## [0.5.0] - 2023-06-08
### Added
@ -166,11 +106,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
Initial release.
[Unreleased]: https://git.luon.net/paul/podbringer/compare/v0.5.4...HEAD
[0.5.4]: https://git.luon.net/paul/podbringer/compare/v0.5.3..v0.5.4
[0.5.3]: https://git.luon.net/paul/podbringer/compare/v0.5.2..v0.5.3
[0.5.2]: https://git.luon.net/paul/podbringer/compare/v0.5.1..v0.5.2
[0.5.1]: https://git.luon.net/paul/podbringer/compare/v0.5.0..v0.5.1
[Unreleased]: https://git.luon.net/paul/podbringer/compare/v0.4.1...HEAD
[0.5.0]: https://git.luon.net/paul/podbringer/compare/v0.4.1..v0.5.0
[0.4.1]: https://git.luon.net/paul/podbringer/compare/v0.4.0..v0.4.1
[0.4.0]: https://git.luon.net/paul/podbringer/compare/v0.3.0..v0.4.0

1652
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
[package]
name = "podbringer"
version = "0.5.4"
version = "0.5.0"
authors = ["Paul van Tilburg <paul@luon.net>"]
edition = "2021"
description = "Web service that provides podcasts for services that don't offer them (anymore)"
@ -10,17 +10,17 @@ license = "MIT"
[dependencies]
async-trait = "0.1.57"
cached = { version = "0.49.2", features = ["async"] }
cached = { version = "0.42.0", features = ["async"] }
chrono = { version = "0.4.19", features = ["serde"] }
enum_dispatch = "0.3.8"
mime-db = "1.6.0"
reqwest = { version = "0.11.10", features = ["json"] }
rocket = { version = "0.5.0-rc.3", features = ["json"] }
rocket_dyn_templates = { version = "0.2.0", features = ["tera"] }
rocket_dyn_templates = { version = "0.1.0-rc.2", features = ["tera"] }
rss = "2.0.1"
thiserror = "1.0.31"
url = { version = "2.2.2", features = ["serde"] }
youtube_dl = { version = "0.10.0", features = ["tokio"] }
youtube_dl = { version = "0.8.0", features = ["tokio"] }
ytextract = "0.11.2"
[package.metadata.deb]

View file

@ -41,7 +41,6 @@ pub(crate) enum Backends {
#[enum_dispatch]
pub(crate) trait Backend {
/// Returns the name of the backend.
#[allow(unused)] // For future use!
fn name(&self) -> &'static str;
/// Returns the channel with its currently contained content items.

View file

@ -66,16 +66,11 @@ impl super::Backend for Backend {
let count = cloudcasts_res.items.len();
cloudcasts.extend(cloudcasts_res.items);
// Check if any paging information is present.
let Some(paging) = cloudcasts_res.paging else {
break;
};
// Continue onto the next URL in the paging, if there is one and the limit was not
// reached.
limit = limit.saturating_sub(count);
offset += count;
match (limit, paging.next) {
match (limit, cloudcasts_res.paging.next) {
(0, Some(_)) => break,
(_, Some(next_url)) => {
cloudcasts_url = Url::parse(&next_url)?;
@ -131,8 +126,8 @@ pub(crate) struct CloudcastsResponse {
#[serde(rename = "data")]
items: Vec<Cloudcast>,
/// The paging information (if any).
paging: Option<CloudcastsPaging>,
/// The paging information.
paging: CloudcastsPaging,
}
/// The Mixcloud paging info.

View file

@ -6,7 +6,7 @@ use std::path::{Path, PathBuf};
use async_trait::async_trait;
use cached::proc_macro::cached;
use chrono::{TimeZone, Utc};
use chrono::{DateTime, Utc};
use reqwest::Url;
use rocket::futures::StreamExt;
use ytextract::playlist::video::{Error as YouTubeVideoError, Video as YouTubePlaylistVideo};
@ -224,7 +224,7 @@ impl From<YouTubeVideoWithStream> for Item {
.date()
.and_hms_opt(12, 0, 0)
.expect("Invalid hour, minute and/or second");
let published_at = Utc.from_utc_datetime(&timestamp);
let published_at = DateTime::from_utc(timestamp, Utc);
// There is no updated at timestamp available, really.
let updated_at = published_at;

View file

@ -2,7 +2,7 @@
use std::path::PathBuf;
use chrono::{DateTime, Utc};
use chrono::{DateTime, NaiveDateTime, Utc};
use rocket::http::uri::Absolute;
use rocket::uri;
use rss::extension::itunes::{
@ -20,10 +20,17 @@ use crate::Config;
/// It requires the backend and configuration to be able to construct download URLs.
pub(crate) fn construct(backend_id: &str, config: &Config, channel: Channel) -> rss::Channel {
let category = CategoryBuilder::default()
.name(channel.categories.first().cloned().unwrap_or_default())
.name(
channel
.categories
.first()
.map(Clone::clone)
.unwrap_or_default(),
)
.build();
let mut last_build =
DateTime::from_timestamp(0, 0).expect("Out-of-range seconds or invalid nanoseconds");
let unix_timestamp = NaiveDateTime::from_timestamp_opt(0, 0)
.expect("Out-of-range seconds or invalid nanoseconds");
let mut last_build = DateTime::from_utc(unix_timestamp, Utc);
let generator = String::from(concat!(
env!("CARGO_PKG_NAME"),
" ",