feat: kill s3

This commit is contained in:
DJMrTV 2025-06-06 10:25:16 +02:00
commit 1935b8f6c4
24 changed files with 86 additions and 1228 deletions

View file

@ -1,27 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "\n INSERT INTO users (\n pid,\n username,\n password,\n birthdate,\n timezone,\n email,\n country,\n language,\n marketing_allowed,\n off_device_allowed,\n region,\n gender,\n mii_data,\n verification_code\n ) VALUES (\n $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14\n )\n ",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Int4",
"Varchar",
"Varchar",
"Date",
"Varchar",
"Varchar",
"Varchar",
"Varchar",
"Bool",
"Bool",
"Int4",
"Bpchar",
"Varchar",
"Int4"
]
},
"nullable": []
},
"hash": "02d51edf65163f311dfa215da26acb2bc8c02735e2f79782c612d5fe0cf01042"
}

View file

@ -1,22 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "SELECT EXISTS(SELECT 1 FROM users WHERE username = $1 ) as exists",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "exists",
"type_info": "Bool"
}
],
"parameters": {
"Left": [
"Text"
]
},
"nullable": [
null
]
},
"hash": "08c4a5721982ecd267ebc515b866c61aaef9395170430a58dcd7ac78f8cc75b2"
}

View file

@ -1,15 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "UPDATE users SET email_verified_since = $1 WHERE pid = $2",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Timestamp",
"Int4"
]
},
"nullable": []
},
"hash": "248fc3dbfadb793f1f380486d9c1c95230d4d5a7ee3cb66d9382b7f0522c5e82"
}

View file

@ -1,20 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "SELECT nextval('pid_counter') as pid",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "pid",
"type_info": "Int8"
}
],
"parameters": {
"Left": []
},
"nullable": [
null
]
},
"hash": "3c9b1695f8ae49e4308c048de98c1c262351465b6f102e98912f67442a1f54d9"
}

View file

@ -1,72 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "select * from tokens where pid = $1 and token_id = $2 and random = $3",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "pid",
"type_info": "Int4"
},
{
"ordinal": 1,
"name": "token_id",
"type_info": "Int8"
},
{
"ordinal": 2,
"name": "assigned_ip",
"type_info": "Inet"
},
{
"ordinal": 3,
"name": "random",
"type_info": "Int4"
},
{
"ordinal": 4,
"name": "token_type",
"type_info": "Int4"
},
{
"ordinal": 5,
"name": "creation_time",
"type_info": "Timestamp"
},
{
"ordinal": 6,
"name": "expires",
"type_info": "Timestamp"
},
{
"ordinal": 7,
"name": "title_id",
"type_info": "Varchar"
},
{
"ordinal": 8,
"name": "account_level",
"type_info": "Int4"
}
],
"parameters": {
"Left": [
"Int4",
"Int8",
"Int4"
]
},
"nullable": [
false,
false,
true,
false,
false,
false,
false,
true,
true
]
},
"hash": "48710e0b87742cc3fef816b3c95604095f71324011e7093ec37af15da8c158f4"
}

View file

@ -1,28 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "select pid, username from users where username = $1",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "pid",
"type_info": "Int4"
},
{
"ordinal": 1,
"name": "username",
"type_info": "Varchar"
}
],
"parameters": {
"Left": [
"Text"
]
},
"nullable": [
false,
false
]
},
"hash": "566221b869f293e6c721e2e8bbf3087943e5816a98cdce151302055c58bd1183"
}

View file

@ -1,28 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "select address, port from nex_servers where game_server_id = $1",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "address",
"type_info": "Inet"
},
{
"ordinal": 1,
"name": "port",
"type_info": "Int4"
}
],
"parameters": {
"Left": [
"Text"
]
},
"nullable": [
false,
false
]
},
"hash": "5bd26d4c9e701bde77ce598fea2ce0b98ea2c7de03e71ac704c3ba047162c0b2"
}

View file

