-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Daemonising is no longer supported. Use a proper services supervisor (Parsing passed-in sockets is coming) * syslog logging is gone, use stderr and a proper services supervisor * New user management system * Error handling is completely different * Cleaned up the generation module (but the code is morally equivalent) * Upgrade axum-login * Switch to tower-sessions * Switch to the base64 module * Change over to using the csrf module and sessions * New message flashing system using axum-messages * Much simpler application logic * src/controllers -> src/web * Cleaned up a bunch of code More to come... Signed-off-by: Elizabeth Myers <[email protected]>
- Loading branch information
Showing
57 changed files
with
3,660 additions
and
3,785 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* SPDX-License-Identifier: CC0-1.0 | ||
* | ||
* build.rs | ||
* | ||
* This file is a component of ShadyURL by Elizabeth Myers. | ||
* | ||
* To the extent possible under law, the person who associated CC0 with | ||
* ShadyURL has waived all copyright and related or neighboring rights | ||
* to ShadyURL. | ||
* | ||
* You should have received a copy of the CC0 legalcode along with this | ||
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. | ||
*/ | ||
|
||
fn main() { | ||
println!("cargo:rerun-if-changed=templates"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,4 @@ | |
pub mod prelude; | ||
|
||
pub mod url; | ||
pub mod user; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* SPDX-License-Identifier: CC0-1.0 | ||
* | ||
* entity/src/entities/user.rs | ||
* | ||
* This file is a component of ShadyURL by Elizabeth Myers. | ||
* | ||
* To the extent possible under law, the person who associated CC0 with | ||
* ShadyURL has waived all copyright and related or neighboring rights | ||
* to ShadyURL. | ||
* | ||
* You should have received a copy of the CC0 legalcode along with this | ||
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. | ||
*/ | ||
|
||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 | ||
use sea_orm::entity::prelude::*; | ||
|
||
#[derive(Clone, PartialEq, DeriveEntityModel, Eq)] | ||
#[sea_orm(table_name = "user")] | ||
pub struct Model { | ||
#[sea_orm(primary_key)] | ||
pub id: i64, | ||
pub username: String, | ||
pub password_hash: String, | ||
} | ||
|
||
impl std::fmt::Debug for Model { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
f.debug_struct("User") | ||
.field("id", &self.id) | ||
.field("username", &self.username) | ||
.field("password_hash", &"[redacted]") | ||
.finish() | ||
} | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] | ||
pub enum Relation {} | ||
|
||
impl ActiveModelBehavior for ActiveModel {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* SPDX-License-Identifier: CC0-1.0 | ||
* | ||
* migration/src/m20240302_082409_create_user_table.rs | ||
* | ||
* This file is a component of ShadyURL by Elizabeth Myers. | ||
* | ||
* To the extent possible under law, the person who associated CC0 with | ||
* ShadyURL has waived all copyright and related or neighboring rights | ||
* to ShadyURL. | ||
* | ||
* You should have received a copy of the CC0 legalcode along with this | ||
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. | ||
*/ | ||
|
||
use sea_orm_migration::prelude::*; | ||
|
||
#[derive(DeriveMigrationName)] | ||
pub struct Migration; | ||
|
||
#[allow(clippy::enum_variant_names)] | ||
#[derive(Iden)] | ||
enum User { | ||
Table, | ||
Id, | ||
Username, | ||
PasswordHash, | ||
} | ||
|
||
#[async_trait::async_trait] | ||
impl MigrationTrait for Migration { | ||
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { | ||
manager | ||
.create_table( | ||
Table::create() | ||
.table(User::Table) | ||
.if_not_exists() | ||
.col( | ||
ColumnDef::new(User::Id) | ||
.integer() | ||
.not_null() | ||
.auto_increment() | ||
.primary_key(), | ||
) | ||
.col( | ||
ColumnDef::new(User::Username) | ||
.string() | ||
.unique_key() | ||
.not_null(), | ||
) | ||
.col(ColumnDef::new(User::PasswordHash).string().not_null()) | ||
.to_owned(), | ||
) | ||
.await | ||
} | ||
|
||
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { | ||
manager | ||
.drop_table(Table::drop().table(User::Table).to_owned()) | ||
.await | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# SPDX-License-Identifier: CC0-1.0 | ||
# | ||
# service/Cargo.toml | ||
# | ||
# This file is a component of ShadyURL by Elizabeth Myers. | ||
# | ||
# To the extent possible under law, the person who associated CC0 with | ||
# ShadyURL has waived all copyright and related or neighboring rights | ||
# to ShadyURL. | ||
# | ||
# You should have received a copy of the CC0 legalcode along with this | ||
# work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. | ||
|
||
[package] | ||
name = "service" | ||
version = "0.1.0" | ||
edition = "2021" | ||
license = "CC0-1.0" | ||
publish = false | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[lib] | ||
name = "service" | ||
path = "src/lib.rs" | ||
|
||
[features] | ||
default = ["sqlite"] | ||
mysql = ["sea-orm/sqlx-mysql"] | ||
postgres = ["sea-orm/sqlx-postgres"] | ||
sqlite = ["sea-orm/sqlx-sqlite"] | ||
|
||
[dependencies] | ||
entity = { path = "../entity" } | ||
|
||
[dependencies.sea-orm] | ||
version = "1.0.0-rc.1" | ||
features = [ | ||
"debug-print", | ||
"runtime-tokio-native-tls", | ||
] | ||
|
||
[dev-dependencies] | ||
tokio = { version = "1.36", features = ["macros", "rt"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* SPDX-License-Identifier: CC0-1.0 | ||
* | ||
* service/src/lib.rs | ||
* | ||
* This file is a component of ShadyURL by Elizabeth Myers. | ||
* | ||
* To the extent possible under law, the person who associated CC0 with | ||
* ShadyURL has waived all copyright and related or neighboring rights | ||
* to ShadyURL. | ||
* | ||
* You should have received a copy of the CC0 legalcode along with this | ||
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. | ||
*/ | ||
|
||
mod mutation; | ||
mod query; | ||
|
||
pub use mutation::*; | ||
pub use query::*; | ||
|
||
pub use sea_orm; |
Oops, something went wrong.