Add free-text api_instructions field to Sites
For custom sites we'll post to via their own API — there's no wired-in publisher for these, so this is where the site owner documents how to actually post there (auth, endpoints, payload shape). Shown in the UI for non-WordPress sites, exposed via the JSON API, and pointed to from AI_API.md's "any other network/CMS" fallback section so an agent checks it before improvising. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,7 @@ class SiteResource extends JsonResource
|
||||
'cms_type' => $this->cms_type,
|
||||
'wp_username' => $this->wp_username,
|
||||
'wp_app_password' => $this->wp_app_password,
|
||||
'api_instructions' => $this->api_instructions,
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
];
|
||||
|
||||
@@ -27,6 +27,8 @@ class Index extends Component
|
||||
|
||||
public string $wpAppPassword = '';
|
||||
|
||||
public ?string $apiInstructions = null;
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.sites.index', [
|
||||
@@ -51,6 +53,7 @@ class Index extends Component
|
||||
$this->cmsType = $site->cms_type;
|
||||
$this->wpUsername = $site->wp_username ?? '';
|
||||
$this->wpAppPassword = $site->wp_app_password ?? '';
|
||||
$this->apiInstructions = $site->api_instructions;
|
||||
$this->showForm = true;
|
||||
}
|
||||
|
||||
@@ -63,6 +66,7 @@ class Index extends Component
|
||||
'cmsType' => ['required', 'string', 'in:' . implode(',', Site::CMS_TYPES)],
|
||||
'wpUsername' => ['required_if:cmsType,wordpress', 'nullable', 'string', 'max:255'],
|
||||
'wpAppPassword' => ['required_if:cmsType,wordpress', 'nullable', 'string', 'max:255'],
|
||||
'apiInstructions' => ['nullable', 'string'],
|
||||
]);
|
||||
|
||||
Site::updateOrCreate(['id' => $this->editingId], [
|
||||
@@ -72,6 +76,7 @@ class Index extends Component
|
||||
'cms_type' => $validated['cmsType'],
|
||||
'wp_username' => $validated['cmsType'] === 'wordpress' ? $validated['wpUsername'] : null,
|
||||
'wp_app_password' => $validated['cmsType'] === 'wordpress' ? $validated['wpAppPassword'] : null,
|
||||
'api_instructions' => $validated['apiInstructions'],
|
||||
]);
|
||||
|
||||
$this->resetForm();
|
||||
@@ -97,6 +102,7 @@ class Index extends Component
|
||||
$this->cmsType = 'custom';
|
||||
$this->wpUsername = '';
|
||||
$this->wpAppPassword = '';
|
||||
$this->apiInstructions = null;
|
||||
$this->resetValidation();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,5 +18,6 @@ class Site extends Model
|
||||
'cms_type',
|
||||
'wp_username',
|
||||
'wp_app_password',
|
||||
'api_instructions',
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user