дохуя сделал

This commit is contained in:
neroduckale 2024-03-17 04:39:37 +05:00
parent 44a897a4c0
commit e9d7dabd6d
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 399E73062E1A3667
17 changed files with 166 additions and 200 deletions

View file

@ -1,45 +0,0 @@
namespace nrdkwebsite;
public static class API
{
public static async Task<User> PostNewUser(NewUser newuser, DatabaseHandler db)
{
User user = new User(newuser.nickname, db.users.OrderBy(p => p.id).Last().id + 1, newuser.mast);
await db.users.AddAsync(user);
await db.SaveChangesAsync();
return user;
}
public static async Task<IResult> DeleteUser(int id, DatabaseHandler db)
{
User? user = db.users.FirstOrDefault(u => u.id == id);
if (user == null) return Results.NotFound(new { message = "Пользователь не найден" });
db.users.Remove(user);
await db.SaveChangesAsync();
return Results.Json(user);
}
public static IResult GetUserByName(string name, DatabaseHandler db)
{
var users = db.users.ToList();
User? user = users.FirstOrDefault(u => u.nickname == name);
// если не найден, отправляем статусный код и сообщение об ошибке
if (user == null) return Results.NotFound(new { message = "Пользователь не найден" });
// если пользователь найден, отправляем его
return Results.Json(user);
}
public static IResult GetUserById(int id, DatabaseHandler db)
{
var users = db.users.ToList();
User? user = users.FirstOrDefault(u => u.id == id);
// если не найден, отправляем статусный код и сообщение об ошибке
if (user == null) return Results.NotFound(new { message = "Пользователь не найден" });
// если пользователь найден, отправляем его
return Results.Json(user);
}
public static List<User> GetUsers(DatabaseHandler db)
{
return db.users.OrderBy(u => u.id).ToList();
}
}

View file

@ -1,32 +0,0 @@
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
namespace nrdkwebsite;
public sealed class DatabaseHandler : DbContext
{
public DbSet<User> users { get; set; } = null!;
public DatabaseHandler(DbContextOptions<DatabaseHandler> options) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<User>(entity =>
{
entity.Property(u => u.nickname)
.HasColumnName("nickname")
.HasColumnType("varchar(100)")
.ValueGeneratedOnAdd();
entity.Property(u => u.id)
.HasColumnName("id")
.HasColumnType("int")
.ValueGeneratedOnAdd();
entity.Property(u => u.mast)
.HasColumnName("mast")
.HasColumnType("varchar(20)")
.ValueGeneratedOnAdd();
});
}
}

View file

@ -1,26 +0,0 @@
namespace nrdkwebsite;
public class User
{
public string nickname { get; set; }
public int id { get; set; }
public string mast { get; set; }
public User(string nickname, int id, string mast)
{
this.nickname = nickname;
this.id = id;
this.mast = mast;
}
}
public class NewUser
{
public string nickname { get; set; }
public string mast { get; set; }
public NewUser(string nickname, string mast)
{
this.nickname = nickname;
this.mast = mast;
}
}

View file

@ -1,7 +1,9 @@
@page
@model About
<div class="text-center">
neroduckale.
@ViewData["Title"] = about
<div>
<h1>neroduckale.</h1>
<h2><a href="https://t.me/neroduck" style="color: #00ff9d">telegram</a></h2>
</div>
<img src="~/img/neroduck.svg" alt="nero's logo" width="400px">

View file

@ -6,4 +6,4 @@
<h1 class="display-4">Привет, это сайт neroduckale</h1>
<p>Мой никнейм читается по разному - неродакля, неродукель, неродакале, но одно в нем остается неизменным - неро.</p>
<small>спасибо мактайлорс за помощь с созданием сайта. version: 0.3</small>
<small>спасибо мактайлорс за помощь с созданием сайта. version: 0.7</small>

View file

@ -35,6 +35,6 @@
</div>
<script src="~/js/site.js"></script>
<script src="~/lib/jquery/dist/jquery.min.js"></script>
</body>
</html>

View file

