Align free Shadowrocket ID category and article names
This commit is contained in:
parent
345f5fcd9d
commit
a35789ec4c
35
app/Console/Commands/AlignShadowrocketNaming.php
Normal file
35
app/Console/Commands/AlignShadowrocketNaming.php
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Services\ShadowrocketNaming;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
final class AlignShadowrocketNaming extends Command
|
||||||
|
{
|
||||||
|
protected $signature = 'shadowrocket:align-naming {--apply}';
|
||||||
|
protected $description = 'Align resource category and article metadata without changing account payloads';
|
||||||
|
|
||||||
|
public function handle(): int
|
||||||
|
{
|
||||||
|
$count = DB::transaction(function () {
|
||||||
|
$category = DB::table('categories')->where('sSlug', 'shadowrocketids')->lockForUpdate()->sole();
|
||||||
|
$rows = DB::table('articles')->where('iCategoryId', $category->id)->lockForUpdate()->get(['id', 'sTitle', 'sTitleSub']);
|
||||||
|
$changes = $rows->filter(fn ($r) => ShadowrocketNaming::align($r->sTitle) !== $r->sTitle || ShadowrocketNaming::align($r->sTitleSub ?? '') !== ($r->sTitleSub ?? ''));
|
||||||
|
if (! $this->option('apply')) return $changes->count();
|
||||||
|
if ($changes->isEmpty() && $category->sName === '免费小火箭ID') return 0;
|
||||||
|
$directory = storage_path('app/private/category-backups');
|
||||||
|
if (! is_dir($directory)) mkdir($directory, 0700, true);
|
||||||
|
$backup = $directory.'/shadowrocket-naming-'.Str::uuid().'.json';
|
||||||
|
if (file_put_contents($backup, json_encode(['category' => $category, 'articles' => $rows], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT)) === false) throw new \RuntimeException('Backup failed');
|
||||||
|
chmod($backup, 0600);
|
||||||
|
DB::table('categories')->where('id', $category->id)->update(['sName' => '免费小火箭ID', 'sDescription' => ShadowrocketNaming::align($category->sDescription ?? '')]);
|
||||||
|
foreach ($changes as $row) DB::table('articles')->where('id', $row->id)->update(['sTitle' => ShadowrocketNaming::align($row->sTitle), 'sTitleSub' => ShadowrocketNaming::align($row->sTitleSub ?? '')]);
|
||||||
|
return $changes->count();
|
||||||
|
});
|
||||||
|
$this->info(json_encode(['apply' => (bool) $this->option('apply'), 'articles' => $count], JSON_UNESCAPED_UNICODE));
|
||||||
|
return self::SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -114,6 +114,8 @@ public function receiveShadowrocketids(Request $oRequest)
|
|||||||
$sArticle = $aData["content"] ?? '';
|
$sArticle = $aData["content"] ?? '';
|
||||||
$sTitle = $aData["title"] ?? '';
|
$sTitle = $aData["title"] ?? '';
|
||||||
$sTitleSub = $aData["title_sub"] ?? '';
|
$sTitleSub = $aData["title_sub"] ?? '';
|
||||||
|
$sTitle = \App\Services\ShadowrocketNaming::align($sTitle);
|
||||||
|
$sTitleSub = \App\Services\ShadowrocketNaming::align($sTitleSub);
|
||||||
$aArticleTags = $aData["tags"] ?? [];
|
$aArticleTags = $aData["tags"] ?? [];
|
||||||
$sSlug = 'ssi'.date("Ymd");
|
$sSlug = 'ssi'.date("Ymd");
|
||||||
// $sImgAuthor = "tg_xiuren_a";
|
// $sImgAuthor = "tg_xiuren_a";
|
||||||
|
|||||||
11
app/Services/ShadowrocketNaming.php
Normal file
11
app/Services/ShadowrocketNaming.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services;
|
||||||
|
|
||||||
|
final class ShadowrocketNaming
|
||||||
|
{
|
||||||
|
public static function align(string $text): string
|
||||||
|
{
|
||||||
|
return str_replace(['免费苹果账号', '免费苹果ID', '免费苹果id', '(小火箭账号、shadowrocket id)'], ['免费小火箭ID', '免费小火箭ID', '免费小火箭ID', ''], $text);
|
||||||
|
}
|
||||||
|
}
|
||||||
7
docs/maintenance/SHADOWROCKET_NAMING_2026-11-02.md
Normal file
7
docs/maintenance/SHADOWROCKET_NAMING_2026-11-02.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# 免费小火箭ID命名对齐
|
||||||
|
|
||||||
|
2026-11-02用户要求栏目改回“免费小火箭ID”,文章同步对齐。上游master01的ShadowRocketCrawl配置来源为ProxyGo的/freeappleid/及/1-freeappleid/;来源导航称“免费小火箭ID”,标题称已购小火箭账号并同时使用苹果ID叫法。此为来源声明,不代表本站验证购买状态。
|
||||||
|
|
||||||
|
实现:ShadowrocketNaming统一标题/摘要中的称呼,接收接口对未来文章同样处理;AppleID页头改称免费小火箭ID。`shadowrocket:align-naming --apply`先备份分类和文章元数据,再定点更新类别名称/说明及该类别文章标题/摘要,不触及URL、正文、账号密码、时间或点赞。默认只预览,重复执行不重复改写。原正文解析继续兼容上游“免费苹果账号”标题,不改采集源或其他站点。
|
||||||
|
|
||||||
|
发布与验收回执:`output/shadowrocket-name-20261102/`,按生产当前HEAD建立独立worktree、Git推送并精确检出,命名元数据快照留服务器`storage/app/private/category-backups/`。回退需用本次快照只恢复相关分类/标题/摘要;应用回退对应发布前SHA,不整库覆盖。
|
||||||
@ -8,8 +8,8 @@
|
|||||||
@endonce
|
@endonce
|
||||||
<header class="aid-header">
|
<header class="aid-header">
|
||||||
<div class="aid-header__copy">
|
<div class="aid-header__copy">
|
||||||
<h1>{{ $oArticle->created_at?->format('n月j日') }}免费苹果ID</h1>
|
<h1>{{ $oArticle->created_at?->format('n月j日') }}免费小火箭ID</h1>
|
||||||
<p>App Store 共享账号,按地区选择使用。</p>
|
<p>用于下载小火箭的 App Store 共享账号,按地区选择使用。</p>
|
||||||
</div>
|
</div>
|
||||||
@if($oArticle->sThumb)
|
@if($oArticle->sThumb)
|
||||||
<img class="aid-header__art" src="{{ $oArticle->sThumb }}" width="112" height="80" alt="狗狗主题插画" decoding="async">
|
<img class="aid-header__art" src="{{ $oArticle->sThumb }}" width="112" height="80" alt="狗狗主题插画" decoding="async">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user