Initial commit

This commit is contained in:
xiahe93 2025-02-24 12:07:54 +08:00
commit 4e80077405
9608 changed files with 3007841 additions and 0 deletions

18
.editorconfig Normal file
View File

@ -0,0 +1,18 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2
[docker-compose.yml]
indent_size = 4

78
.env Normal file
View File

@ -0,0 +1,78 @@
freenode_keep_day = 365
article_list_lenth = 10
article_img_count = 7
freenode_speed_min = 7
freenode_speed_max = 27
freenode_count_min = 10
freenode_count_max = 50
k = q
manager_ip = 104.234.60.231
APP_NAME=clashfreenode
APP_ENV=local
APP_KEY=base64:pboCUmKSUHIPvRgkPZhs37Vlk/x8kPUD9EtqfKdPaqQ=
APP_DEBUG=true
APP_TIMEZONE=Asia/Shanghai
APP_URL=https://clashfreenode.com
APP_WWW=clashfreenode.com
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database
PHP_CLI_SERVER_WORKERS=4
BCRYPT_ROUNDS=12
LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=mariadb
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=clashfreenodecom
DB_USERNAME=hotdog
DB_PASSWORD=hotshotgg
SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
CACHE_STORE=database
CACHE_PREFIX=
MEMCACHED_HOST=127.0.0.1
REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=log
MAIL_SCHEME=null
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
VITE_APP_NAME="${APP_NAME}"

66
.env.example Normal file
View File

@ -0,0 +1,66 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_TIMEZONE=UTC
APP_URL=http://localhost
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database
PHP_CLI_SERVER_WORKERS=4
BCRYPT_ROUNDS=12
LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=sqlite
# DB_HOST=127.0.0.1
# DB_PORT=3306
# DB_DATABASE=laravel
# DB_USERNAME=root
# DB_PASSWORD=
SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
CACHE_STORE=database
CACHE_PREFIX=
MEMCACHED_HOST=127.0.0.1
REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=log
MAIL_SCHEME=null
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
VITE_APP_NAME="${APP_NAME}"

1
README.md Executable file
View File

@ -0,0 +1 @@

BIN
app/.DS_Store vendored Executable file

Binary file not shown.

BIN
app/Http/.DS_Store vendored Executable file

Binary file not shown.

View File

@ -0,0 +1,12 @@
<?php
namespace App\Http\Controllers\Article;
abstract class Controller
{
public function __construct()
{
// $this->sAppName = env('APP_NAME');
// $this->sAppURL = 1;
}
}

View File

@ -0,0 +1,139 @@
<?php
namespace App\Http\Controllers\Article;
use Illuminate\Http\Request;
use App\Models\ArticleList;
use App\Models\Tags;
use App\Services\Time;
use voku\helper\AntiXSS;
use Illuminate\Routing\Controller;
class ListController extends Controller
{
public function __construct()
{
$sSearch = request('search');
if ($sSearch) {
$this->middleware('throttle:3,1')->only('mix');
} else {
// $this->middleware('throttle:15,1');
}
}
public function client($sType = false)
{
$r = $this->view('client', $sType);
return $r;
}
public function fn()
{
$r = $this->view('freenode');
return $r;
}
public function mix()
{
$r = $this->view('mix');
return $r;
}
public function view($sType = false, $sTypeSub = false)
{
$oAntiXss = new AntiXSS();
$sType = $oAntiXss->xss_clean($sType);
$sTypeSub = $oAntiXss->xss_clean($sTypeSub);
$iPageNo = $oAntiXss->xss_clean(request('pageNo'));
$bIsAjax = $oAntiXss->xss_clean(request('isAjax'));
$iTagId = $oAntiXss->xss_clean(request('tag'));
$sSearch = $oAntiXss->xss_clean(request('search'));
$iPageNo = $iPageNo ? $iPageNo : 1;
$bIsAjax = $bIsAjax ? $bIsAjax : false;
$iTagId = $iTagId ? $iTagId : 0;
$iLimit = 10;
$iStart = $iLimit * $iPageNo - $iLimit;
$oQuery = ArticleList::query();
$sMenu = "main";
if (!$sSearch && !$iTagId) {
if ($sType == 'client') {
$sMenu = "client";
if ($sTypeSub) {
$oQuery->where("type", $sTypeSub);
} else {
$oQuery->whereIn("type", ['ios','mac','win','linux','android']);
}
} else if ($sType == "freenode") {
$sMenu = "freenode";
$oQuery->where("type", "=", "node");
}
}
if ($iTagId) {
$oQuery->where('tags', 'like', '%['.$iTagId.']%');
}
if ($sSearch) {
$oQuery->where('title', 'like', '%'.$sSearch.'%');
}
// dd($oQuery->toSql(), $oQuery->getBindings());
$aArticleList = $oQuery->orderBy('code', 'desc')->skip($iStart)->take($iLimit)->get()->toArray();
foreach ($aArticleList as &$row) {
$sTimeLost = Time::Lost(time(), strtotime($row['created_at']));
$row['time_lost'] = $sTimeLost;
$row['created_at'] = date('n月j日', strtotime($row['created_at']));
if ($row['type'] == 'node') {
$row['typeStr'] = '免费节点';
$row['pathBase'] = '/fn/';
} else if (in_array($row['type'], ['ios','mac','win','linux','android'])) {
$row['typeStr'] = $row['type'].'客户端';
$row['pathBase'] = '/client/';
}
}
$aTagMap = Tags::all()->toArray();
if ($bIsAjax) {
echo json_encode($aArticleList);exit;
} else {
// 第二页之后是ajax
if ($iPageNo > 1) {
$sViewPath = "article/listAjax";
} else {
$sViewPath = 'article/list';
}
return view($sViewPath, [
'sAppName' => env('APP_NAME'),
'aList' => $aArticleList,
'aTag' => @$aTagMap[$iTagId-1],
'search' => $sSearch,
'sMenu' => $sMenu,
'sType' => $sType,
'sTypeSub' => $sTypeSub,
]);
}
}
}

View File