@ -2,8 +2,11 @@
@model Minecraftia
@{ViewData["Title"] = "minecraft";}
Статистика игрока <a href="https://neroduck.ru" style="color: #00ff9d">neroduckale</a>
Статистика игрока
<span>
<input type="radio" id="nrdk" name="nickname" checked /><label for="huey">neroduckale</label>
<input type="radio" id="ygolek" name="nickname"/><label for="huey">ygolek</label>
</span>
<div>Сюда внесены первые десять позиций по количеству, типо какого предмета я скрафтил в больших количествах и так далее</div>
<div class="grid-cards">
<div class="card">
@ -40,6 +43,14 @@
</div>
</div>
<div class="stats grid-cards">
<div class="card">
<canvas id="sravn">
</canvas>
</div>
</div>
<script type="module" src="https://unpkg.com/chart.js@4.2.1/dist/chart.umd.js"></script>
<script type="module" src="~/js/minecraft.js"></script>
<script type="module" src="~/js/inventory.js"></script>

View file

@ -1,6 +1,5 @@
@page
@model nrdkwebsite.Pages.Ygolek
@model Ygolek
@ViewData["Title"] = ygolek
<img src="ygolek.jpg" style="width: 1400px; height: 500px;"/>
<img src="~/img/ygolek.jpg" style="width: 75%; height: 500px;" alt="YGOLEK'S PHOTO"/>

View file

