Skip to content
This repository has been archived by the owner on Aug 28, 2023. It is now read-only.

Commit

Permalink
b20200617.1
Browse files Browse the repository at this point in the history
  • Loading branch information
lslqtz committed Jun 16, 2020
1 parent 7a0eb8d commit f7148ed
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 34 deletions.
8 changes: 4 additions & 4 deletions Server/check.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php
if (PHP_SAPI !== 'cli') { die(); }
chdir(__DIR__);
require_once('config.php');
set_time_limit(0);
ini_set('default_socket_timeout', 30);
Expand Down Expand Up @@ -61,15 +60,16 @@ function reportWarning($str) {
echoWithDate("Saved: {$filePath}");
}
}
if ($isChanged) {
$checkFile="requested-{$stream}";
$checkFile=cacheDir."/requested-{$stream}";
$isNotFound=!file_exists($checkFile);
if ($isChanged || $isNotFound) {
file_put_contents($checkFile, '1');
$fileTime=filectime($checkFile);
if (!is_dir(cacheDir.'/'.$fileTime)) {
mkdir(cacheDir.'/'.$fileTime);
}
file_put_contents(cacheDir.'/'.$fileTime."/{$stream}.json", $str);
echoWithDate("Checked: {$stream}");
echoWithDate(!$isNotFound ? "Checked: {$stream}" : "Fixed: {$stream}");
}
sleep(10);
}
Expand Down
1 change: 0 additions & 1 deletion Server/check2.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php
if (PHP_SAPI !== 'cli') { die(); }
chdir(__DIR__);
require_once('config.php');
set_time_limit(0);
ini_set('default_socket_timeout', 30);
Expand Down
7 changes: 7 additions & 0 deletions Server/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
chdir(__DIR__);
define('streamList', array('Stable','Stable40','Beta40','CuttingEdge'));
define('saveDir', 'osu!');
define('cacheDir', '../cache');
define('clientMinVersion', 20200616.1);
?>
27 changes: 27 additions & 0 deletions Server/osu-stream.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
require_once('config.php');
header('content-type:text/plain;charset=utf-8');
$stream='Stable40';
if (isset($_GET['v'])) {
if (isset($_SERVER['HTTP_USER_AGENT']) && trim(explode('/',$_SERVER['HTTP_USER_AGENT'],1)) >= clientMinVersion) {
header('HTTP/1.1 503 Service Unavailable');
die('客户端版本太老!请前往 https://github.com/osupink/osu-download/releases/ 下载新版本。');
}
}
if (isset($_GET['s'])) {
if (in_array($_GET['s'], streamList)) {
$stream=$_GET['s'];
}
}
$checkFile=cacheDir."/requested-{$stream}";
$jsonFile=cacheDir.'/'.filectime($checkFile)."/{$stream}.json";
if (!file_exists($checkFile) || !file_exists($jsonFile)) {
header('HTTP/1.1 503 Service Unavailable');
die('服务器暂无任何缓存,请稍后来看看吧~');
}
$str=file_get_contents($jsonFile);
$json=json_decode($str);
foreach ($json as $value) {
echo "File:{$value->file_hash}/{$value->filename}\n";
}
?>
19 changes: 1 addition & 18 deletions Server/osu-update.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php
require_once('config.php');
header('content-type:text/plain;charset=utf-8');
$stream='Stable40';
$officialMirrorHiddenFlag=1;
$officialNoticeList=array('[广告] BanYou 是国内领先的 osu! 第三方服务器,我们只针对长期玩家提供服务,注册十分简单,不仅可以单独游玩,还能邀请好友进行多人游戏,并且拥有独立的排名。立即加入我们的玩家群,群号:686469603');
$mirrorList=array(
Expand All @@ -15,7 +14,7 @@
die($mirrorList[0]);
}
if (isset($_GET['v'])) {
if (isset($_SERVER['HTTP_USER_AGENT']) && trim(explode('/',$_SERVER['HTTP_USER_AGENT'],1)) >= clientMinVersion)) {
if (isset($_SERVER['HTTP_USER_AGENT']) && trim(explode('/',$_SERVER['HTTP_USER_AGENT'],1)) >= clientMinVersion) {
header('HTTP/1.1 503 Service Unavailable');
die('客户端版本太老!请前往 https://github.com/osupink/osu-download/releases/ 下载新版本。');
}
Expand All @@ -37,21 +36,5 @@
}
echo "Mirror:{$value}\n";
}
die();
}
if (isset($_GET['s'])) {
if (in_array($_GET['s'], streamList)) {
$stream=$_GET['s'];
}
}
$checkFile="requested-{$stream}";
if (!file_exists($checkFile)) {
header('HTTP/1.1 503 Service Unavailable');
die('服务器暂无任何缓存,请稍后来看看吧~');
}
$str=file_get_contents(cacheDir.'/'.filectime($checkFile)."/{$stream}.json");
$json=json_decode($str);
foreach ($json as $value) {
echo "File:{$value->file_hash}/{$value->filename}\n";
}
?>
21 changes: 10 additions & 11 deletions osu-download/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class Program
{
static string Author = "asd";
static string ProgramTitle = "osu! 镜像下载客户端";
static string ServerURL = "https://mirror.osu.pink/osu-update2.php";
static string CurDLClientVer = "b20200616.1";
static string ServerURL = "https://mirror.osu.pink/osu-update.php";
static string CurDLClientVer = "b20200617.1";
static string GetFileHash(string FilePath)
{
MD5CryptoServiceProvider hc = new MD5CryptoServiceProvider();
Expand Down Expand Up @@ -54,13 +54,12 @@ static void WriteMirror(byte count, string MirrorName, short MirrorPingDelay, st
{
MirrorText += " " + string.Format("[{0}]", MirrorAD);
}
Console.ForegroundColor = ConsoleColor.Green;
if (!MirrorHashCheck)
{
Console.ForegroundColor = ConsoleColor.Yellow;
MirrorText += " 警告:这个 Mirror 不具备防篡改和完整性校验功能";
}
Console.ForegroundColor = MirrorHashCheck ? ConsoleColor.Green : ConsoleColor.Yellow;
Console.WriteLine(MirrorText);
if (!MirrorHashCheck)
{
Console.WriteLine("警告:上面的黄色 Mirror 不具备防篡改和完整性校验功能");
}
Console.ResetColor();
}
static void AddMirrorSplitWithoutConflict(ref SortedDictionary<short, List<string[]>> MirrorDictionary, short MirrorPing, string[] MirrorSplit)
Expand Down Expand Up @@ -253,23 +252,23 @@ static void Main(string[] args)
}
string CurMirror = null;
byte CurMirrorHashCheck = 0;
if (OfficialMirror != null && SelectedMirror == 1)
if (OfficialMirror != null && OfficialMirrorHiddenFlag == 2 && SelectedMirror == 1)
{
CurMirror = OfficialMirrorURL;
CurMirrorHashCheck = (byte)(OfficialMirrorHashCheck == true ? 1 : 0);
}
else
{
SelectedMirror--;
if (OfficialMirror != null)
if (OfficialMirror != null && OfficialMirrorHiddenFlag == 2)
{
SelectedMirror--;
}
CurMirror = MirrorList[SelectedMirror];
CurMirrorHashCheck = MirrorCheckList[SelectedMirror];
}
Console.WriteLine("正在检查选定的分支...");
HttpWebRequest CheckRequest = SendRequest((CurMirrorHashCheck == 2 ? CurMirror : OfficialMirrorURL) + string.Format("?s={0}", Version));
HttpWebRequest CheckRequest = SendRequest((CurMirrorHashCheck == 2 ? CurMirror : OfficialMirrorURL) + string.Format("osu-stream.php?s={0}", Version));
CheckRequest.Timeout = 10000;
HttpWebResponse CheckWebResponse = CheckRequest.GetResponse() as HttpWebResponse;
string CheckResponse = new StreamReader(CheckWebResponse.GetResponseStream(), Encoding.UTF8).ReadToEnd();
Expand Down

0 comments on commit f7148ed

Please sign in to comment.