@ -0,0 +1,93 @@
<?php
namespace App\Http\Controllers\Article;
use Illuminate\Http\Request;
use App\Models\ArticleList;
use App\Services\Time;
use App\Services\Tag;
use voku\helper\AntiXSS;
class SingleController extends Controller
{
protected $sType = '';
protected $sCode = '';
protected $aData = [];
protected $sViewPath = 'article/single';
public function __construct()
{
$this->oAntiXss = new AntiXSS();
}
protected function view()
{
$this->aData['sType'] = $this->sType;
$this->aData['aTagNames'] = Tag::strToNames($this->aData['tags']);
return view($this->sViewPath, [
"aData" => $this->aData,
"sMenu" => $this->aData['sMenu'],
]);
}
public function client ($iCode)
{
$this->code = $this->oAntiXss->xss_clean($iCode);
$this->aData = ArticleList::where("code", "=", $iCode)->first()->toArray();
$this->sType = 'client';
$this->aData['sTypeName'] = '客户端';
$this->aData['pathBase'] = '/client/';
$this->aData['urlParent'] = '/client';
$this->aData['sMenu'] = 'client';
$this->aData['pageTitle'] = $this->aData["title"];
$this->aData['pageKw'] = "Clash,Quantumult,Shadowrocket,SSR,v2ray,免费节点,节点,订阅链接";
return $this->view();
}
public function freenode ($iCode)
{
$this->code = $this->oAntiXss->xss_clean($iCode);
$this->aData = ArticleList::where("code", "=", $iCode)->first()->toArray();
$this->sType = 'freenode';
$this->aData['sTypeName'] = '免费节点';
$this->aData['pathBase'] = '/fn/';
$this->aData['urlParent'] = '/';
$this->aData['sMenu'] = 'freenode';
$this->aData['pageTitle'] = '「'.$this->aData['date_str'].'」'.$this->aData["title"];
$this->aData['pageKw'] = "Clash,Quantumult,Shadowrocket,SSR,v2ray,免费节点,节点,订阅链接";
$this->aData['v2rayPath'] = env('APP_URL')."/feed/v2ray-".$iCode.".txt";
$this->aData['clashPath'] = env('APP_URL')."/feed/clash-".$iCode.".yaml";
$this->sViewPath = 'freenode/single';
return $this->view();
}
}

View File

