Skip to content

Commit

Permalink
Merge pull request #338 from stumpapp/release/v0.0.3
Browse files Browse the repository at this point in the history
 🔖 Release v0.0.3
  • Loading branch information
aaronleopold authored May 18, 2024
2 parents bd8442d + b3b9cc7 commit ef8b97a
Show file tree
Hide file tree
Showing 48 changed files with 557 additions and 324 deletions.
27 changes: 27 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# Changelog

<a name="0.0.3"></a>
## 0.0.3 (2024-05-13)

### Added

- ✅ Fix stump_config tests ([#331](https://github.com/stumpapp/stump/issues/331)) [[a98f86f](https://github.com/stumpapp/stump/commit/a98f86f31fd8ce9c7b55ed26b6f5068dfe33c8e1)]

### Fixed

- ✏️ Fix dead links ([#337](https://github.com/stumpapp/stump/issues/337)) [[a46fca4](https://github.com/stumpapp/stump/commit/a46fca42a246f9eef78ef1409581e4b4d56a234f)]
- 🐛 Allow canceling islanded jobs [[dcedea4](https://github.com/stumpapp/stump/commit/dcedea47210488c5fa3ca2de493e5228ecb3d664)]
- 🐛 Fix paged reader oversized height [[de86463](https://github.com/stumpapp/stump/commit/de864637956f1b7d30ab80d648769785361a4f3e)]
- 🐛 Fix &#x60;check-for-update&#x60; false positive ([#333](https://github.com/stumpapp/stump/issues/333)) [[316cd09](https://github.com/stumpapp/stump/commit/316cd091b8c829c4acf4df00af4e47f86f428db2)]
- 🐛 Fix cast error for file size calculation ([#330](https://github.com/stumpapp/stump/issues/330)) [[5ac5aec](https://github.com/stumpapp/stump/commit/5ac5aec97934bf8dc7760c90ab042c4c9c8d0f38)]
- 🐛 Fix image reader navigation (tablet) ([#329](https://github.com/stumpapp/stump/issues/329)) [[abb00de](https://github.com/stumpapp/stump/commit/abb00de4f43f16ba1cf7d1f2d7858fffcf6e751e)]
- 🐛 Fix inverted swipe handlers in EPUB reader ([#324](https://github.com/stumpapp/stump/issues/324)) [[7be6eda](https://github.com/stumpapp/stump/commit/7be6eda9c649e02b57bfc6a0f8b150124212fff7)]
- 💚 Fix &#x60;yarn&#x60; timeout issues during install step ([#319](https://github.com/stumpapp/stump/issues/319)) [[a71fbe1](https://github.com/stumpapp/stump/commit/a71fbe158ef2ebb7b4404e3dae8cc041988ef09f)]

### Miscellaneous

- Merge pull request [#335](https://github.com/stumpapp/stump/issues/335) from stumpapp/al/misc-fixes [[a3e8c7b](https://github.com/stumpapp/stump/commit/a3e8c7b268f63f9ef9a13ca04f07fe6fc087b961)]
- Merge branch &#x27;develop&#x27; into al/misc-fixes [[93c2290](https://github.com/stumpapp/stump/commit/93c2290fb5a9553293fd1d090e6f5434a139d6a1)]
- 🌐 Update translations ([#332](https://github.com/stumpapp/stump/issues/332)) [[bf82e01](https://github.com/stumpapp/stump/commit/bf82e01cc69b7749dd17152905f875c302d45ef9)]
- 🩹 Fix dark styles in light theme ([#326](https://github.com/stumpapp/stump/issues/326)) [[61e6fb4](https://github.com/stumpapp/stump/commit/61e6fb4f1753a4b92f861893301999a181ee0759)]
- 🌐 Update translations ([#318](https://github.com/stumpapp/stump/issues/318)) [[58c168d](https://github.com/stumpapp/stump/commit/58c168dca3c706cf5f835312f968caec391bab4d)]


<a name="0.0.2"></a>
## 0.0.2 (2024-04-21)

Expand Down
18 changes: 14 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ members = [
]

[workspace.package]
version = "0.0.2"
version = "0.0.3"
rust-version = "1.77.2"

[workspace.dependencies]
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stump/desktop",
"version": "0.0.2",
"version": "0.0.3",
"description": "",
"license": "MIT",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion apps/expo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@
"tailwindcss": "3.3.2"
},
"name": "@stump/mobile",
"version": "0.0.2",
"version": "0.0.3",
"private": true
}
2 changes: 1 addition & 1 deletion apps/server/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@stump/server",
"private": true,
"version": "0.0.2",
"version": "0.0.3",
"scripts": {
"lint": "cargo clippy --package stump_server -- -D warnings",
"format": "cargo fmt --package stump_server",
Expand Down
6 changes: 5 additions & 1 deletion apps/server/src/routers/api/v1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,15 @@ async fn check_for_updates() -> APIResult<Json<UpdateCheck>> {
if github_response.status().is_success() {
let github_json: serde_json::Value = github_response.json().await?;

let latest_semver = github_json["tag_name"].as_str().ok_or_else(|| {
let mut latest_semver = github_json["tag_name"].as_str().ok_or_else(|| {
APIError::InternalServerError(
"Failed to parse latest release tag name".to_string(),
)
})?;
if latest_semver.starts_with('v') && latest_semver.len() > 1 {
latest_semver = &latest_semver[1..];
}

let has_update_available = latest_semver != current_semver;

Ok(Json(UpdateCheck {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stump/web",
"version": "0.0.2",
"version": "0.0.3",
"description": "",
"license": "MIT",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ regex = "1.10.4"
alphanumeric-sort = "1.5.3"

[dev-dependencies]
temp-env = "0.3.6"
tempfile = { workspace = true }
criterion = { version = "0.5.1", features = ["html_reports", "async_tokio"] }

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
Warnings:
- You are about to alter the column `size` on the `media` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`.
*/
-- RedefineTables
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_media" (
"id" TEXT NOT NULL PRIMARY KEY,
"name" TEXT NOT NULL,
"size" BIGINT NOT NULL,
"extension" TEXT NOT NULL,
"pages" INTEGER NOT NULL,
"updated_at" DATETIME NOT NULL,
"created_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"modified_at" DATETIME,
"hash" TEXT,
"path" TEXT NOT NULL,
"status" TEXT NOT NULL DEFAULT 'READY',
"series_id" TEXT,
CONSTRAINT "media_series_id_fkey" FOREIGN KEY ("series_id") REFERENCES "series" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
INSERT INTO "new_media" ("created_at", "extension", "hash", "id", "modified_at", "name", "pages", "path", "series_id", "size", "status", "updated_at") SELECT "created_at", "extension", "hash", "id", "modified_at", "name", "pages", "path", "series_id", "size", "status", "updated_at" FROM "media";
DROP TABLE "media";
ALTER TABLE "new_media" RENAME TO "media";
PRAGMA foreign_key_check;
PRAGMA foreign_keys=ON;
2 changes: 1 addition & 1 deletion core/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ model Media {
id String @id @default(uuid())
name String // derived from filename
size Int // in bytes
size BigInt // in bytes
extension String
pages Int
updated_at DateTime @updatedAt
Expand Down
151 changes: 83 additions & 68 deletions core/src/config/stump_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,42 +525,49 @@ mod tests {

#[test]
fn test_getting_config_from_environment() {
// Set environment variables
env::set_var(PROFILE_KEY, "release");
env::set_var(PORT_KEY, "1337");
env::set_var(VERBOSITY_KEY, "3");
env::set_var(DB_PATH_KEY, "not_a_real_path");
env::set_var(CLIENT_KEY, "not_a_real_dir");
env::set_var(CONFIG_DIR_KEY, "also_not_a_real_dir");
env::set_var(DISABLE_SWAGGER_KEY, "true");
env::set_var(HASH_COST_KEY, "24");
env::set_var(SESSION_TTL_KEY, (3600 * 24).to_string());
env::set_var(SESSION_EXPIRY_INTERVAL_KEY, (60 * 60 * 8).to_string());

// Create a new StumpConfig and load values from the environment.
let config = StumpConfig::new("not_a_dir".to_string())
.with_environment()
.unwrap();

// Confirm values are as expected
assert_eq!(
config,
StumpConfig {
profile: "release".to_string(),
port: 1337,
verbosity: 3,
pretty_logs: true,
db_path: Some("not_a_real_path".to_string()),
client_dir: "not_a_real_dir".to_string(),
config_dir: "also_not_a_real_dir".to_string(),
allowed_origins: vec![],
pdfium_path: None,
disable_swagger: true,
password_hash_cost: 24,
session_ttl: 3600 * 24,
expired_session_cleanup_interval: 60 * 60 * 8,
scanner_chunk_size: DEFAULT_SCANNER_CHUNK_SIZE,
}
temp_env::with_vars(
[
(PROFILE_KEY, Some("release")),
(PORT_KEY, Some("1337")),
(VERBOSITY_KEY, Some("2")),
(DB_PATH_KEY, Some("not_a_real_path")),
(CLIENT_KEY, Some("not_a_real_dir")),
(CONFIG_DIR_KEY, Some("also_not_a_real_dir")),
(DISABLE_SWAGGER_KEY, Some("true")),
(HASH_COST_KEY, Some("24")),
(SESSION_TTL_KEY, Some(&(3600 * 24).to_string())),
(
SESSION_EXPIRY_INTERVAL_KEY,
Some(&(60 * 60 * 8).to_string()),
),
],
|| {
// Create a new StumpConfig and load values from the environment.
let config = StumpConfig::new("not_a_dir".to_string())
.with_environment()
.unwrap();

// Confirm values are as expected
assert_eq!(
config,
StumpConfig {
profile: "release".to_string(),
port: 1337,
verbosity: 2,
pretty_logs: true,
db_path: Some("not_a_real_path".to_string()),
client_dir: "not_a_real_dir".to_string(),
config_dir: "also_not_a_real_dir".to_string(),
allowed_origins: vec![],
pdfium_path: None,
disable_swagger: true,
password_hash_cost: 24,
session_ttl: 3600 * 24,
expired_session_cleanup_interval: 60 * 60 * 8,
scanner_chunk_size: DEFAULT_SCANNER_CHUNK_SIZE,
}
);
},
);
}

Expand Down Expand Up @@ -670,38 +677,46 @@ mod tests {

#[test]
fn test_simulate_first_boot() {
env::set_var(PORT_KEY, "1337");
env::set_var(VERBOSITY_KEY, "2");
env::set_var(DISABLE_SWAGGER_KEY, "true");
env::set_var(HASH_COST_KEY, "1");

let tempdir = tempfile::tempdir().expect("Failed to create temporary directory");
// Now we can create a StumpConfig rooted at the temporary directory
let config_dir = tempdir.path().to_string_lossy().to_string();
let generated = StumpConfig::new(config_dir.clone())
.with_config_file()
.expect("Failed to generate StumpConfig from Stump.toml")
.with_environment()
.expect("Failed to generate StumpConfig from environment");

let expected = StumpConfig {
profile: "debug".to_string(),
port: 1337,
verbosity: 2,
pretty_logs: true,
db_path: None,
client_dir: "./dist".to_string(),
config_dir,
allowed_origins: vec![],
pdfium_path: None,
disable_swagger: true,
password_hash_cost: 1,
session_ttl: DEFAULT_SESSION_TTL,
expired_session_cleanup_interval: DEFAULT_SESSION_EXPIRY_CLEANUP_INTERVAL,
scanner_chunk_size: DEFAULT_SCANNER_CHUNK_SIZE,
};

assert_eq!(generated, expected);
temp_env::with_vars(
[
(PORT_KEY, Some("1337")),
(VERBOSITY_KEY, Some("2")),
(DISABLE_SWAGGER_KEY, Some("true")),
(HASH_COST_KEY, Some("1")),
],
|| {
let tempdir =
tempfile::tempdir().expect("Failed to create temporary directory");
// Now we can create a StumpConfig rooted at the temporary directory
let config_dir = tempdir.path().to_string_lossy().to_string();
let generated = StumpConfig::new(config_dir.clone())
.with_config_file()
.expect("Failed to generate StumpConfig from Stump.toml")
.with_environment()
.expect("Failed to generate StumpConfig from environment");

assert_eq!(
generated,
StumpConfig {
profile: "debug".to_string(),
port: 1337,
verbosity: 2,
pretty_logs: true,
db_path: None,
client_dir: "./dist".to_string(),
config_dir,
allowed_origins: vec![],
pdfium_path: None,
disable_swagger: true,
password_hash_cost: 1,
session_ttl: DEFAULT_SESSION_TTL,
expired_session_cleanup_interval:
DEFAULT_SESSION_EXPIRY_CLEANUP_INTERVAL,
scanner_chunk_size: DEFAULT_SCANNER_CHUNK_SIZE,
}
);
},
);
}

fn get_mock_config_file() -> String {
Expand Down
2 changes: 1 addition & 1 deletion core/src/db/entity/media/entity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub struct Media {
/// The name of the media. ex: "The Amazing Spider-Man (2018) #69"
pub name: String,
/// The size of the media in bytes.
pub size: i32,
pub size: i64,
/// The file extension of the media. ex: "cbz"
pub extension: String,
/// The number of pages in the media. ex: "69"
Expand Down
2 changes: 1 addition & 1 deletion core/src/filesystem/media/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl MediaBuilder {
(m.len(), last_modified_at)
})?;
let size = raw_size.try_into().unwrap_or_else(|_| {
tracing::error!(?raw_size, "Failed to convert file size to i32");
tracing::error!(?raw_size, ?path, "Failed to convert file size to i64");
0
});

Expand Down
2 changes: 2 additions & 0 deletions core/src/job/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ pub enum JobManagerError {
JobMissingId,
#[error("Job failed to be persisted: {0}")]
JobPersistFailed(String),
#[error("A job was found which was in a deeply invalid state")]
JobLostError,
#[error("A query error occurred {0}")]
QueryError(#[from] prisma_client_rust::QueryError),
#[error("An unknown error occurred {0}")]
Expand Down
Loading

0 comments on commit ef8b97a

Please sign in to comment.