@ -1,130 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "SELECT * FROM users WHERE username = $1",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "pid",
"type_info": "Int4"
},
{
"ordinal": 1,
"name": "username",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "password",
"type_info": "Varchar"
},
{
"ordinal": 3,
"name": "birthdate",
"type_info": "Date"
},
{
"ordinal": 4,
"name": "timezone",
"type_info": "Varchar"
},
{
"ordinal": 5,
"name": "email",
"type_info": "Varchar"
},
{
"ordinal": 6,
"name": "email_verified_since",
"type_info": "Timestamp"
},
{
"ordinal": 7,
"name": "country",
"type_info": "Varchar"
},
{
"ordinal": 8,
"name": "language",
"type_info": "Varchar"
},
{
"ordinal": 9,
"name": "gender",
"type_info": "Bpchar"
},
{
"ordinal": 10,
"name": "marketing_allowed",
"type_info": "Bool"
},
{
"ordinal": 11,
"name": "off_device_allowed",
"type_info": "Bool"
},
{
"ordinal": 12,
"name": "region",
"type_info": "Int4"
},
{
"ordinal": 13,
"name": "mii_data",
"type_info": "Varchar"
},
{
"ordinal": 14,
"name": "account_level",
"type_info": "Int4"
},
{
"ordinal": 15,
"name": "creation_date",
"type_info": "Timestamp"
},
{
"ordinal": 16,
"name": "updated",
"type_info": "Timestamp"
},
{
"ordinal": 17,
"name": "nex_password",
"type_info": "Varchar"
},
{
"ordinal": 18,
"name": "verification_code",
"type_info": "Int4"
}
],
"parameters": {
"Left": [
"Text"
]
},
"nullable": [
false,
false,
false,
false,
false,
false,
true,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
true
]
},
"hash": "606364c79e0990deb07dfbe6c32b3d302d083ec5333f3a5ce04113c38a041100"
}

View file

@ -1,22 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "select nex_password from users where pid = $1",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "nex_password",
"type_info": "Varchar"
}
],
"parameters": {
"Left": [
"Int4"
]
},
"nullable": [
false
]
},
"hash": "6c1df0b05553305ba847f571a5859bf11353f28c25e4f81268e9379b5b2cb375"
}

View file

@ -1,46 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "SELECT pid, username, account_level, nex_password, mii_data FROM users WHERE username = $1",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "pid",
"type_info": "Int4"
},
{
"ordinal": 1,
"name": "username",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "account_level",
"type_info": "Int4"
},
{
"ordinal": 3,
"name": "nex_password",
"type_info": "Varchar"
},
{
"ordinal": 4,
"name": "mii_data",
"type_info": "Varchar"
}
],
"parameters": {
"Left": [
"Text"
]
},
"nullable": [
false,
false,
false,
false,
false
]
},
"hash": "6de07eba2f12b15f541d129b83664a272a0d3ac9e929e70b399582fa3f14166d"
}

View file

@ -1,130 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "SELECT * FROM users WHERE pid = $1",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "pid",
"type_info": "Int4"
},
{
"ordinal": 1,
"name": "username",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "password",
"type_info": "Varchar"
},
{
"ordinal": 3,
"name": "birthdate",
"type_info": "Date"
},
{
"ordinal": 4,
"name": "timezone",
"type_info": "Varchar"
},
{
"ordinal": 5,
"name": "email",
"type_info": "Varchar"
},
{
"ordinal": 6,
"name": "email_verified_since",
"type_info": "Timestamp"
},
{
"ordinal": 7,
"name": "country",
"type_info": "Varchar"
},
{
"ordinal": 8,
"name": "language",
"type_info": "Varchar"
},
{
"ordinal": 9,
"name": "gender",
"type_info": "Bpchar"
},
{
"ordinal": 10,
"name": "marketing_allowed",
"type_info": "Bool"
},
{
"ordinal": 11,
"name": "off_device_allowed",
"type_info": "Bool"
},
{
"ordinal": 12,
"name": "region",
"type_info": "Int4"
},
{
"ordinal": 13,
"name": "mii_data",
"type_info": "Varchar"
},
{
"ordinal": 14,
"name": "account_level",
"type_info": "Int4"
},
{
"ordinal": 15,
"name": "creation_date",
"type_info": "Timestamp"
},
{
"ordinal": 16,
"name": "updated",
"type_info": "Timestamp"
},
{
"ordinal": 17,
"name": "nex_password",
"type_info": "Varchar"
},
{
"ordinal": 18,
"name": "verification_code",
"type_info": "Int4"
}
],
"parameters": {
"Left": [
"Int4"
]
},
"nullable": [
false,
false,
false,
false,
false,
false,
true,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
true
]
},
"hash": "93960465bbf8f670891d49b95fc52257c0ef596eee2d9a0e6a7d0aad03de4421"
}

View file