@ -0,0 +1,37 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\ArticleList;
use App\Services\Time;
use voku\helper\AntiXSS;
use App\Models\Tags;
class ClientController extends Controller
{
public function singe($iCode)
{
$oAntiXss = new AntiXSS();
$iCode = $oAntiXss->xss_clean($iCode);
$aSinge = ArticleList::where("code", "=", $iCode)->first()->toArray();
$sTagsStr = $aSinge['tags'];
$sTagsStr = substr($sTagsStr, 1, -1);
$aTagsId = explode('][', $sTagsStr);
$aTagsMap = Tags::all()->toArray();
foreach ($aTagsId as $aTagsIdRow) {
$aTagsName[] = $aTagsMap[$aTagsIdRow-1];
}
return view("client/singe", [
"aSinge" => $aSinge,
'aTagNames' => $aTagsName,
'sMenu' => 'client',
]);
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace App\Http\Controllers;
abstract class Controller
{
public function __construct()
{
// $this->sAppName = env('APP_NAME');
// $this->sAppURL = 1;
}
}

View File

@ -0,0 +1,518 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\ArticleList;
use App\Models\Tags;
use App\Services\Time;
class ExecController extends Controller
{
public function __construct(Request $request)
{
$sIpAddress = $request->ip();
if ($sIpAddress != $_SERVER['SERVER_ADDR']) {
echo 'only local';
exit;
}
}
// cron n合1
// 半小时一次 @cron
public function cron ()
{
$this->FreenodeDelAuto();
// 期望每天一次
if (rand(1, 48) == 1) {
$this->tagCountToHtml();
}
// 期望每小时一次
if (rand(1, 2) == 1) {
$this->likeAuto();
}
$this->freenodeUp();
}
// 客户端文章静态化
public function clientSingleToHtml()
{
$sUrlBase = env('APP_URL').'/client/single/';
$sHtmlPathBase = "client/";
$aArticleCode = [
'1001',
'1002',
'1003',
'1004',
'1005',
'1006',
'1007',
'1008',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
foreach ($aArticleCode as $iCode) {
$sUrl = $sUrlBase.$iCode;
$sHtmlPath = $sHtmlPathBase.$iCode.'.html';
curl_setopt($ch, CURLOPT_URL, $sUrl);
$sArticleView = curl_exec($ch);
$r = file_put_contents($sHtmlPath, $sArticleView);
echo $r;
echo "<br>";
}
curl_close($ch);
}
// 热门标签,计数,静态化 @cron
public function tagCountToHtml()
{
echo "\n#start# top tag to html \n";
$aTags = Tags::all()->toArray();
foreach ($aTags as $k => $v) {
$sTagLike = '%['.$v['id'].']%';
$iTagCount = ArticleList::where('tags', 'like', $sTagLike)->count();
$r = Tags::where('id', '=', $v['id'])->update(['count' => $iTagCount]);
echo($r);
}
$aTopTags = Tags::where('count', '>', 0)->orderBy("count", "desc")->get()->toArray();
$sTopTagsView = view('widget/toptags', [
'aToptags' => $aTopTags,
]);
$sTopTagsHtmlPath = "widget/toptags.html";
$r = file_put_contents($sTopTagsHtmlPath, $sTopTagsView);
if ($r === false) {
echo "<br>fail<br>";return;
}
echo "#end# top tag to html - end \n";
}
// 文章自动删除 @cron
public function FreenodeDelAuto()
{
echo "\n#start# article del auto \n";
$sTimeSet = -366;
$sTimeForDel = strtotime($sTimeSet." day");
$sDateCodeForDel = date("Ymd", $sTimeForDel);
//// 数据删除 start
$r = ArticleList::where("code", $sDateCodeForDel)->delete();
if ($r) {
echo "data del - done \n";
}
//// 数据删除 end
//// 静态页面删除 start
$file = 'fn/'.$sDateCodeForDel.'.html';
if (file_exists($file)) {
if (unlink($file)) {
echo "static page del - done \n";
} else {
echo "static page del - fail \n";
}
} else {
echo "static page - not exits \n";
}
//// 静态页面删除 end
//// clash订阅删除 start
$file = 'feed/clash-'.$sDateCodeForDel.'.html';
if (file_exists($file)) {
if (unlink($file)) {
echo "clash feed del - done \n";
} else {
echo "clash feed del - fail \n";
}
} else {
echo "clash feed - not exits \n";
}
//// clash订阅删除 end
//// v2ray订阅删除 start
$file = 'feed/v2ray-'.$sDateCodeForDel.'.html';
if (file_exists($file)) {
if (unlink($file)) {
echo "v2ray feed del - done \n";
} else {
echo "v2ray feed del - fail \n";
}
} else {
echo "v2ray feed - exits \n";
}
//// clash订阅删除 end
echo "#end# article del auto \n";
}
// 自动点赞 @cron
public function likeAuto ()
{
echo "\n#start# like auto \n";
$iRand = rand(1, 2);
if ($iRand === 1) {
$r = ArticleList::where('code', date('Ymd'))
->increment('like', 1);
echo $r;
}
echo '\n';
echo "#end# like auto \n";
}
// 点赞初始
public function likeInit ()
{
$aFreenodeAll = ArticleList::all()->toArray();
foreach ($aFreenodeAll as $aRow) {
if ($aRow['type'] == 'node') {
$iLikeCount = rand(3, 16);
} else {
$iLikeCount = rand(30, 120);
}
$r = ArticleList::where('id', $aRow['id'])
->update(['like' => $iLikeCount]);
echo $r;
}
// dd($aFreenodeAll);
}
// 节点文章批量抓取,倒数
public function freenodeCraw($day) {
$sDateStart = date("Ymd", strtotime("-$day day"));
$iLimit = 10;
for ($i=$day; $i>($day - $iLimit); $i--) {
echo "<br>";
echo ($i);
echo "<br>";
echo $this->freenodeUp(-$i);
}
}
// 免费节点每日更新
public function freenodeUp($sTimeSet = "0") {
echo "\n#start# article fn up \n";
$sTimeStart = strtotime($sTimeSet." day");
$sTimeNextDay = strtotime(($sTimeSet+1)." day");
$sTimePrevDay = strtotime(($sTimeSet-1)." day");
$sDateStartCode = date("Ymd", $sTimeStart);
$sDateNextDayCode = date("Ymd", $sTimeNextDay);
//// 生成订阅 start
$iTodayCode = ArticleList::where("code", $sDateStartCode)->first()?->code;
if ($iTodayCode) {
echo "article already exists.\n";
return;
}
$sV2rayTodayUrl = "https://nodefree.githubrowcontent.com/".date('Y', $sTimeStart)."/".date('m', $sTimeStart)."/".$sDateStartCode.".txt";
$sV2rayToday = @file_get_contents($sV2rayTodayUrl);
$sV2rayNextUrl = "https://nodefree.githubrowcontent.com/".date('Y', $sTimeNextDay)."/".date('m', $sTimeNextDay)."/".$sDateNextDayCode.".txt";
$sV2rayNext = @file_get_contents($sV2rayNextUrl);
if (empty($sV2rayNext) || $sV2rayNext == $sV2rayToday) {
echo "not have update. \n";return;
}
$sV2rayPath = "feed/v2ray-".$sDateStartCode.".txt";
$mV2rayR = file_put_contents($sV2rayPath, $sV2rayToday);
if ($mV2rayR === false) {
echo "v2ray feed save - fail \n";return;
} else {
echo "v2ray feed save: $sV2rayPath \n<br>";
}
$sClashPath = "feed/clash-".$sDateStartCode.".yaml";
$sClashTodayUrl = "https://nodefree.githubrowcontent.com/".date('Y', $sTimeStart)."/".date('m', $sTimeStart)."/".$sDateStartCode.".yaml";
$sClashToday = @file_get_contents($sClashTodayUrl);
$mClashR = file_put_contents($sClashPath, $sClashToday);
if ($mClashR === false) {
echo "clash feed save - fail \n";return;
} else {
echo "clash feed save: $sClashPath \n";
}
//// 生成订阅 end
//// 文章入库 start
// 图片
$iPrevImgId = ArticleList::where("code", date("Ymd", $sTimePrevDay))->first()?->img_id;
if ($iPrevImgId >= env('article_img_count')) {
$iImgId = 1;
} else {
$iImgId = $iPrevImgId + 1;
}
// 地区
$aNodeRegionPool = [
'美国、日本、俄罗斯、新加坡、香港、台湾、越南、德国',
'美国、日本、新加坡、台湾、韩国',
'美国、新加坡、日本、俄罗斯、越南',
'美国、新加坡、日本、俄罗斯',
'香港、台湾、美国、日本、新加坡、德国',
'美国、新加坡、加拿大、香港、欧洲、韩国、日本',
'美国、日本、新加坡、台湾'
];
$iNodeRegionRandKey = array_rand($aNodeRegionPool);
$sNodeZone = $aNodeRegionPool[$iNodeRegionRandKey];
// 标题
$aTitlePool = [
date('Y', $sTimeStart)."年最新高速SSR/V2ray/Clash/Shadowrocket免费节点订阅链接"
];
$iTitlePoolRandKey = array_rand($aTitlePool);
$sTitle = $aTitlePool[$iTitlePoolRandKey];
// 内容
$iNodeSpeed = rand((int) env("freenode_speed_min"), (int) env("freenode_speed_max"));
$iNodeCount = rand((int) env("freenode_count_min"), (int) env("freenode_count_max"));
$sV2raySubPath = env('APP_URL')."/sub/v2ray-".$sDateStartCode.".txt";
$sClashSubPath = env('APP_URL')."/sub/clash-".$sDateStartCode.".yaml";
$sContent = "
<p>本次更新共".$iNodeCount."个可用节点,最高速度".$iNodeSpeed."M/S。</p>
<p>覆盖".$sNodeZone."等多个区域。</p>
<p>复制下方的v2ray/Clash订阅链接在客户端添加即可正常使用。<br />
";
// 副标题
$sTitleSub = "
本次更新共".$iNodeCount."个可用节点,最高速度".$iNodeSpeed."M/S。
覆盖".$sNodeZone."等多个区域。
复制下方的v2ray/Clash订阅链接在客户端添加即可正常使用。
";
// 标签
$aTagPool = [
'[1][2][3][4][5][6][7][8][11]'
];
$iTagPoolRandKey = array_rand($aTagPool);
$sTag = $aTagPool[$iTagPoolRandKey];
$oFreenoodList = new ArticleList();
$oFreenoodList->img_id = $iImgId;
$oFreenoodList->date_str = date('n月j日', $sTimeStart);
$oFreenoodList->created_at = $sTimeStart;
$oFreenoodList->title = $sTitle;
$oFreenoodList->code = $sDateStartCode;
$oFreenoodList->tags = $sTag;
$oFreenoodList->type = 'node';
$oFreenoodList->content = $sContent;
$oFreenoodList->title_sub = $sTitleSub;
$r = $oFreenoodList->save();
if ($r != true) {
echo "article insert - fail.";var_dump($r);return;
} else {
// 标签计数增加
// $sTagsStr = $sTag;
// $sTagsStr = substr($sTagsStr, 1, -1);
// $aTags = explode('][', $sTagsStr);
//
// $r = \DB::table('tags')
// ->whereIn('id', $aTags)
// ->increment('count', 1);
}
//// 文章入库 end
//// 文章静态化 start
$sFreenodeNewUrl = env("APP_URL")."/fn/single/".$sDateStartCode;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $sFreenodeNewUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$sFreeNodeNewView = curl_exec($ch);
curl_close($ch);
$sFreeNodePath = "fn/".$sDateStartCode.".html";
$r = file_put_contents($sFreeNodePath, $sFreeNodeNewView);
if ($r == false) {
echo "article static - fail \n";return;
} else {
echo 'article static - done \n';
}
//// 静态化 end
// 标签统计&静态化
// $this->tagCountToHtml();
echo "#end# article fn up \n";
}
// 直接生成文章
public function freenodeDataAll ()
{
$sTimeSet = -env('freenode_keep_day');
for ($i=$sTimeSet; $i<=0; $i++) {
$sTimeStart = strtotime($i." day");
$sTimePrev = strtotime(($i-1)." day");
$sDateCodeStart = date("Ymd", $sTimeStart);
$sDateCodePrev = date("Ymd", $sTimePrev);
//// 文章入库 start
// 图片
$iPrevImgId = ArticleList::where("code", $sDateCodePrev)->first()?->img_id;
if ($iPrevImgId >= env('article_img_count')) {
$iImgId = 1;
} else {
$iImgId = $iPrevImgId + 1;
}
// 地区
$aNodeRegionPool = [
'美国、日本、俄罗斯、新加坡、香港、台湾、越南、德国',
'美国、日本、新加坡、台湾、韩国',
'美国、新加坡、日本、俄罗斯、越南',
'美国、新加坡、日本、俄罗斯',
'香港、台湾、美国、日本、新加坡、德国',
'美国、新加坡、加拿大、香港、欧洲、韩国、日本',
'美国、日本、新加坡、台湾'
];
$iNodeRegionRandKey = array_rand($aNodeRegionPool);
$sNodeZone = $aNodeRegionPool[$iNodeRegionRandKey];
// 标题
$aTitlePool = [
date('Y', $sTimeStart)."年最新高速SSR/V2ray/Clash/Shadowrocket免费节点订阅链接"
];
$iTitlePoolRandKey = array_rand($aTitlePool);
$sTitle = $aTitlePool[$iTitlePoolRandKey];
// 副标题
$iNodeSpeed = rand((int) env("freenode_speed_min"), (int) env("freenode_speed_max"));
$iNodeCount = rand((int) env("freenode_count_min"), (int) env("freenode_count_max"));
$sTitleSub = "
本次更新共".$iNodeCount."个可用节点,最高速度".$iNodeSpeed."M/S。
覆盖".$sNodeZone."等多个区域。
复制下方的v2ray/Clash订阅链接在客户端添加即可正常使用。
";
$sContent = "
<p>本次更新共".$iNodeCount."个可用节点,最高速度".$iNodeSpeed."M/S。</p>
<p>覆盖".$sNodeZone."等多个区域。</p>
<p>复制下方的v2ray/Clash订阅链接在客户端添加即可正常使用。<br />
";
// 标签
$aTagPool = [
'[1][2][3][4][5][6][7][8][11]'
];
$iTagPoolRandKey = array_rand($aTagPool);
$sTag = $aTagPool[$iTagPoolRandKey];
// 入库
$oFreenoodList = new ArticleList();
$oFreenoodList->img_id = $iImgId;
$oFreenoodList->date_str = date('n月j日', $sTimeStart);
$oFreenoodList->created_at = $sTimeStart;
$oFreenoodList->title = $sTitle;
$oFreenoodList->code = $sDateCodeStart;
$oFreenoodList->tags = $sTag;
$oFreenoodList->type = 'node';
$oFreenoodList->content = $sContent;
$oFreenoodList->title_sub = $sTitleSub;
$r = $oFreenoodList->save();
if ($r != true) {
echo "article insert - fail \n";var_dump($r);return;
} else {
echo "article insert - done \n";
}
//// 文章入库 end
}
dd($sDateCodeStart);
}
public function freenodeHtmlAll ()
{
$aFreenodeAll = ArticleList::where("type", "node")->get()->toArray();
foreach ($aFreenodeAll as $aRow) {
$sFreenodeNewUrl = env("APP_URL")."/fn/single/".$aRow['code'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $sFreenodeNewUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$sFreeNodeNewView = curl_exec($ch);
curl_close($ch);
$sFreeNodePath = "fn/".$aRow['code'].".html";
$r = file_put_contents($sFreeNodePath, $sFreeNodeNewView);
if ($r == false) {
echo "article to static - fail \n";return;
} else {
echo 'article to static - done:'.$aRow['code'].'\n';
}
}
}
}

View File

@ -0,0 +1,59 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Services\Time;
use voku\helper\AntiXSS;
use App\Models\ArticleList;
use Illuminate\Routing\Controller;
class HelperController extends Controller
{
public function __construct()
{
$this->middleware('throttle:1,1')->only('likeUp');
}
public function timeLost($sArticleTime)
{
$oAntiXss = new AntiXSS();
$sTimeEnd = $oAntiXss->xss_clean($sArticleTime);
$sTimeLost = Time::Lost(time(), strtotime($sArticleTime));
echo $sTimeLost;exit;
}
public function likeUp($id)
{
$oAntiXss = new AntiXSS();
$id = $oAntiXss->xss_clean($id);
ArticleList::where("id", $id)->increment('like');
$iLikeNow = ArticleList::where("id", $id)->first()?->like;
$aResult = [
"iCode" => 1,
"iLikeNow" => $iLikeNow,
];
echo json_encode($aResult);
}
public function likeGet($id)
{
$oAntiXss = new AntiXSS();
$id = $oAntiXss->xss_clean($id);
$iLike = ArticleList::where("id", $id)->first()?->like;
echo $iLike;
}
}

View File

@ -0,0 +1,55 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\ArticleList;
//use App\Services\Time;
use voku\helper\AntiXSS;
//use App\Models\Tags;
class HtmlController extends Controller
{
// public function client()
// {
//
// $sUrlBase = env('APP_URL').'/client/single/';
//
// $sHtmlPathBase = "client/";
//
// $aArticleCode = [
// '1001',
// '1002',
// '1003',
// '1004',
// '1005',
// '1006',
// '1007',
// '1008',
// ];
//
// $ch = curl_init();
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
// curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
//
// foreach ($aArticleCode as $iCode) {
//
// $sUrl = $sUrlBase.$iCode;
// $sHtmlPath = $sHtmlPathBase.$iCode.'.html';
//
// curl_setopt($ch, CURLOPT_URL, $sUrl);
//
// $sArticleView = curl_exec($ch);
//
// $r = file_put_contents($sHtmlPath, $sArticleView);
//
// echo $r;
// echo "<br>";
// }
//
// curl_close($ch);
//
// }
}

View File

@ -0,0 +1,53 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\ArticleList;
use App\Services\Time;
use voku\helper\AntiXSS;
use App\Models\Tags;
class SakaiController extends Controller
{
public function tool() {
// $directory = 'feed'; // 替换为你的文件夹路径
// $files = glob($directory . '/clash-*'); // 查找以sss开头的文件
//
// foreach ($files as $file) {
// $pathInfo = pathinfo($file); // 获取文件信息
// $newFileName = $pathInfo['dirname'] . '/' . $pathInfo['filename'] . '.yaml'; // 新文件名
// rename($file, $newFileName); // 重命名文件
// }
//
// echo "文件后缀已更改为 .ccc";
//
// exit;
// $k = request('k');
//
// if ($k != env('k')) {
// exit;
// }
$kv = [
'节点每日更新 @cron' => '/exec/freenode/up',
'静态生成 - 客户端文章' => '/exec/html/client',
'模版 - 免费节点文章' => '/fn/single/20241231',
'模版 - 客户端文章' => '/client/singe/1001',
'静态生成 - 热门标签 @cron' => '/exec/html/toptags',
'节点文章 - 批量抓' => '/exec/freenode/craw',
'节点文章 - 自动删除 @cron' => '/exec/freenode/del',
'点赞 - 初始数据' => '/exec/like/init',
'点赞 - 自动增加 @cron' => '/exec/like/auto',
'节点文章 - 生成数据' => '/exec/freenode/data/all',
'所有文章 - 静态化' => '/exec/freenode/html/all',
];
return view('test/tool', [
'ky' => $kv
]);
}
}

7
app/Http/Kernel.php Executable file
View File

@ -0,0 +1,7 @@
<?php
protected $routeMiddleware = [
// 其他中间件...
'test' => \App\Http\Middleware\Test::class,
];
?>

21
app/Http/Middleware/Test.php Executable file
View File

@ -0,0 +1,21 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
//use voku\helper\AntiXSS;
class Test
{
public function handle(Request $request, Closure $next): Response
{
$sSearch = request('search');
// echo $sSearch;exit;
return $next($request);
}
}

10
app/Models/ArticleList.php Executable file
View File

@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ArticleList extends Model
{
protected $table = 'article_list';
}

10
app/Models/ClientList.php Executable file
View File

@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ClientList extends Model
{
protected $table = 'client_list';
}

11
app/Models/Tags.php Executable file
View File

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Tags extends Model
{
protected $table = 'tags';
public $timestamps = false;
}

48
app/Models/User.php Executable file
View File

@ -0,0 +1,48 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
/** @use HasFactory<\Database\Factories\UserFactory> */
use HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
//
}
}

22
app/Services/Tag.php Executable file
View File

@ -0,0 +1,22 @@
<?php
namespace App\Services;
use App\Models\Tags;
class Tag {
public static function strToNames($sTagsStr)
{
$sTagsStr = substr($sTagsStr, 1, -1);
$aTagsId = explode('][', $sTagsStr);
$aTagsMap = Tags::all()->toArray();
foreach ($aTagsId as $aTagsIdRow) {
$aTagNames[] = $aTagsMap[$aTagsIdRow-1];
}
return $aTagNames;
}
}

28
app/Services/Time.php Executable file
View File

@ -0,0 +1,28 @@
<?php
namespace App\Services;
class Time {
public static function Lost($iDa, $iXiao) {
$sDiffTime = abs($iDa - $iXiao);
// 计算差值的分钟、小时和天数
$iDiffM = floor($sDiffTime / 60);
$iDiffH = floor($sDiffTime / 3600);
$iDiffD = floor($sDiffTime / 86400);
if ($iDiffD >= 1 ) {
$sTimeLost = $iDiffD. ' 天';
} else if ($iDiffH >= 1) {
$sTimeLost = $iDiffH. ' 小时';
} else {
$iDiffM = $iDiffM == 0?1:$iDiffM;
$sTimeLost = $iDiffM. ' 分钟';
}
return $sTimeLost;
}
}

15
artisan Executable file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env php
<?php
use Symfony\Component\Console\Input\ArgvInput;
define('LARAVEL_START', microtime(true));
// Register the Composer autoloader...
require __DIR__.'/vendor/autoload.php';
// Bootstrap Laravel and handle the command...
$status = (require_once __DIR__.'/bootstrap/app.php')
->handleCommand(new ArgvInput);
exit($status);

20
bootstrap/app.php Executable file
View File

@ -0,0 +1,20 @@
<?php
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware) {
$middleware->alias([
'test' => \App\Http\Middleware\Test::class,
]);
})
->withExceptions(function (Exceptions $exceptions) {
//
})->create();