@ -66,3 +66,8 @@ a {
justify-content: center;
flex-wrap: wrap;
}
.stats {
margin-bottom: 100px;
margin-top: 30px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 28.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Слой_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
<style type="text/css">
.st0{fill:#29ABE2;stroke:#000000;stroke-width:30;stroke-miterlimit:10;}
</style>
<polygon class="st0" points="350.037,328.485 28.017,328.485 108.562,189.087 189.106,49.529 269.492,189.087 280.497,207.907 "/>
<path class="st0" d="M488,328.485c0,76.558-62.203,138.761-138.761,138.761s-138.761-62.203-138.761-138.761h139.558l-69.54-120.578
c20.256-11.643,43.702-18.182,68.742-18.182C425.797,189.725,488,251.928,488,328.485z"/>
</svg>

After

Width:  |  Height:  |  Size: 809 B

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 28.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Слой_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
<style type="text/css">
.st0{fill:#00ADD4;stroke:#808080;stroke-width:5.0001;stroke-miterlimit:10.0003;}
.st1{fill:#00ADD4;stroke:#999999;stroke-width:4.9998;stroke-miterlimit:9.9996;}
.st2{fill:#00ADD4;stroke:#B3B3B3;stroke-width:5;stroke-miterlimit:10;}
.st3{fill:none;stroke:#FFFFFF;stroke-width:10;stroke-miterlimit:10;}
</style>
<rect x="62.1" y="53.2" transform="matrix(0.2954 -0.9554 0.9554 0.2954 -64.1967 424.9557)" class="st0" width="387.7" height="405.6"/>
<rect x="62.2" y="53.2" transform="matrix(0.1555 -0.9878 0.9878 0.1555 -36.6952 469.0764)" class="st1" width="387.7" height="405.5"/>
<rect x="53.2" y="62.1" class="st2" width="405.6" height="387.7"/>
<g>
<polygon class="st3" points="315.1,301 108.4,301 160.1,211.5 211.8,122 263.4,211.5 270.4,223.6 "/>
<path class="st3" d="M403.6,301c0,49.1-39.9,89.1-89.1,89.1c-49.1,0-89.1-39.9-89.1-89.1h89.6l-44.6-77.4c13-7.5,28-11.7,44.1-11.7
C363.7,211.9,403.6,251.9,403.6,301z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

View file

@ -1,41 +0,0 @@
function admin() {
let person = prompt("Введите пинкод", "1234")
if (md5(person) !== "3d65eea6270a01922434000ca578b198") {
return;
}
document.body.style.background = "black";
}
async function deleteUser(id) {
const response = await fetch(`/api/users/${id}`, {
method: "DELETE",
headers: { "Accept": "application/json" }
});
if (response.ok === true) {
const user = await response.json();
document.getElementById(user.id).remove();
}
else {
const error = await response.json();
console.log(error.message);
}
}
async function createUser(nickname, mast) {
const response = await fetch("api/users", {
method: "POST",
headers: { "Accept": "application/json", "Content-Type": "application/json" },
body: JSON.stringify({
nickname: nickname,
mast: mast
})
});
if (response.ok === true) {
const user = await response.json();
//добавлять юзера
}
else {
const error = await response.json();
console.log(error.message);
}
}

View file

View file

@ -1,2 +0,0 @@
!function(n){"use strict";function d(n,t){var r=(65535&n)+(65535&t);return(n>>16)+(t>>16)+(r>>16)<<16|65535&r}function f(n,t,r,e,o,u){return d((u=d(d(t,n),d(e,u)))<<o|u>>>32-o,r)}function l(n,t,r,e,o,u,c){return f(t&r|~t&e,n,t,o,u,c)}function g(n,t,r,e,o,u,c){return f(t&e|r&~e,n,t,o,u,c)}function v(n,t,r,e,o,u,c){return f(t^r^e,n,t,o,u,c)}function m(n,t,r,e,o,u,c){return f(r^(t|~e),n,t,o,u,c)}function c(n,t){var r,e,o,u;n[t>>5]|=128<<t%32,n[14+(t+64>>>9<<4)]=t;for(var c=1732584193,f=-271733879,i=-1732584194,a=271733878,h=0;h<n.length;h+=16)c=l(r=c,e=f,o=i,u=a,n[h],7,-680876936),a=l(a,c,f,i,n[h+1],12,-389564586),i=l(i,a,c,f,n[h+2],17,606105819),f=l(f,i,a,c,n[h+3],22,-1044525330),c=l(c,f,i,a,n[h+4],7,-176418897),a=l(a,c,f,i,n[h+5],12,1200080426),i=l(i,a,c,f,n[h+6],17,-1473231341),f=l(f,i,a,c,n[h+7],22,-45705983),c=l(c,f,i,a,n[h+8],7,1770035416),a=l(a,c,f,i,n[h+9],12,-1958414417),i=l(i,a,c,f,n[h+10],17,-42063),f=l(f,i,a,c,n[h+11],22,-1990404162),c=l(c,f,i,a,n[h+12],7,1804603682),a=l(a,c,f,i,n[h+13],12,-40341101),i=l(i,a,c,f,n[h+14],17,-1502002290),c=g(c,f=l(f,i,a,c,n[h+15],22,1236535329),i,a,n[h+1],5,-165796510),a=g(a,c,f,i,n[h+6],9,-1069501632),i=g(i,a,c,f,n[h+11],14,643717713),f=g(f,i,a,c,n[h],20,-373897302),c=g(c,f,i,a,n[h+5],5,-701558691),a=g(a,c,f,i,n[h+10],9,38016083),i=g(i,a,c,f,n[h+15],14,-660478335),f=g(f,i,a,c,n[h+4],20,-405537848),c=g(c,f,i,a,n[h+9],5,568446438),a=g(a,c,f,i,n[h+14],9,-1019803690),i=g(i,a,c,f,n[h+3],14,-187363961),f=g(f,i,a,c,n[h+8],20,1163531501),c=g(c,f,i,a,n[h+13],5,-1444681467),a=g(a,c,f,i,n[h+2],9,-51403784),i=g(i,a,c,f,n[h+7],14,1735328473),c=v(c,f=g(f,i,a,c,n[h+12],20,-1926607734),i,a,n[h+5],4,-378558),a=v(a,c,f,i,n[h+8],11,-2022574463),i=v(i,a,c,f,n[h+11],16,1839030562),f=v(f,i,a,c,n[h+14],23,-35309556),c=v(c,f,i,a,n[h+1],4,-1530992060),a=v(a,c,f,i,n[h+4],11,1272893353),i=v(i,a,c,f,n[h+7],16,-155497632),f=v(f,i,a,c,n[h+10],23,-1094730640),c=v(c,f,i,a,n[h+13],4,681279174),a=v(a,c,f,i,n[h],11,-358537222),i=v(i,a,c,f,n[h+3],16,-722521979),f=v(f,i,a,c,n[h+6],23,76029189),c=v(c,f,i,a,n[h+9],4,-640364487),a=v(a,c,f,i,n[h+12],11,-421815835),i=v(i,a,c,f,n[h+15],16,530742520),c=m(c,f=v(f,i,a,c,n[h+2],23,-995338651),i,a,n[h],6,-198630844),a=m(a,c,f,i,n[h+7],10,1126891415),i=m(i,a,c,f,n[h+14],15,-1416354905),f=m(f,i,a,c,n[h+5],21,-57434055),c=m(c,f,i,a,n[h+12],6,1700485571),a=m(a,c,f,i,n[h+3],10,-1894986606),i=m(i,a,c,f,n[h+10],15,-1051523),f=m(f,i,a,c,n[h+1],21,-2054922799),c=m(c,f,i,a,n[h+8],6,1873313359),a=m(a,c,f,i,n[h+15],10,-30611744),i=m(i,a,c,f,n[h+6],15,-1560198380),f=m(f,i,a,c,n[h+13],21,1309151649),c=m(c,f,i,a,n[h+4],6,-145523070),a=m(a,c,f,i,n[h+11],10,-1120210379),i=m(i,a,c,f,n[h+2],15,718787259),f=m(f,i,a,c,n[h+9],21,-343485551),c=d(c,r),f=d(f,e),i=d(i,o),a=d(a,u);return[c,f,i,a]}function i(n){for(var t="",r=32*n.length,e=0;e<r;e+=8)t+=String.fromCharCode(n[e>>5]>>>e%32&255);return t}function a(n){var t=[];for(t[(n.length>>2)-1]=void 0,e=0;e<t.length;e+=1)t[e]=0;for(var r=8*n.length,e=0;e<r;e+=8)t[e>>5]|=(255&n.charCodeAt(e/8))<<e%32;return t}function e(n){for(var t,r="0123456789abcdef",e="",o=0;o<n.length;o+=1)t=n.charCodeAt(o),e+=r.charAt(t>>>4&15)+r.charAt(15&t);return e}function r(n){return unescape(encodeURIComponent(n))}function o(n){return i(c(a(n=r(n)),8*n.length))}function u(n,t){return function(n,t){var r,e=a(n),o=[],u=[];for(o[15]=u[15]=void 0,16<e.length&&(e=c(e,8*n.length)),r=0;r<16;r+=1)o[r]=909522486^e[r],u[r]=1549556828^e[r];return t=c(o.concat(a(t)),512+8*t.length),i(c(u.concat(t),640))}(r(n),r(t))}function t(n,t,r){return t?r?u(t,n):e(u(t,n)):r?o(n):e(o(n))}"function"==typeof define&&define.amd?define(function(){return t}):"object"==typeof module&&module.exports?module.exports=t:n.md5=t}(this);
//# sourceMappingURL=md5.min.js.map

View file

@ -1,5 +1,5 @@
import {palette} from "./palette.js";
let charts = [];
const keysToSort = [
"minecraft:killed_by",
"minecraft:broken",
@ -11,6 +11,38 @@ const keysToSort = [
"minecraft:mined",
];
let nrdkstats;
let ygolekstats;
let locale;
async function getJson(json) {
let a;
await fetch(`https://neroduck.ru/${json}`, {
method: "GET",
headers: { Accept: "application/json" },
})
.then((response) => {
return response.json();
})
.then((data) => {
a = data;
});
return a;
}
async function getJsons() {
await getJson("nrdk.json").then((a) => {
nrdkstats = a;
});
await getJson("ygolek.json").then((a) => {
ygolekstats = a;
});
await getJson("ru_edited.json").then((a) => {
locale = a;
});
}
async function parseStats(stats) {
let values = {
valuedropped: [],
@ -38,6 +70,7 @@ async function parseStats(stats) {
);
}
});
//parsing
keysToSort.forEach((key) => {
let statistic = stats["stats"][key];
@ -50,39 +83,18 @@ async function parseStats(stats) {
createPie(values["value" + keyy], values["datas" + keyy], keyy);
});
}
async function createPie(items, datas, idcanvas) {
async function getStats() {
const responsetranslate = await fetch("https://neroduck.ru/ru_edited.json", {
method: "GET",
headers: { Accept: "application/json" },
});
console.log(responsetranslate.ok);
// если запрос прошел нормально
if (responsetranslate.ok === true) {
// получаем данные
await charts.forEach((chart) => {
chart.destroy();
})
window.translatejson = await responsetranslate.json();
}
// отправляет запрос и получаем ответ
const response = await fetch("https://neroduck.ru/nrdk.json", {
method: "GET",
headers: { Accept: "application/json" },
});
// если запрос прошел нормально
if (response.ok === true) {
// получаем данные
const stats = await response.json();
await parseStats(stats);
}
}
function createPie(items, datas, idcanvas) {
let bgcol = palette("tol-rainbow", items.length);
for (let i = 0; i < bgcol.length; i++) {
bgcol[i] = "#" + bgcol[i];
}
bgcol = bgcol.reverse();
const data = {
labels: items,
datasets: [
@ -108,9 +120,50 @@ function createPie(items, datas, idcanvas) {
},
};
let canvas = document.getElementById(idcanvas);
let chart = new Chart(canvas, config);
charts.push(new Chart(canvas, config))
}
async function createBar() {
const data = {
labels: ["Смерти"],
datasets: [
{
label: "neroduckale",
data: [nrdkstats["stats"]["minecraft:custom"]["minecraft:deaths"]],
backgroundColor: "#34b8e9",
borderColor: "#ffffff",
hoverOffset: 6,
},
{
label: "ygolek",
data: [ygolekstats["stats"]["minecraft:custom"]["minecraft:deaths"]],
backgroundColor: "#e00000",
borderColor: "#ffffff",
hoverOffset: 6,
},
],
};
const config = {
type: "bar",
data: data,
options: {
plugins: {
legend: {
labels: {
color: "white",
},
},
},
},
};
let canvas = document.getElementById("sravn");
let chart = new Chart(canvas, config)
}
function translate(item, type) {
if (item.includes("minecraft:") === false) {
return item;
@ -119,43 +172,55 @@ function translate(item, type) {
switch (type) {
case "minecraft:killed_by":
r = window.translatejson["entity." + item];
r = locale["entity." + item];
return r;
case "minecraft:broken":
r = window.translatejson["item." + item]
r = locale["item." + item]
return r
case "minecraft:used":
r = window.translatejson["item." + item]
r = locale["item." + item]
if (r === undefined) {
r = window.translatejson["block." + item];
r = locale["block." + item];
}
return r
case "minecraft:killed":
r = window.translatejson["entity." + item]
r = locale["entity." + item]
return r
case "minecraft:dropped":
r = window.translatejson["item." + item];
r = locale["item." + item];
if (r === undefined) {
r = window.translatejson["block." + item];
r = locale["block." + item];
}
return r
case "minecraft:crafted":
r = window.translatejson["item." + item]
r = locale["item." + item]
if (r === undefined) {
r = window.translatejson["block." + item];
r = locale["block." + item];
}
return r
case "minecraft:picked_up":
r = window.translatejson["item." + item]
r = locale["item." + item]
if (r === undefined) {
r = window.translatejson["block." + item];
r = locale["block." + item];
}
return r
case "minecraft:mined":
r = window.translatejson["block." + item]
r = locale["block." + item]
return r
}
}
$('#ygolek').change(async function () {
await parseStats(ygolekstats);
return false;
});
getStats();
$('#nrdk').change(async function () {
await parseStats(nrdkstats);
return false;
});
await getJsons();
await parseStats(nrdkstats);
await createBar();