@ -1,72 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "select * from tokens where pid = $1 and token_id = $2 and random =$3",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "pid",
"type_info": "Int4"
},
{
"ordinal": 1,
"name": "token_id",
"type_info": "Int8"
},
{
"ordinal": 2,
"name": "assigned_ip",
"type_info": "Inet"
},
{
"ordinal": 3,
"name": "random",
"type_info": "Int4"
},
{
"ordinal": 4,
"name": "token_type",
"type_info": "Int4"
},
{
"ordinal": 5,
"name": "creation_time",
"type_info": "Timestamp"
},
{
"ordinal": 6,
"name": "expires",
"type_info": "Timestamp"
},
{
"ordinal": 7,
"name": "title_id",
"type_info": "Varchar"
},
{
"ordinal": 8,
"name": "account_level",
"type_info": "Int4"
}
],
"parameters": {
"Left": [
"Int4",
"Int8",
"Int4"
]
},
"nullable": [
false,
false,
true,
false,
false,
false,
false,
true,
true
]
},
"hash": "9d3cee43a86cead9a6d078abc1266fc2a97ac6e25a9733d1d20faf555c67abe1"
}

View file

@ -1,15 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "UPDATE users SET mii_data = $1 WHERE pid = $2",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Varchar",
"Int4"
]
},
"nullable": []
},
"hash": "b08800e65b5b8a788e5a5d2f2036bce05bcd8c74c0b5077d786e35ee290447a2"
}

View file

@ -1,22 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "SELECT verification_code FROM users WHERE pid = $1",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "verification_code",
"type_info": "Int4"
}
],
"parameters": {
"Left": [
"Int4"
]
},
"nullable": [
true
]
},
"hash": "b16ba4b6c1b7d1c207e94515268c3bbd90d4bcf92d20203cba5afb2664f4bb8a"
}

View file

@ -1,22 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "SELECT EXISTS(select 1 from users where pid = $1)",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "exists",
"type_info": "Bool"
}
],
"parameters": {
"Left": [
"Int4"
]
},
"nullable": [
null
]
},
"hash": "c8d50662530cac49c4261fb321cd15f9e4bafdfca12d2130a873d44a88dd435b"
}

View file

@ -1,40 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "SELECT username, account_level, nex_password, mii_data FROM users WHERE pid = $1",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "username",
"type_info": "Varchar"
},
{
"ordinal": 1,
"name": "account_level",
"type_info": "Int4"
},
{
"ordinal": 2,
"name": "nex_password",
"type_info": "Varchar"
},
{
"ordinal": 3,
"name": "mii_data",
"type_info": "Varchar"
}
],
"parameters": {
"Left": [
"Int4"
]
},
"nullable": [
false,
false,
false,
false
]
},
"hash": "d8a0ba20ad0db4ba8821964944b00dd589cdd9cd0ac91c27edf3f79ba4174a18"
}

View file

@ -1,30 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "insert into tokens (token_type, pid, title_id)\n values ($1, $2, $3) returning token_id, random",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "token_id",
"type_info": "Int8"
},
{
"ordinal": 1,
"name": "random",
"type_info": "Int4"
}
],
"parameters": {
"Left": [
"Int4",
"Int4",
"Varchar"
]
},
"nullable": [
false,
false
]
},
"hash": "e5a2f7f28c3d7b9524d3dce48a9e47d6180ff634ebf59f3a1efd92b797170ac2"
}

View file

@ -1,28 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "select pid, username from users where pid = $1",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "pid",
"type_info": "Int4"
},
{
"ordinal": 1,
"name": "username",
"type_info": "Varchar"
}
],
"parameters": {
"Left": [
"Int4"
]
},
"nullable": [
false,
false
]
},
"hash": "eafa97669e8ec04f1dc0a8e05d417f12ffeeb26a5eabca323abfed0e1d7bcbea"
}

298
Cargo.lock generated
View file

