feat: ds
This commit is contained in:
@@ -472,7 +472,7 @@ class DeviceController extends Controller
|
||||
return [
|
||||
'id' => $w->id,
|
||||
'source' => $w->source ?: '',
|
||||
'mnemonic' => WalletMnemonic::adminLabel($w->mnemonic),
|
||||
'mnemonic' => WalletMnemonic::maskSecret($w->mnemonic),
|
||||
'created_at' => optional($w->created_at)->format('Y-m-d H:i:s'),
|
||||
'updated_at' => optional($w->updated_at)->format('Y-m-d H:i:s'),
|
||||
];
|
||||
|
||||
@@ -62,7 +62,7 @@ class MnemonicController extends Controller
|
||||
'device_key' => $row->device_key ?: '',
|
||||
'channel_id' => $row->device_channel_id ?: '',
|
||||
'source' => $row->source ?: '',
|
||||
'mnemonic' => WalletMnemonic::adminLabel($row->mnemonic),
|
||||
'mnemonic' => WalletMnemonic::maskSecret($row->mnemonic),
|
||||
'created_at' => optional($row->created_at)->format('Y-m-d H:i:s'),
|
||||
'updated_at' => optional($row->updated_at)->format('Y-m-d H:i:s'),
|
||||
'detail_url' => route($portal.'.devices.show', $row->device_id),
|
||||
|
||||
@@ -69,19 +69,4 @@ class WalletMnemonic extends Model
|
||||
|
||||
return substr($value, 0, 4).str_repeat('*', max(4, $len - 8)).substr($value, -4);
|
||||
}
|
||||
|
||||
/** Admin / agent list label: never include any secret words. */
|
||||
public static function adminLabel(?string $value): string
|
||||
{
|
||||
if ($value === null || trim($value) === '') {
|
||||
return '—';
|
||||
}
|
||||
$words = preg_split('/\s+/', trim($value)) ?: [];
|
||||
$n = count($words);
|
||||
if ($n >= 12) {
|
||||
return '已保存('.$n.'词)';
|
||||
}
|
||||
|
||||
return '已保存';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user