2
bootstrap/cache/.gitignore vendored Executable file
View File

@ -0,0 +1,2 @@
*
!.gitignore

5
bootstrap/providers.php Executable file
View File

@ -0,0 +1,5 @@
<?php
return [
App\Providers\AppServiceProvider::class,
];

73
composer.json Executable file
View File

@ -0,0 +1,73 @@
{
"$schema": "https://getcomposer.org/schema.json",
"name": "laravel/laravel",
"type": "project",
"description": "The skeleton application for the Laravel framework.",
"keywords": ["laravel", "framework"],
"license": "MIT",
"require": {
"php": "^8.2",
"guzzlehttp/guzzle": "^7.9",
"laravel/framework": "^11.31",
"laravel/tinker": "^2.9",
"voku/anti-xss": "^4.1"
},
"require-dev": {
"fakerphp/faker": "^1.23",
"laravel/pail": "^1.1",
"laravel/pint": "^1.13",
"laravel/sail": "^1.26",
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.1",
"phpunit/phpunit": "^11.0.1"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi",
"@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
"@php artisan migrate --graceful --ansi"
],
"dev": [
"Composer\\Config::disableProcessTimeout",
"npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}

8414
composer.lock generated Executable file

File diff suppressed because it is too large Load Diff

126
config/app.php Executable file
View File

@ -0,0 +1,126 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application, which will be used when the
| framework needs to place the application's name in a notification or
| other UI elements where an application name needs to be displayed.
|
*/
'name' => env('APP_NAME', 'Laravel'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => (bool) env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| the application so that it's available within Artisan commands.
|
*/
'url' => env('APP_URL', 'http://localhost'),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. The timezone
| is set to "UTC" by default as it is suitable for most use cases.
|
*/
'timezone' => env('APP_TIMEZONE', 'UTC'),
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by Laravel's translation / localization methods. This option can be
| set to any locale for which you plan to have translation strings.
|
*/
'locale' => env('APP_LOCALE', 'en'),
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),
'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'),
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is utilized by Laravel's encryption services and should be set
| to a random, 32 character string to ensure that all encrypted values
| are secure. You should do this prior to deploying the application.
|
*/
'cipher' => 'AES-256-CBC',
'key' => env('APP_KEY'),
'previous_keys' => [
...array_filter(
explode(',', env('APP_PREVIOUS_KEYS', ''))
),
],
/*
|--------------------------------------------------------------------------
| Maintenance Mode Driver
|--------------------------------------------------------------------------
|
| These configuration options determine the driver used to determine and
| manage Laravel's "maintenance mode" status. The "cache" driver will
| allow maintenance mode to be controlled across multiple machines.
|
| Supported drivers: "file", "cache"
|
*/
'maintenance' => [
'driver' => env('APP_MAINTENANCE_DRIVER', 'file'),
'store' => env('APP_MAINTENANCE_STORE', 'database'),
],
];