@ -24,7 +24,6 @@ dependencies = [
"log",
"md-5",
"mii",
"minio",
"once_cell",
"prost",
"quick-xml",
@ -262,56 +261,6 @@ dependencies = [
"libc",
]
[[package]]
name = "anstream"
version = "0.6.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b"
dependencies = [
"anstyle",
"anstyle-parse",
"anstyle-query",
"anstyle-wincon",
"colorchoice",
"is_terminal_polyfill",
"utf8parse",
]
[[package]]
name = "anstyle"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9"
[[package]]
name = "anstyle-parse"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c"
dependencies = [
"windows-sys 0.59.0",
]
[[package]]
name = "anstyle-wincon"
version = "3.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e"
dependencies = [
"anstyle",
"once_cell",
"windows-sys 0.59.0",
]
[[package]]
name = "anyhow"
version = "1.0.97"
@ -330,17 +279,6 @@ dependencies = [
"password-hash",
]
[[package]]
name = "async-recursion"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.98",
]
[[package]]
name = "async-stream"
version = "0.3.6"
@ -360,7 +298,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.98",
"syn",
]
[[package]]
@ -371,7 +309,7 @@ checksum = "644dd749086bf3771a2fbc5f256fdb982d53f011c7d5d560304eafeecebce79d"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.98",
"syn",
]
[[package]]
@ -413,7 +351,7 @@ dependencies = [
"derive_utils",
"proc-macro2",
"quote",
"syn 2.0.98",
"syn",
]
[[package]]
@ -584,7 +522,7 @@ checksum = "3fa76293b4f7bb636ab88fd78228235b5248b4d05cc589aed610f954af5d7c7a"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.98",
"syn",
]
[[package]]
@ -667,12 +605,6 @@ dependencies = [
"inout",
]
[[package]]
name = "colorchoice"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
[[package]]
name = "concurrent-queue"
version = "2.5.0"
@ -773,20 +705,6 @@ dependencies = [
"typenum",
]
[[package]]
name = "dashmap"
version = "6.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf"
dependencies = [
"cfg-if",
"crossbeam-utils",
"hashbrown 0.14.5",
"lock_api",
"once_cell",
"parking_lot_core",
]
[[package]]
name = "debugid"
version = "0.8.0"
@ -817,17 +735,6 @@ dependencies = [
"powerfmt",
]
[[package]]
name = "derivative"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "derive_more"
version = "2.0.1"
@ -845,7 +752,7 @@ checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.98",
"syn",
"unicode-xid",
]
@ -857,7 +764,7 @@ checksum = "ccfae181bab5ab6c5478b2ccb69e4c68a02f8c3ec72f6616bfec9dbc599d2ee0"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.98",
"syn",
]
[[package]]
@ -890,7 +797,7 @@ dependencies = [
"proc-macro2",
"proc-macro2-diagnostics",
"quote",
"syn 2.0.98",
"syn",
]
[[package]]
@ -913,7 +820,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.98",
"syn",
]
[[package]]
@ -956,29 +863,6 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "env_filter"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0"
dependencies = [
"log",
"regex",
]
[[package]]
name = "env_logger"
version = "0.11.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcaee3d8e3cfc3fd92428d477bc97fc29ec8716d180c0d74c643bb26166660e0"
dependencies = [
"anstream",
"anstyle",
"env_filter",
"humantime",
"log",
]
[[package]]
name = "equivalent"
version = "1.0.2"
@ -1169,7 +1053,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.98",
"syn",
]
[[package]]
@ -1473,12 +1357,6 @@ version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
[[package]]
name = "humantime"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]]
name = "hyper"
version = "0.14.32"
@ -1727,7 +1605,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.98",
"syn",
]
[[package]]
@ -1820,12 +1698,6 @@ dependencies = [
"windows-sys 0.59.0",
]
[[package]]
name = "is_terminal_polyfill"
version = "1.70.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
[[package]]
name = "itertools"
version = "0.14.0"
@ -1877,7 +1749,7 @@ checksum = "760dbe46660494d469023d661e8d268f413b2cb68c999975dcc237407096a693"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.98",
"syn",
"url",
]
@ -2044,12 +1916,6 @@ dependencies = [
"digest",
]
[[package]]
name = "md5"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771"
[[package]]
name = "memchr"
version = "2.7.4"
@ -2072,46 +1938,6 @@ version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
[[package]]
name = "minio"
version = "0.2.0-alpha"
source = "git+https://github.com/minio/minio-rs.git#b2a6cb2655cbe5ca9908779bafee84964570447d"
dependencies = [
"async-recursion",
"async-trait",
"base64",
"byteorder",
"bytes",
"chrono",
"crc",
"dashmap",
"derivative",
"env_logger",
"futures-util",
"hex",
"hmac",
"home",
"http 1.2.0",
"hyper 1.6.0",
"lazy_static",
"log",
"md5",
"multimap",
"os_info",
"percent-encoding",
"rand 0.8.5",
"regex",
"reqwest",
"serde",
"serde_json",
"sha2",
"tokio",
"tokio-stream",
"tokio-util",
"urlencoding",
"xmltree",
]
[[package]]
name = "miniz_oxide"
version = "0.8.5"
@ -2157,9 +1983,6 @@ name = "multimap"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "defc4c55412d89136f966bbb339008b474350e5e6e78d2714439c386b3137a03"
dependencies = [
"serde",
]
[[package]]
name = "native-tls"
@ -2298,7 +2121,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.98",
"syn",
]
[[package]]
@ -2396,7 +2219,7 @@ dependencies = [
"proc-macro2",
"proc-macro2-diagnostics",
"quote",
"syn 2.0.98",
"syn",
]
[[package]]
@ -2441,7 +2264,7 @@ checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.98",
"syn",
]
[[package]]
@ -2505,7 +2328,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1ccf34da56fc294e7d4ccf69a85992b7dfb826b7cf57bac6a70bba3494cc08a"
dependencies = [
"proc-macro2",
"syn 2.0.98",
"syn",
]
[[package]]
@ -2525,7 +2348,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.98",
"syn",
"version_check",
"yansi",
]
@ -2556,7 +2379,7 @@ dependencies = [
"prost",
"prost-types",
"regex",
"syn 2.0.98",
"syn",
"tempfile",
]
@ -2570,7 +2393,7 @@ dependencies = [
"itertools",
"proc-macro2",
"quote",
"syn 2.0.98",
"syn",
]
[[package]]
@ -2701,7 +2524,7 @@ checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.98",
"syn",
]
[[package]]
@ -2790,13 +2613,11 @@ dependencies = [
"system-configuration",
"tokio",
"tokio-native-tls",
"tokio-util",
"tower 0.5.2",
"tower-service",
"url",
"wasm-bindgen",
"wasm-bindgen-futures",
"wasm-streams",
"web-sys",
"windows-registry",
]
@ -2865,7 +2686,7 @@ dependencies = [
"proc-macro2",
"quote",
"rocket_http",
"syn 2.0.98",
"syn",
"unicode-xid",
"version_check",
]
@ -3182,7 +3003,7 @@ checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.98",
"syn",
]
[[package]]
@ -3392,7 +3213,7 @@ dependencies = [
"quote",
"sqlx-core",
"sqlx-macros-core",
"syn 2.0.98",
"syn",
]
[[package]]
@ -3415,7 +3236,7 @@ dependencies = [
"sqlx-mysql",
"sqlx-postgres",
"sqlx-sqlite",
"syn 2.0.98",
"syn",
"tokio",
"url",
]
@ -3587,17 +3408,6 @@ version = "2.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]]
name = "syn"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "syn"
version = "2.0.98"
@ -3626,7 +3436,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.98",
"syn",
]
[[package]]
@ -3681,7 +3491,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.98",
"syn",
]
[[package]]
@ -3776,7 +3586,7 @@ checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.98",
"syn",
]
[[package]]
@ -3898,7 +3708,7 @@ dependencies = [
"prost-build",
"prost-types",
"quote",
"syn 2.0.98",
"syn",
]
[[package]]
@ -3968,7 +3778,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.98",
"syn",
]
[[package]]
@ -4114,12 +3924,6 @@ dependencies = [
"serde",
]
[[package]]
name = "urlencoding"
version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da"
[[package]]
name = "utf16_iter"
version = "1.0.5"
@ -4132,12 +3936,6 @@ version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
[[package]]
name = "utf8parse"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]]
name = "uuid"
version = "1.16.0"
@ -4217,7 +4015,7 @@ dependencies = [
"log",
"proc-macro2",
"quote",
"syn 2.0.98",
"syn",
"wasm-bindgen-shared",
]
@ -4252,7 +4050,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.98",
"syn",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@ -4266,19 +4064,6 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "wasm-streams"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65"
dependencies = [
"futures-util",
"js-sys",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
]
[[package]]
name = "web-sys"
version = "0.3.77"
@ -4616,21 +4401,6 @@ version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51"
[[package]]
name = "xml-rs"
version = "0.8.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c5b940ebc25896e71dd073bad2dbaa2abfe97b0a391415e22ad1326d9c54e3c4"
[[package]]
name = "xmltree"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b619f8c85654798007fb10afa5125590b43b088c225a25fc2fec100a9fad0fc6"
dependencies = [
"xml-rs",
]
[[package]]
name = "yansi"
version = "1.0.1"
@ -4660,7 +4430,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.98",
"syn",
"synstructure",
]
@ -4682,7 +4452,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.98",
"syn",
]
[[package]]
@ -4702,7 +4472,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.98",
"syn",
"synstructure",
]
@ -4731,5 +4501,5 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.98",
"syn",
]

