diff options
| author | 2023-11-06 02:05:14 +0800 | |
|---|---|---|
| committer | 2023-11-06 02:05:14 +0800 | |
| commit | 70c118d37cd784861bec712000d7014302591256 (patch) | |
| tree | c180ff4e252e65e8ec62c28fb6237d8801ca5d21 | |
| parent | 1fc06e39cf5d483921655a8e859b4e80a40d692b (diff) | |
| download | HydroRoll-70c118d37cd784861bec712000d7014302591256.tar.gz HydroRoll-70c118d37cd784861bec712000d7014302591256.zip | |
fix(site): 修复了错误的主题索引
chore(site): 删除了无用主题文件
25 files changed, 373 insertions, 57 deletions
@@ -3,10 +3,9 @@ [metadata] groups = ["default"] -cross_platform = true -static_urls = false -lock_version = "4.3" -content_hash = "sha256:8753400b358338c372c3e966112b07152f2b7cf55746e98ecaa86999a714f9aa" +strategy = ["cross_platform"] +lock_version = "4.4" +content_hash = "sha256:edbd8bc3476ca24ede5ba1f9e68c74854d97d70e60f579a77f6fb37ca1d9a99f" [[package]] name = "aiohttp" @@ -164,6 +163,16 @@ files = [ ] [[package]] +name = "certifi" +version = "2023.7.22" +requires_python = ">=3.6" +summary = "Python package for providing Mozilla's CA Bundle." +files = [ + {file = "certifi-2023.7.22-py3-none-any.whl", hash = "sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9"}, + {file = "certifi-2023.7.22.tar.gz", hash = "sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082"}, +] + +[[package]] name = "charset-normalizer" version = "3.3.0" requires_python = ">=3.7.0" @@ -666,6 +675,22 @@ files = [ ] [[package]] +name = "requests" +version = "2.31.0" +requires_python = ">=3.7" +summary = "Python HTTP for Humans." +dependencies = [ + "certifi>=2017.4.17", + "charset-normalizer<4,>=2", + "idna<4,>=2.5", + "urllib3<3,>=1.21.1", +] +files = [ + {file = "requests-2.31.0-py3-none-any.whl", hash = "sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f"}, + {file = "requests-2.31.0.tar.gz", hash = "sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1"}, +] + +[[package]] name = "scikit-learn" version = "1.3.1" requires_python = ">=3.8" @@ -807,6 +832,16 @@ files = [ ] [[package]] +name = "urllib3" +version = "2.0.7" +requires_python = ">=3.7" +summary = "HTTP library with thread-safe connection pooling, file post, and more." +files = [ + {file = "urllib3-2.0.7-py3-none-any.whl", hash = "sha256:fdb6d215c776278489906c2f8916e6e7d4f5a9b602ccbcfdf7f016fc8da0596e"}, + {file = "urllib3-2.0.7.tar.gz", hash = "sha256:c97dfde1f7bd43a71c8d2a58e369e9b2bf692d1334ea9f9cae55add7d0dd0f84"}, +] + +[[package]] name = "watchfiles" version = "0.20.0" requires_python = ">=3.7" diff --git a/pyproject.toml b/pyproject.toml index de8c164..b76ae5d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,6 +14,7 @@ dependencies = [ "randomgen>=1.26.0", "jieba>=0.42.1", "scikit-learn>=1.3.1", + "requests>=2.31.0", ] requires-python = ">=3.8" readme = "README.md" diff --git a/site/config.toml b/site/config.toml index 2d9eaf7..c828971 100644 --- a/site/config.toml +++ b/site/config.toml @@ -1,48 +1,18 @@ -baseURL = 'http://www.hydroroll.team/' -languageCode = 'en-us' +baseURL = 'http://hydroroll.team/' +languageCode = 'zh-cn' title = 'HydroRoll' -theme = 'graysx-hugo' +theme = 'coming-soon' -## Site Settings [params] -logo = "assets/img/logo.webp" -favicon = "assets/favicon.png" - -# Info -address = "123 Arch B1W, GNU/Linux" -email = "hello@graysx.com" -phone = "123456" - -# Socials - -twitter = "#" -facebook = "#" -github = "https://github.com/akatiggerx04/graysx-hugo" - -# Other - -# Startbootstrap Contact Form Token https://startbootstrap.com/solution/contact-forms -sbtoken = "TOKEN_HERE" - -## Menu Items -[menu] - [[menu.main]] - name = "About" - URL = "#about" - weight = 1 - - [[menu.main]] - name = "Projects" - URL = "#projects" - weight = 2 - - [[menu.main]] - name = "Contact" - URL = "#signup" - weight = 3 - - -# Credits - -# This theme is forked from: https://github.com/startbootstrap/startbootstrap-grayscale -# This theme is forked by: https://github.com/akatiggerx04
\ No newline at end of file + logo = "assets/img/logo.webp" + favicon = "assets/favicon.png" + title = "HydroRoll " + description = "倒数日" + message = "距离水系公测还有" # default is "COMING SOON" + release = "Jul 14, 2024" # release date format: Aug 30, 2023 15:00 + background = "" # default is bg.mp4 in static/ + +socialIcons = [ + {name = "email", url = "support@hydroroll.team"}, + {name = "github", url = "https://github.com/HydroRoll-Team"}, +]
\ No newline at end of file diff --git a/site/public/bg.mp4 b/site/public/bg.mp4 Binary files differnew file mode 100644 index 0000000..89df32b --- /dev/null +++ b/site/public/bg.mp4 diff --git a/site/public/categories/index.xml b/site/public/categories/index.xml new file mode 100644 index 0000000..6b906fb --- /dev/null +++ b/site/public/categories/index.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> + <channel> + <title>Categories on HydroRoll</title> + <link>http://hydroroll.team/categories/</link> + <description>Recent content in Categories on HydroRoll</description> + <generator>Hugo -- gohugo.io</generator> + <language>zh-cn</language><atom:link href="http://hydroroll.team/categories/index.xml" rel="self" type="application/rss+xml" /> + </channel> +</rss> diff --git a/site/public/css/styles.css b/site/public/css/styles.css new file mode 100644 index 0000000..3c52555 --- /dev/null +++ b/site/public/css/styles.css @@ -0,0 +1,101 @@ +* { +margin: 0; +padding: 0; +} + +.bgimg { +/* Full-screen */ +height: 100vh; /* Use viewport height for full-screen height */ +/* Center the background image */ +background-position: center; +/* Scale and zoom in the image */ +background-size: cover; +/* Add position: relative to enable absolutely positioned elements inside the image (place text) */ +position: relative; +/* Add a white text color to all elements inside the .bgimg container */ +color: white; +/* Add a font */ +font-family: "Courier New", Courier, monospace; +/* Set the font-size to 25 pixels */ +font-size: 25px; +} + +.bgimg video { +width: 100%; +height: 100%; /* Make the video fill the entire .bgimg container */ +object-fit: cover; /* Make the video cover the container without stretching */ +display: block; /* Remove any extra spacing */ +position: absolute; /* Position the video absolutely within the .bgimg container */ +} + + +/* Position text in the top-left corner */ +.topleft { +position: absolute; +top: 16px; +left: 16px; +} + +/* Position text in the bottom-left corner */ +.bottomleft { +position: absolute; +bottom: 16px; +left: 16px; +} + +/* Position text in the middle */ +.middle { +position: absolute; +top: 50%; +left: 50%; +transform: translate(-50%, -50%); +text-align: center; +} +#demo{ + font-size:30px; + padding: 10px; +} +@media screen AND (max-width:600px) { + .middle h1{ + font-size: 20px; + } + #demo{ + font-size: 20px; + } +} + +/* Style the <hr> element */ +hr { +margin: auto; +width: 40%; +} + +/* left side */ +.left{ + right: 0; + bottom: 10px; + position: absolute; +} +.social-icons { + text-align: center; + filter: brightness(0) invert(1); +} + +.social-icons .social-icons-list { + display: inline-block; + list-style-type: none; + padding: 0; + text-align: center; +} + +.social-icons-list .social-icon { + box-sizing: border-box; + display: inline-block; + height: 24px; + margin: 0 6px; + width: 24px; +} + +.social-icon a svg path { + transition: fill 0.15s ease; +}
\ No newline at end of file diff --git a/site/public/favicon.ico b/site/public/favicon.ico Binary files differnew file mode 100644 index 0000000..253be4b --- /dev/null +++ b/site/public/favicon.ico diff --git a/site/public/index.html b/site/public/index.html new file mode 100644 index 0000000..4c8e428 --- /dev/null +++ b/site/public/index.html @@ -0,0 +1,67 @@ +<!DOCTYPE html> +<html lang="en"><head> + <meta name="generator" content="Hugo 0.117.0"> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title>HydroRoll </title> + <link rel="canonical" href="http://hydroroll.team/"> + + <link rel="icon" type="image/x-icon" href="/assets/favicon.png"> + + <link rel="stylesheet" href="/css/styles.css"> +</head> + <div class="bgimg"> + <video autoplay muted loop poster="poster.jpg"> + + <source src="bg.mp4" type="video/mp4"> + + </video> + <div class="topleft"> + + <p>HydroRoll </p> + + </div> + <div class="middle"> + + <h1>距离水系公测还有</h1> + + <br /> + <hr> + <br/> + <h4></h4> + <p id="demo"></p> + <div id="countdown" data-release="Jul 14, 2024"></div> + </div> + <div class="bottomleft"> + <p> + 倒数日</p> + </div> + </div> + <div class="left"> + + <section class="social-icons"> + <ul class="social-icons-list"> + + <li class="social-icon"> + + <a href="mailto:support@hydroroll.team " + > + <img src="http://hydroroll.team//svg/icons/email.svg" alt="test" /> + </a> + </li> + + <li class="social-icon"> + + <a href="https://github.com/HydroRoll-Team" + > + <img src="http://hydroroll.team//svg/icons/github.svg" alt="test" /> + </a> + </li> + + </ul> + </section> + + </div> + <script src="/js/script.js"></script> + +</html>
\ No newline at end of file diff --git a/site/public/index.xml b/site/public/index.xml new file mode 100644 index 0000000..a759010 --- /dev/null +++ b/site/public/index.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> + <channel> + <title>HydroRoll</title> + <link>http://hydroroll.team/</link> + <description>Recent content on HydroRoll</description> + <generator>Hugo -- gohugo.io</generator> + <language>zh-cn</language><atom:link href="http://hydroroll.team/index.xml" rel="self" type="application/rss+xml" /> + </channel> +</rss> diff --git a/site/public/js/script.js b/site/public/js/script.js new file mode 100644 index 0000000..f41ff4b --- /dev/null +++ b/site/public/js/script.js @@ -0,0 +1,31 @@ +// Get the release date from the data attribute +var releaseDateStr = document.getElementById("countdown").getAttribute("data-release"); + +// Create a JavaScript Date object using the release date string +var countDownDate = new Date(releaseDateStr); + +// Update the count down every 1 second +var x = setInterval(function() { + + // Get todays date and time + var now = new Date().getTime(); + + // Find the distance between now an the count down date + var distance = countDownDate - now; + + // Time calculations for days, hours, minutes and seconds + var days = Math.floor(distance / (1000 * 60 * 60 * 24)); + var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); + var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); + var seconds = Math.floor((distance % (1000 * 60)) / 1000); + + // Display the result in an element with id="demo" + document.getElementById("demo").innerHTML = days + "天 " + hours + "小时 " + + minutes + "分 " + seconds + "秒 "; + + // If the count down is finished, write some text + if (distance < 0) { + clearInterval(x); + document.getElementById("demo").innerHTML = "EXPIRED"; + } +}, 1000);
\ No newline at end of file diff --git a/site/public/sitemap.xml b/site/public/sitemap.xml new file mode 100644 index 0000000..3122e32 --- /dev/null +++ b/site/public/sitemap.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" + xmlns:xhtml="http://www.w3.org/1999/xhtml"> + <url> + <loc>http://hydroroll.team/categories/</loc> + </url><url> + <loc>http://hydroroll.team/</loc> + </url><url> + <loc>http://hydroroll.team/tags/</loc> + </url> +</urlset> diff --git a/site/public/svg/icons/email.svg b/site/public/svg/icons/email.svg new file mode 100644 index 0000000..3811b59 --- /dev/null +++ b/site/public/svg/icons/email.svg @@ -0,0 +1 @@ +<svg viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg"><path d="M 0,27.283 V 24 a 8,8 0 0 1 8,-8 h 112 a 8,8 0 0 1 8,8 v 3.283 l -64,40 z m 66.12,48.11 a 4.004,4.004 0 0 1 -4.24,0 L 0,36.717 V 104 a 8,8 0 0 0 8,8 h 112 a 8,8 0 0 0 8,-8 V 36.717 Z" data-name="Layer 2"/></svg>
\ No newline at end of file diff --git a/site/public/svg/icons/facebook.svg b/site/public/svg/icons/facebook.svg new file mode 100644 index 0000000..4ef9d67 --- /dev/null +++ b/site/public/svg/icons/facebook.svg @@ -0,0 +1 @@ +<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Facebook</title><path d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"/></svg>
\ No newline at end of file diff --git a/site/public/svg/icons/github.svg b/site/public/svg/icons/github.svg new file mode 100644 index 0000000..538ec5b --- /dev/null +++ b/site/public/svg/icons/github.svg @@ -0,0 +1 @@ +<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg>
\ No newline at end of file diff --git a/site/public/svg/icons/instagram.svg b/site/public/svg/icons/instagram.svg new file mode 100644 index 0000000..5a68721 --- /dev/null +++ b/site/public/svg/icons/instagram.svg @@ -0,0 +1 @@ +<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Instagram</title><path d="M12 0C8.74 0 8.333.015 7.053.072 5.775.132 4.905.333 4.14.63c-.789.306-1.459.717-2.126 1.384S.935 3.35.63 4.14C.333 4.905.131 5.775.072 7.053.012 8.333 0 8.74 0 12s.015 3.667.072 4.947c.06 1.277.261 2.148.558 2.913.306.788.717 1.459 1.384 2.126.667.666 1.336 1.079 2.126 1.384.766.296 1.636.499 2.913.558C8.333 23.988 8.74 24 12 24s3.667-.015 4.947-.072c1.277-.06 2.148-.262 2.913-.558.788-.306 1.459-.718 2.126-1.384.666-.667 1.079-1.335 1.384-2.126.296-.765.499-1.636.558-2.913.06-1.28.072-1.687.072-4.947s-.015-3.667-.072-4.947c-.06-1.277-.262-2.149-.558-2.913-.306-.789-.718-1.459-1.384-2.126C21.319 1.347 20.651.935 19.86.63c-.765-.297-1.636-.499-2.913-.558C15.667.012 15.26 0 12 0zm0 2.16c3.203 0 3.585.016 4.85.071 1.17.055 1.805.249 2.227.415.562.217.96.477 1.382.896.419.42.679.819.896 1.381.164.422.36 1.057.413 2.227.057 1.266.07 1.646.07 4.85s-.015 3.585-.074 4.85c-.061 1.17-.256 1.805-.421 2.227-.224.562-.479.96-.899 1.382-.419.419-.824.679-1.38.896-.42.164-1.065.36-2.235.413-1.274.057-1.649.07-4.859.07-3.211 0-3.586-.015-4.859-.074-1.171-.061-1.816-.256-2.236-.421-.569-.224-.96-.479-1.379-.899-.421-.419-.69-.824-.9-1.38-.165-.42-.359-1.065-.42-2.235-.045-1.26-.061-1.649-.061-4.844 0-3.196.016-3.586.061-4.861.061-1.17.255-1.814.42-2.234.21-.57.479-.96.9-1.381.419-.419.81-.689 1.379-.898.42-.166 1.051-.361 2.221-.421 1.275-.045 1.65-.06 4.859-.06l.045.03zm0 3.678c-3.405 0-6.162 2.76-6.162 6.162 0 3.405 2.76 6.162 6.162 6.162 3.405 0 6.162-2.76 6.162-6.162 0-3.405-2.76-6.162-6.162-6.162zM12 16c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4zm7.846-10.405c0 .795-.646 1.44-1.44 1.44-.795 0-1.44-.646-1.44-1.44 0-.794.646-1.439 1.44-1.439.793-.001 1.44.645 1.44 1.439z"/></svg>
\ No newline at end of file diff --git a/site/public/svg/icons/tiktok.svg b/site/public/svg/icons/tiktok.svg new file mode 100644 index 0000000..57ce3ae --- /dev/null +++ b/site/public/svg/icons/tiktok.svg @@ -0,0 +1 @@ +<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>TikTok</title><path d="M12.525.02c1.31-.02 2.61-.01 3.91-.02.08 1.53.63 3.09 1.75 4.17 1.12 1.11 2.7 1.62 4.24 1.79v4.03c-1.44-.05-2.89-.35-4.2-.97-.57-.26-1.1-.59-1.62-.93-.01 2.92.01 5.84-.02 8.75-.08 1.4-.54 2.79-1.35 3.94-1.31 1.92-3.58 3.17-5.91 3.21-1.43.08-2.86-.31-4.08-1.03-2.02-1.19-3.44-3.37-3.65-5.71-.02-.5-.03-1-.01-1.49.18-1.9 1.12-3.72 2.58-4.96 1.66-1.44 3.98-2.13 6.15-1.72.02 1.48-.04 2.96-.04 4.44-.99-.32-2.15-.23-3.02.37-.63.41-1.11 1.04-1.36 1.75-.21.51-.15 1.07-.14 1.61.24 1.64 1.82 3.02 3.5 2.87 1.12-.01 2.19-.66 2.77-1.61.19-.33.4-.67.41-1.06.1-1.79.06-3.57.07-5.36.01-4.03-.01-8.05.02-12.07z"/></svg>
\ No newline at end of file diff --git a/site/public/svg/icons/twitter.svg b/site/public/svg/icons/twitter.svg new file mode 100644 index 0000000..45bd20c --- /dev/null +++ b/site/public/svg/icons/twitter.svg @@ -0,0 +1 @@ +<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Twitter</title><path d="M23.953 4.57a10 10 0 01-2.825.775 4.958 4.958 0 002.163-2.723c-.951.555-2.005.959-3.127 1.184a4.92 4.92 0 00-8.384 4.482C7.69 8.095 4.067 6.13 1.64 3.162a4.822 4.822 0 00-.666 2.475c0 1.71.87 3.213 2.188 4.096a4.904 4.904 0 01-2.228-.616v.06a4.923 4.923 0 003.946 4.827 4.996 4.996 0 01-2.212.085 4.936 4.936 0 004.604 3.417 9.867 9.867 0 01-6.102 2.105c-.39 0-.779-.023-1.17-.067a13.995 13.995 0 007.557 2.209c9.053 0 13.998-7.496 13.998-13.985 0-.21 0-.42-.015-.63A9.935 9.935 0 0024 4.59z"/></svg>
\ No newline at end of file diff --git a/site/public/tags/index.xml b/site/public/tags/index.xml new file mode 100644 index 0000000..7664def --- /dev/null +++ b/site/public/tags/index.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> + <channel> + <title>Tags on HydroRoll</title> + <link>http://hydroroll.team/tags/</link> + <description>Recent content in Tags on HydroRoll</description> + <generator>Hugo -- gohugo.io</generator> + <language>zh-cn</language><atom:link href="http://hydroroll.team/tags/index.xml" rel="self" type="application/rss+xml" /> + </channel> +</rss> diff --git a/site/themes/coming-soon/static/js/script.js b/site/themes/coming-soon/static/js/script.js index 9d06633..f41ff4b 100644 --- a/site/themes/coming-soon/static/js/script.js +++ b/site/themes/coming-soon/static/js/script.js @@ -20,8 +20,8 @@ var x = setInterval(function() { var seconds = Math.floor((distance % (1000 * 60)) / 1000); // Display the result in an element with id="demo" - document.getElementById("demo").innerHTML = days + "d " + hours + "h " - + minutes + "m " + seconds + "s "; + document.getElementById("demo").innerHTML = days + "天 " + hours + "小时 " + + minutes + "分 " + seconds + "秒 "; // If the count down is finished, write some text if (distance < 0) { diff --git a/site/themes/graysx-hugo b/site/themes/graysx-hugo deleted file mode 160000 -Subproject fe35dd8b38c7e84d59981cb5670ec0a118e1723 diff --git a/tests/HydroRoll/data/censor.json b/tests/HydroRoll/data/censor.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/tests/HydroRoll/data/censor.json @@ -0,0 +1 @@ +{}
\ No newline at end of file diff --git a/tests/plugins/HydroRoll/__init__.py b/tests/plugins/HydroRoll/__init__.py index 2f883a8..7c05d4e 100644 --- a/tests/plugins/HydroRoll/__init__.py +++ b/tests/plugins/HydroRoll/__init__.py @@ -1,4 +1,5 @@ """中间件""" +import json import joblib import os import shutil @@ -8,9 +9,11 @@ from iamai import ConfigModel, Plugin from iamai.log import logger from .config import Directory, GlobalConfig, Models from .utils import * +from .models.Transformer import query BASE_DIR = dirname(abspath("__file__")) HYDRO_DIR = dirname(abspath(__file__)) +APP_DIR = join(BASE_DIR, "HydroRoll") # logger.info(GlobalConfig._copyright) @@ -46,9 +49,49 @@ class HydroRoll(Plugin): if self.event.message.get_plain_text() == ".core": await self.event.reply("HydroRollCore is running.") + if self.event.message.startswith(".set"): + arg_list: list = self.event.message.get_plain_text().split() + sub_cmd: str = arg_list[1] + if sub_cmd == ("censor"): + operator: str = arg_list[2] + censor_list: list = arg_list[3:] + pattern = re.compile(r"[+-](\d?=?)(.*)") + + try: + with open( + join(APP_DIR, "data", "censor.json"), "r+", encoding="utf8" + ) as f: + censor_content = json.load(f) + except (FileNotFoundError, json.JSONDecodeError): + censor_content = {} + + censor_list = list(filter(lambda x: pattern.match(x), censor_list)) + + with open( + join(APP_DIR, "data", "censor.json"), "w+", encoding="utf8" + ) as f: + if operator in ["add", "+"]: + for item in censor_list: + match = pattern.match(item) + censor_content[match.group(2)] = int( + match.group(1).replace("=", "") + ) + elif operator in ["remove", "rmv", "-"]: + for item in censor_list: + match = pattern.match(item) + keyword = match.group(2) + if keyword in censor_content: + del censor_content[keyword] + elif operator in ["list", "map"]: + pass # do something else + + json.dump(censor_content, f, ensure_ascii=False, indent=4) + elif self.event.message.startswith(".get"): + ... + elif self.event.message.startswith(".test"): try: - result = literal_eval(self.event.message.get_plain_text()[5:]) + result = eval(self.event.message.get_plain_text()[5:]) #literal_eval(self.event.message.get_plain_text()[5:]) await self.event.reply(str(result)) except Exception as error: await self.event.reply(f"{error!r}") @@ -107,3 +150,5 @@ class HydroRoll(Plugin): def load_models(self): self.models = self._load_models(self.model_path_list, self.model_dict) + + diff --git a/tests/plugins/HydroRoll/config.py b/tests/plugins/HydroRoll/config.py index daab4d3..194a956 100644 --- a/tests/plugins/HydroRoll/config.py +++ b/tests/plugins/HydroRoll/config.py @@ -2,6 +2,7 @@ from randomgen import AESCounter from numpy.random import Generator import argparse import sys +from os.path import dirname, dirname, join, abspath import platform from importlib.metadata import version import os @@ -57,6 +58,8 @@ class GlobalConfig(CommandPluginConfig): _iamai_version = version("iamai") _python_ver = sys.version _python_ver_raw = ".".join(map(str, platform.python_version_tuple()[:3])) + _base_dir = dirname(abspath("__file__")) + _hydro_dir = dirname(abspath(__file__)) _copyright = f"""\033[36m _ __ _ _ /\ /\_ _ __| |_ __ ___ /__\ ___ | | | @@ -130,7 +133,8 @@ class FileManager(object): def get_file_list(self, _dir: str): return { - 'web;frontend': 'index.html' + 'web;frontend': 'index.html', + 'data': 'censor.json', } diff --git a/tests/plugins/HydroRoll/models/Transformer.py b/tests/plugins/HydroRoll/models/Transformer.py new file mode 100644 index 0000000..b52422e --- /dev/null +++ b/tests/plugins/HydroRoll/models/Transformer.py @@ -0,0 +1,9 @@ +import requests + +API_URL = "https://api-inference.huggingface.co/models/sentence-transformers/all-MiniLM-L6-v2" +headers = {"Authorization": "Bearer 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"} + +def query(payload): + response = requests.post(API_URL, headers=headers, json=payload) + return response.json() + diff --git a/tests/plugins/HydroRoll/utils.py b/tests/plugins/HydroRoll/utils.py index f871523..1f5e8bc 100644 --- a/tests/plugins/HydroRoll/utils.py +++ b/tests/plugins/HydroRoll/utils.py @@ -12,8 +12,7 @@ from .config import BasePluginConfig, RegexPluginConfig, CommandPluginConfig T_Config = TypeVar("T_Config", bound=BasePluginConfig) T_RegexPluginConfig = TypeVar("T_RegexPluginConfig", bound=RegexPluginConfig) -T_CommandPluginConfig = TypeVar( - "T_CommandPluginConfig", bound=CommandPluginConfig) +T_CommandPluginConfig = TypeVar("T_CommandPluginConfig", bound=CommandPluginConfig) class BasePlugin( @@ -170,10 +169,16 @@ def find_max_similarity(input_string, string_list): max_string = "" for string in string_list: - similarity = difflib.SequenceMatcher( - None, input_string, string).quick_ratio() + similarity = difflib.SequenceMatcher(None, input_string, string).quick_ratio() if similarity > max_similarity: max_similarity = similarity max_string = string return max_string, max_similarity + + +def check_file(filename: str) -> bool: + """根据给定参数校验文件夹内文件完整性""" + + + return False
\ No newline at end of file |