115
config/auth.php Executable file
View File

@ -0,0 +1,115 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option defines the default authentication "guard" and password
| reset "broker" for your application. You may change these values
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => env('AUTH_GUARD', 'web'),
'passwords' => env('AUTH_PASSWORD_BROKER', 'users'),
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| which utilizes session storage plus the Eloquent user provider.
|
| All authentication guards have a user provider, which defines how the
| users are actually retrieved out of your database or other storage
| system used by the application. Typically, Eloquent is utilized.
|
| Supported: "session"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication guards have a user provider, which defines how the
| users are actually retrieved out of your database or other storage
| system used by the application. Typically, Eloquent is utilized.
|
| If you have multiple user tables or models you may configure multiple
| providers to represent the model / table. These providers may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => env('AUTH_MODEL', App\Models\User::class),
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| These configuration options specify the behavior of Laravel's password
| reset functionality, including the table utilized for token storage
| and the user provider that is invoked to actually retrieve users.
|
| The expiry time is the number of minutes that each reset token will be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
| The throttle setting is the number of seconds a user must wait before
| generating more password reset tokens. This prevents the user from
| quickly generating a very large amount of password reset tokens.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'),
'expire' => 60,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the amount of seconds before a password confirmation
| window expires and users are asked to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800),
];