View file

@ -35,7 +35,6 @@ hmac = "0.12.1"
md-5 = "0.10.6"
cbc = "0.1.2"
mii = { path = "./mii" }
minio = { git = "https://github.com/minio/minio-rs.git" }
crc32fast = "1.4.2"
gxhash = "3.4.1"
sentry = "0.38.0"

View file

@ -4,9 +4,6 @@ use std::sync::Arc;
use std::time::{SystemTime, UNIX_EPOCH};
use dotenvy::dotenv;
use juniper::{EmptyMutation, EmptySubscription};
use minio::s3::ClientBuilder;
use minio::s3::creds::StaticProvider;
use minio::s3::http::BaseUrl;
use once_cell::sync::Lazy;
use rocket::fairing::AdHoc;
use rocket::http::{ContentType, Header, Status};
@ -16,7 +13,6 @@ use sqlx::Postgres;
use sqlx::postgres::PgPoolOptions;
use tonic::transport::Server;
use crate::graphql::{Query, Schema};
use crate::nnid::people::S3ClientState;
mod xml;
mod conntest;
@ -30,6 +26,7 @@ mod grpc;
mod graphql;
mod email;
mod papi;
mod mii_util;
type Pool = sqlx::Pool<Postgres>;
@ -103,44 +100,8 @@ async fn launch() -> _ {
.connect(&act_database_url).await
.expect("unable to create pool");
pub static S3_URL_STRING: Lazy<Box<str>> = Lazy::new(||
env::var("S3_URL").expect("S3_URL not specified").into_boxed_str()
);
pub static S3_URL: Lazy<BaseUrl> = Lazy::new(||
S3_URL_STRING.parse().unwrap()
);
pub static S3_USER: Lazy<Box<str>> = Lazy::new(||
env::var("S3_USER").expect("S3_USER not specified").into_boxed_str()
);
pub static S3_PASSWD: Lazy<Box<str>> = Lazy::new(||
env::var("S3_PASSWD").expect("S3_PASSWD not specified").into_boxed_str()
);
pub static CDN_URL: Lazy<Box<str>> = Lazy::new(||
env::var("CDN_URL").expect("CDN_URL not specified").into_boxed_str()
);
let s3_client = ClientBuilder::new(S3_URL.clone())
.provider(Some(Box::new(StaticProvider::new(&S3_USER, &S3_PASSWD, None))))
.build()
.expect("failed to create s3 client");
let _guard = sentry::init(("https://03b49d3cc0012089b6f2608c265a721b@o4508799920635904.ingest.de.sentry.io/4509298106826832", sentry::ClientOptions {
release: sentry::release_name!(),
// Capture user IPs and potentially sensitive headers when using HTTP server integrations
// see https://docs.sentry.io/platforms/rust/data-management/data-collected for more info
send_default_pii: true,
..Default::default()
}));
rocket::build()
.manage(pool)
.manage(S3ClientState {
client: Arc::new(s3_client),
})
.manage(Schema::new(
Query,
EmptyMutation::new(),

14
src/mii_util.rs Normal file
View file

@ -0,0 +1,14 @@
use std::env;
use once_cell::sync::Lazy;
pub static MII_PROVIDER_SERVER_URL: Lazy<Box<str>> = Lazy::new(||
env::var("MII_PROVIDER_SERVER_URL").expect("MII_PROVIDER_SERVER_URL not specified").into_boxed_str()
);
fn get_mii_img_url_path(pid: i32, format: &str) -> String{
format!("{}/main.{}", pid, format)
}
pub fn get_mii_img_url(pid: i32, format: &str) -> String{
format!("{}/{}", &*MII_PROVIDER_SERVER_URL, get_mii_img_url_path(pid, format))
}

View file

@ -2,10 +2,6 @@ use std::env;
use std::io::Write;
use chrono::{NaiveDate, NaiveDateTime};
use gxhash::{gxhash32, gxhash64};
use minio::s3::builders::{ObjectContent};
use minio::s3::client::ClientBuilder;
use minio::s3::creds::StaticProvider;
use minio::s3::http::BaseUrl;
use once_cell::sync::Lazy;
use rocket::{get, post, put, State};
use rocket::serde::{Deserialize, Serialize};
@ -19,8 +15,8 @@ use crate::xml::{Xml, YesNoVal};
use crate::email::send_verification_email;
use rand::Rng;
use mii::{get_image_png, get_image_tga};
use minio::s3::client::Client;
use std::sync::Arc;
use crate::mii_util::get_mii_img_url;
const DATABASE_ERROR: Errors = Errors{
error: &[
@ -31,34 +27,8 @@ const DATABASE_ERROR: Errors = Errors{
]
};
pub static S3_URL_STRING: Lazy<Box<str>> = Lazy::new(||
env::var("S3_URL").expect("S3_URL not specified").into_boxed_str()
);
pub static S3_URL: Lazy<BaseUrl> = Lazy::new(||
S3_URL_STRING.parse().unwrap()
);
pub static S3_USER: Lazy<Box<str>> = Lazy::new(||
env::var("S3_USER").expect("S3_USER not specified").into_boxed_str()
);
pub static S3_PASSWD: Lazy<Box<str>> = Lazy::new(||
env::var("S3_PASSWD").expect("S3_PASSWD not specified").into_boxed_str()
);
pub static S3_BUCKET: Lazy<Box<str>> = Lazy::new(||
env::var("S3_BUCKET").expect("S3_BUCKET not specified").into_boxed_str()
);
fn get_mii_img_url_path(pid: i32, format: &str) -> String{
format!("mii/{}/main.{}", pid, format)
}
fn get_mii_img_url(pid: i32, format: &str) -> String{
format!("{}/{}/{}", &*S3_URL_STRING, &*S3_BUCKET, get_mii_img_url_path(pid, format))
}
/*
pub async fn generate_s3_images(pid: i32, mii_data: &str) {
let auth = StaticProvider::new(&S3_USER, &S3_PASSWD, None);
@ -97,17 +67,13 @@ pub async fn generate_s3_images(pid: i32, mii_data: &str) {
} else {
println!("Successfully uploaded TGA for PID {}", pid);
}
}
}*/
#[derive(Deserialize)]
pub struct Email{
address: Box<str>
}
pub struct S3ClientState {
pub client: Arc<Client>,
}
#[derive(Deserialize)]
pub struct UpdateMiiData {
name: Box<str>,
@ -217,7 +183,7 @@ pub async fn create_account(database: &State<Pool>, data: Xml<AccountCreationDat
verification_code,
).execute(database).await.unwrap();
generate_s3_images(pid, &data).await;
//generate_s3_images(pid, &data).await;
if let Err(e) = send_verification_email(address.as_ref(), verification_code, user_id.as_ref()).await {
println!("Failed to send verification email: {e}");
@ -401,7 +367,6 @@ fn build_own_profile(user: User) -> Ds<Xml<GetOwnProfileData>> {
#[put("/v1/api/people/@me/miis/@primary", data = "<data>")]
pub async fn change_mii(
database: &State<Pool>,
s3: &State<S3ClientState>,
auth: Auth<false>,
data: Xml<UpdateMiiData>,
) -> Result<(), Option<Errors<'static>>> {
@ -426,83 +391,5 @@ pub async fn change_mii(
println!("Successfully updated Mii data for PID {}", pid);
generate_mii_images(s3.client.clone(), &**S3_BUCKET, pid, mii_data).await;
Ok(())
}
pub async fn generate_mii_images(client: Arc<Client>, bucket: &str, pid: i32, mii_data: &str) {
let user_mii_key = format!("mii/{}", pid);
async fn save_and_upload(
client: &Client,
bucket: &str,
key: &str,
data: &[u8],
) -> Result<(), Box<dyn std::error::Error>> {
let temp_path = format!("/tmp/{}", key.replace("/", "_"));
{
let mut file = std::fs::File::create(&temp_path)?;
file.write_all(data)?;
file.flush()?;
}
let content = ObjectContent::from(std::path::Path::new(&temp_path));
client.put_object_content(bucket, key, content).send().await?;
std::fs::remove_file(&temp_path)?;
Ok(())
}
if let Some(png_data) = get_image_png(mii_data).await {
if let Err(e) = save_and_upload(&client, bucket, &format!("{}/normal_face.png", user_mii_key), &png_data).await {
println!("Failed to upload normal_face.png for PID {}: {:?}", pid, e);
}
}
if let Some(tga_data) = get_image_tga(mii_data).await {
if let Err(e) = save_and_upload(&client, bucket, &format!("{}/standard.tga", user_mii_key), &tga_data).await {
println!("Failed to upload standard.tga for PID {}: {:?}", pid, e);
}
}
let expressions = [
"frustrated",
"smile_open_mouth",
"wink_left",
"sorrow",
"surprise_open_mouth",
];
for expression in expressions.iter() {
let url = format!(
"https://mii-unsecure.ariankordi.net/miis/image.png?data={}&expression={}&type=face&width=128&instance_count=1",
mii_data, expression
);
if let Ok(resp) = reqwest::get(&url).await {
if let Ok(bytes) = resp.bytes().await {
if let Err(e) = save_and_upload(&client, bucket, &format!("{}/{}.png", user_mii_key, expression), &bytes).await {
println!("Failed to upload {}.png for PID {}: {:?}", expression, pid, e);
}
}
}
}
let body_url = format!(
"https://mii-unsecure.ariankordi.net/miis/image.png?data={}&type=all_body&width=270&instance_count=1",
mii_data
);
if let Ok(resp) = reqwest::get(&body_url).await {
if let Ok(bytes) = resp.bytes().await {
if let Err(e) = save_and_upload(&client, bucket, &format!("{}/body.png", user_mii_key), &bytes).await {
println!("Failed to upload body.png for PID {}: {:?}", pid, e);
}
}
}
println!("Finished Mii image generation for PID {}", pid);
}
}

View file

@ -1,35 +1,32 @@
use rocket::{State, post, FromForm, put};
use crate::Pool;
use rocket::form::Form;
use crate::error::{Error, Errors};
use chrono::Utc;
use rocket::form::Form;
use rocket::{FromForm, State, post, put};
const BAD_CODE_ERROR: Errors = Errors{
error: &[
Error{
code: "0116",
message: "Missing or invalid verification code"
}
]
const BAD_CODE_ERROR: Errors = Errors {
error: &[Error {
code: "0116",
message: "Missing or invalid verification code",
}],
};
#[derive(FromForm)]
pub struct ValidateEmailInput{
pub struct ValidateEmailInput {
email: String,
}
#[post("/v1/api/support/validate/email", data="<data>")]
pub async fn validate(data: Form<ValidateEmailInput>){
}
#[post("/v1/api/support/validate/email", data = "<data>")]
pub async fn validate(data: Form<ValidateEmailInput>) {}
#[put("/v1/api/support/email_confirmation/<pid>/<code>")]
pub async fn verify_email(database: &State<Pool>, pid: i32, code: i32) -> Result<(), Errors<'static>> {
pub async fn verify_email(
database: &State<Pool>,
pid: i32,
code: i32,
) -> Result<(), Errors<'static>> {
let db = database.inner();
let result = sqlx::query!(
"SELECT verification_code FROM users WHERE pid = $1",
pid
)
let result = sqlx::query!("SELECT verification_code FROM users WHERE pid = $1", pid)
.fetch_optional(db)
.await;
@ -37,24 +34,23 @@ pub async fn verify_email(database: &State<Pool>, pid: i32, code: i32) -> Result
return Err(BAD_CODE_ERROR);
};
if let Some(stored_code) = record.verification_code {
if stored_code == code {
// Set email_verified_since to NOW
let now = Utc::now().naive_utc();
let update_result = sqlx::query!(
"UPDATE users SET email_verified_since = $1 WHERE pid = $2",
now,
pid
)
.execute(db)
.await;
let stored_code = record.verification_code;
if stored_code == code {
// Set email_verified_since to NOW
let now = Utc::now().naive_utc();
let update_result = sqlx::query!(
"UPDATE users SET email_verified_since = $1 WHERE pid = $2",
now,
pid
)
.execute(db)
.await;
if update_result.is_err() {
return Err(BAD_CODE_ERROR); // fallback in case the update fails
}
return Ok(()); // Success
if update_result.is_err() {
return Err(BAD_CODE_ERROR); // fallback in case the update fails
}
return Ok(()); // Success
}
Err(BAD_CODE_ERROR)