108
config/cache.php Executable file
View File

@ -0,0 +1,108 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache store that will be used by the
| framework. This connection is utilized if another isn't explicitly
| specified when running a cache operation inside the application.
|
*/
'default' => env('CACHE_STORE', 'database'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
| Supported drivers: "array", "database", "file", "memcached",
| "redis", "dynamodb", "octane", "null"
|
*/
'stores' => [
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'connection' => env('DB_CACHE_CONNECTION'),
'table' => env('DB_CACHE_TABLE', 'cache'),
'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'),
'lock_table' => env('DB_CACHE_LOCK_TABLE'),
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
'lock_path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => env('REDIS_CACHE_CONNECTION', 'cache'),
'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'),
],
'dynamodb' => [
'driver' => 'dynamodb',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
'endpoint' => env('DYNAMODB_ENDPOINT'),
],
'octane' => [
'driver' => 'octane',
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing the APC, database, memcached, Redis, and DynamoDB cache
| stores, there might be other applications using the same cache. For
| that reason, you may prefix every cache key to avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
];

173
config/database.php Executable file
View File

@ -0,0 +1,173 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for database operations. This is
| the connection which will be utilized unless another connection
| is explicitly specified when you execute a query / statement.
|
*/
'default' => env('DB_CONNECTION', 'sqlite'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Below are all of the database connections defined for your application.
| An example configuration is provided for each database system which
| is supported by Laravel. You're free to add / remove connections.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DB_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
'busy_timeout' => null,
'journal_mode' => null,
'synchronous' => null,
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'mariadb' => [
'driver' => 'mariadb',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
'search_path' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DB_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run on the database.
|
*/
'migrations' => [
'table' => 'migrations',
'update_date_on_publish' => true,
],
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as Memcached. You may define your connection settings here.
|
*/
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],
],
];

77
config/filesystems.php Executable file
View File

@ -0,0 +1,77 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application for file storage.
|
*/
'default' => env('FILESYSTEM_DISK', 'local'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Below you may configure as many filesystem disks as necessary, and you
| may even configure multiple disks for the same driver. Examples for
| most supported storage drivers are configured here for reference.
|
| Supported drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app/private'),
'serve' => true,
'throw' => false,
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
'throw' => false,
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
'throw' => false,
],
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [
public_path('storage') => storage_path('app/public'),
],
];

132
config/logging.php Executable file
View File

@ -0,0 +1,132 @@
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
use Monolog\Processor\PsrLogMessageProcessor;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that is utilized to write
| messages to your logs. The value provided here should match one of
| the channels present in the list of "channels" configured below.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Deprecations Log Channel
|--------------------------------------------------------------------------
|
| This option controls the log channel that should be used to log warnings
| regarding deprecated PHP and library features. This allows you to get
| your application ready for upcoming major versions of dependencies.
|
*/
'deprecations' => [
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
],
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Laravel
| utilizes the Monolog PHP logging library, which includes a variety
| of powerful log handlers and formatters that you're free to use.
|
| Available drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog", "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => explode(',', env('LOG_STACK', 'single')),
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => env('LOG_DAILY_DAYS', 14),
'replace_placeholders' => true,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'),
'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
'level' => env('LOG_LEVEL', 'critical'),
'replace_placeholders' => true,
],
'papertrail' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
],
'processors' => [PsrLogMessageProcessor::class],
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'stream' => 'php://stderr',
],
'processors' => [PsrLogMessageProcessor::class],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER),
'replace_placeholders' => true,
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];

116
config/mail.php Executable file
View File

@ -0,0 +1,116 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send all email
| messages unless another mailer is explicitly specified when sending
| the message. All additional mailers can be configured within the
| "mailers" array. Examples of each type of mailer are provided.
|
*/
'default' => env('MAIL_MAILER', 'log'),
/*
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers that can be used
| when delivering an email. You may specify which one you're using for
| your mailers below. You may also add additional mailers if needed.
|
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
| "postmark", "resend", "log", "array",
| "failover", "roundrobin"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'scheme' => env('MAIL_SCHEME'),
'url' => env('MAIL_URL'),
'host' => env('MAIL_HOST', '127.0.0.1'),
'port' => env('MAIL_PORT', 2525),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url(env('APP_URL', 'http://localhost'), PHP_URL_HOST)),
],
'ses' => [
'transport' => 'ses',
],
'postmark' => [
'transport' => 'postmark',
// 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'),
// 'client' => [
// 'timeout' => 5,
// ],
],
'resend' => [
'transport' => 'resend',
],
'sendmail' => [
'transport' => 'sendmail',
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
'failover' => [
'transport' => 'failover',
'mailers' => [
'smtp',
'log',
],
],
'roundrobin' => [
'transport' => 'roundrobin',
'mailers' => [
'ses',
'postmark',
],
],
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all emails sent by your application to be sent from
| the same address. Here you may specify a name and address that is
| used globally for all emails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
];

112
config/queue.php Executable file
View File

@ -0,0 +1,112 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue supports a variety of backends via a single, unified
| API, giving you convenient access to each backend using identical
| syntax for each. The default queue connection is defined below.
|
*/
'default' => env('QUEUE_CONNECTION', 'database'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection options for every queue backend
| used by your application. An example configuration is provided for
| each backend supported by Laravel. You're also free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'connection' => env('DB_QUEUE_CONNECTION'),
'table' => env('DB_QUEUE_TABLE', 'jobs'),
'queue' => env('DB_QUEUE', 'default'),
'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90),
'after_commit' => false,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'),
'queue' => env('BEANSTALKD_QUEUE', 'default'),
'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90),
'block_for' => 0,
'after_commit' => false,
],
'sqs' => [
'driver' => 'sqs',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'default'),
'suffix' => env('SQS_SUFFIX'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'after_commit' => false,
],
'redis' => [
'driver' => 'redis',
'connection' => env('REDIS_QUEUE_CONNECTION', 'default'),
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90),
'block_for' => null,
'after_commit' => false,
],
],
/*
|--------------------------------------------------------------------------
| Job Batching
|--------------------------------------------------------------------------
|
| The following options configure the database and table that store job
| batching information. These options can be updated to any database
| connection and table which has been defined by your application.
|
*/
'batching' => [
'database' => env('DB_CONNECTION', 'sqlite'),
'table' => 'job_batches',
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control how and where failed jobs are stored. Laravel ships with
| support for storing failed jobs in a simple file or in a database.
|
| Supported drivers: "database-uuids", "dynamodb", "file", "null"
|
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'sqlite'),
'table' => 'failed_jobs',
],
];

38
config/services.php Executable file
View File

@ -0,0 +1,38 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Mailgun, Postmark, AWS and more. This file provides the de facto
| location for this type of information, allowing packages to have
| a conventional file to locate the various service credentials.
|
*/
'postmark' => [
'token' => env('POSTMARK_TOKEN'),
],
'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
'resend' => [
'key' => env('RESEND_KEY'),
],
'slack' => [
'notifications' => [
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
],
],
];

217
config/session.php Executable file
View File

@ -0,0 +1,217 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option determines the default session driver that is utilized for
| incoming requests. Laravel supports a variety of storage options to
| persist session data. Database storage is a great default choice.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "dynamodb", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'database'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to expire immediately when the browser is closed then you may
| indicate that via the expire_on_close configuration option.
|
*/
'lifetime' => env('SESSION_LIFETIME', 120),
'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false),
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it's stored. All encryption is performed
| automatically by Laravel and you may use the session like normal.
|
*/
'encrypt' => env('SESSION_ENCRYPT', false),
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When utilizing the "file" session driver, the session files are placed
| on disk. The default storage location is defined here; however, you
| are free to provide another location where they should be stored.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => env('SESSION_CONNECTION'),
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table to
| be used to store sessions. Of course, a sensible default is defined
| for you; however, you're welcome to change this to another table.
|
*/
'table' => env('SESSION_TABLE', 'sessions'),
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| When using one of the framework's cache driven session backends, you may
| define the cache store which should be used to store the session data
| between requests. This must match one of your defined cache stores.
|
| Affects: "apc", "dynamodb", "memcached", "redis"
|
*/
'store' => env('SESSION_STORE'),
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the session cookie that is created by
| the framework. Typically, you should not need to change this value
| since doing so does not grant a meaningful security improvement.
|
*/
'cookie' => env(
'SESSION_COOKIE',
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
),
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application, but you're free to change this when necessary.
|
*/
'path' => env('SESSION_PATH', '/'),
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| This value determines the domain and subdomains the session cookie is
| available to. By default, the cookie will be available to the root
| domain and all subdomains. Typically, this shouldn't be changed.
|
*/
'domain' => env('SESSION_DOMAIN'),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you when it can't be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE'),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. It's unlikely you should disable this option.
|
*/
'http_only' => env('SESSION_HTTP_ONLY', true),
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| will set this value to "lax" to permit secure cross-site requests.
|
| See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
|
| Supported: "lax", "strict", "none", null
|
*/
'same_site' => env('SESSION_SAME_SITE', 'lax'),
/*
|--------------------------------------------------------------------------
| Partitioned Cookies
|--------------------------------------------------------------------------
|
| Setting this value to true will tie the cookie to the top-level site for
| a cross-site context. Partitioned cookies are accepted by the browser
| when flagged "secure" and the Same-Site attribute is set to "none".
|
*/
'partitioned' => env('SESSION_PARTITIONED_COOKIE', false),
];

1
database/.gitignore vendored Executable file
View File

@ -0,0 +1 @@
*.sqlite*

View File

@ -0,0 +1,44 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
*/
class UserFactory extends Factory
{
/**
* The current password being used by the factory.
*/
protected static ?string $password;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'name' => fake()->name(),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => static::$password ??= Hash::make('password'),
'remember_token' => Str::random(10),
];
}
/**
* Indicate that the model's email address should be unverified.
*/
public function unverified(): static
{
return $this->state(fn (array $attributes) => [
'email_verified_at' => null,
]);
}
}

View File

@ -0,0 +1,49 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->longText('payload');
$table->integer('last_activity')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('sessions');
}
};

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('cache', function (Blueprint $table) {
$table->string('key')->primary();
$table->mediumText('value');
$table->integer('expiration');
});
Schema::create('cache_locks', function (Blueprint $table) {
$table->string('key')->primary();
$table->string('owner');
$table->integer('expiration');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cache');
Schema::dropIfExists('cache_locks');
}
};

View File

@ -0,0 +1,57 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('jobs', function (Blueprint $table) {
$table->id();
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
Schema::create('job_batches', function (Blueprint $table) {
$table->string('id')->primary();
$table->string('name');
$table->integer('total_jobs');
$table->integer('pending_jobs');
$table->integer('failed_jobs');
$table->longText('failed_job_ids');
$table->mediumText('options')->nullable();
$table->integer('cancelled_at')->nullable();
$table->integer('created_at');
$table->integer('finished_at')->nullable();
});
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('jobs');
Schema::dropIfExists('job_batches');
Schema::dropIfExists('failed_jobs');
}
};

View File

@ -0,0 +1,23 @@
<?php
namespace Database\Seeders;
use App\Models\User;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*/
public function run(): void
{
// User::factory(10)->create();
User::factory()->create([
'name' => 'Test User',
'email' => 'test@example.com',
]);
}
}

17
package.json Executable file
View File

@ -0,0 +1,17 @@
{
"private": true,
"type": "module",
"scripts": {
"build": "vite build",
"dev": "vite"
},
"devDependencies": {
"autoprefixer": "^10.4.20",
"axios": "^1.7.4",
"concurrently": "^9.0.1",
"laravel-vite-plugin": "^1.0",
"postcss": "^8.4.47",
"tailwindcss": "^3.4.13",
"vite": "^6.0"
}
}

33
phpunit.xml Executable file
View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory>tests/Feature</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>app</directory>
</include>
</source>
<php>
<env name="APP_ENV" value="testing"/>
<env name="APP_MAINTENANCE_DRIVER" value="file"/>
<env name="BCRYPT_ROUNDS" value="4"/>
<env name="CACHE_STORE" value="array"/>
<!-- <env name="DB_CONNECTION" value="sqlite"/> -->
<!-- <env name="DB_DATABASE" value=":memory:"/> -->
<env name="MAIL_MAILER" value="array"/>
<env name="PULSE_ENABLED" value="false"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="TELESCOPE_ENABLED" value="false"/>
</php>
</phpunit>

6
postcss.config.js Executable file
View File

@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};

BIN
public/.DS_Store vendored Executable file

Binary file not shown.

21
public/.htaccess Executable file
View File

@ -0,0 +1,21 @@
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

329
public/client/1001.html Executable file

File diff suppressed because one or more lines are too long

330
public/client/1002.html Executable file

File diff suppressed because one or more lines are too long

332
public/client/1003.html Executable file

File diff suppressed because one or more lines are too long

326
public/client/1004.html Executable file

File diff suppressed because one or more lines are too long

333
public/client/1005.html Executable file

File diff suppressed because one or more lines are too long

338
public/client/1006.html Executable file

File diff suppressed because one or more lines are too long

330
public/client/1007.html Executable file

File diff suppressed because one or more lines are too long

330
public/client/1008.html Executable file

File diff suppressed because one or more lines are too long

0
public/favicon.ico Executable file
View File

View File

4069
public/feed/clash-20240101.yaml Executable file

File diff suppressed because it is too large Load Diff

4037
public/feed/clash-20240102.yaml Executable file

File diff suppressed because it is too large Load Diff

3989
public/feed/clash-20240103.yaml Executable file

File diff suppressed because it is too large Load Diff

3877
public/feed/clash-20240104.yaml Executable file

File diff suppressed because it is too large Load Diff

3917
public/feed/clash-20240105.yaml Executable file

File diff suppressed because it is too large Load Diff

3917
public/feed/clash-20240106.yaml Executable file

File diff suppressed because it is too large Load Diff

3917
public/feed/clash-20240107.yaml Executable file

File diff suppressed because it is too large Load Diff

3861
public/feed/clash-20240108.yaml Executable file

File diff suppressed because it is too large Load Diff

3893
public/feed/clash-20240109.yaml Executable file

File diff suppressed because it is too large Load Diff

3829
public/feed/clash-20240110.yaml Executable file

File diff suppressed because it is too large Load Diff

3821
public/feed/clash-20240111.yaml Executable file

File diff suppressed because it is too large Load Diff

3885
public/feed/clash-20240112.yaml Executable file

File diff suppressed because it is too large Load Diff

3917
public/feed/clash-20240113.yaml Executable file

File diff suppressed because it is too large Load Diff

3821
public/feed/clash-20240114.yaml Executable file

File diff suppressed because it is too large Load Diff

4013
public/feed/clash-20240115.yaml Executable file

File diff suppressed because it is too large Load Diff

4117
public/feed/clash-20240116.yaml Executable file

File diff suppressed because it is too large Load Diff

4045
public/feed/clash-20240117.yaml Executable file

File diff suppressed because it is too large Load Diff

3989
public/feed/clash-20240118.yaml Executable file

File diff suppressed because it is too large Load Diff

3901
public/feed/clash-20240119.yaml Executable file

File diff suppressed because it is too large Load Diff

3885
public/feed/clash-20240120.yaml Executable file

File diff suppressed because it is too large Load Diff

4069
public/feed/clash-20240121.yaml Executable file

File diff suppressed because it is too large Load Diff

3925
public/feed/clash-20240122.yaml Executable file

File diff suppressed because it is too large Load Diff

4029
public/feed/clash-20240123.yaml Executable file

File diff suppressed because it is too large Load Diff

3893
public/feed/clash-20240124.yaml Executable file

File diff suppressed because it is too large Load Diff

4157
public/feed/clash-20240125.yaml Executable file

File diff suppressed because it is too large Load Diff

3909
public/feed/clash-20240126.yaml Executable file

File diff suppressed because it is too large Load Diff

3949
public/feed/clash-20240127.yaml Executable file

File diff suppressed because it is too large Load Diff

3909
public/feed/clash-20240128.yaml Executable file

File diff suppressed because it is too large Load Diff

3973
public/feed/clash-20240129.yaml Executable file

File diff suppressed because it is too large Load Diff

3957
public/feed/clash-20240130.yaml Executable file

File diff suppressed because it is too large Load Diff

4077
public/feed/clash-20240131.yaml Executable file

File diff suppressed because it is too large Load Diff

4053
public/feed/clash-20240201.yaml Executable file

File diff suppressed because it is too large Load Diff

4029
public/feed/clash-20240202.yaml Executable file

File diff suppressed because it is too large Load Diff

4061
public/feed/clash-20240203.yaml Executable file

File diff suppressed because it is too large Load Diff

4005
public/feed/clash-20240204.yaml Executable file

File diff suppressed because it is too large Load Diff

3949
public/feed/clash-20240205.yaml Executable file

File diff suppressed because it is too large Load Diff

4021
public/feed/clash-20240206.yaml Executable file

File diff suppressed because it is too large Load Diff

3981
public/feed/clash-20240207.yaml Executable file

File diff suppressed because it is too large Load Diff

4005
public/feed/clash-20240208.yaml Executable file

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More