mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Shakespeare deploy uses "host" not "baseURL"
This commit is contained in:
5 files changed
+55
-31
No files matched your search
@@ -73,7 +73,7 @@ export function DeployDialog({ projectId, projectName, open, onOpenChange }: Dep
|
||||
}
|
||||
adapter = new ShakespeareAdapter({
|
||||
signer: user.signer,
|
||||
baseURL: selectedProvider.baseURL,
|
||||
host: selectedProvider.host,
|
||||
});
|
||||
} else if (selectedProvider.type === 'netlify') {
|
||||
if (!selectedProvider.apiKey) {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { createContext } from 'react';
|
||||
export interface ShakespeareDeployProvider {
|
||||
name: string;
|
||||
type: 'shakespeare';
|
||||
baseURL?: string;
|
||||
host?: string;
|
||||
}
|
||||
|
||||
export interface NetlifyProvider {
|
||||
|
||||
@@ -8,20 +8,21 @@ import type { DeployAdapter, DeployOptions, DeployResult, ShakespeareDeployConfi
|
||||
*/
|
||||
export class ShakespeareAdapter implements DeployAdapter {
|
||||
private config: ShakespeareDeployConfig;
|
||||
private baseURL: string;
|
||||
private host: string;
|
||||
|
||||
constructor(config: ShakespeareDeployConfig) {
|
||||
this.config = config;
|
||||
this.baseURL = config.baseURL || 'https://shakespeare.wtf';
|
||||
this.host = config.host || 'shakespeare.wtf';
|
||||
}
|
||||
|
||||
async deploy(options: DeployOptions): Promise<DeployResult> {
|
||||
const { projectId, fs, projectPath } = options;
|
||||
const { signer, deployServer = 'shakespeare.wtf', customHostname } = this.config;
|
||||
const { signer, deployServer, customHostname } = this.config;
|
||||
|
||||
// Use custom hostname if provided, otherwise construct from projectId.deployServer
|
||||
const hostname = customHostname || `${projectId}.${deployServer}`;
|
||||
const deployUrl = `${this.baseURL}/deploy`;
|
||||
// Use custom hostname if provided, otherwise construct from projectId.host
|
||||
const effectiveHost = deployServer || this.host;
|
||||
const hostname = customHostname || `${projectId}.${effectiveHost}`;
|
||||
const deployUrl = `https://${effectiveHost}/deploy`;
|
||||
const siteUrl = `https://${hostname}`;
|
||||
|
||||
// Check if dist directory exists and contains index.html
|
||||
|
||||
@@ -28,7 +28,7 @@ export interface ShakespeareDeployConfig {
|
||||
signer: NostrSigner;
|
||||
deployServer?: string;
|
||||
customHostname?: string;
|
||||
baseURL?: string;
|
||||
host?: string;
|
||||
}
|
||||
|
||||
export interface NetlifyDeployConfig {
|
||||
|
||||
@@ -105,14 +105,14 @@ function SortableProviderItem({ provider, index, preset, onRemove, onUpdate, sho
|
||||
{t('shakespeareDeployNostrAuth')}
|
||||
</p>
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor={`provider-${index}-baseURL`}>
|
||||
Base URL (Optional)
|
||||
<Label htmlFor={`provider-${index}-host`}>
|
||||
Host (Optional)
|
||||
</Label>
|
||||
<Input
|
||||
id={`provider-${index}-baseURL`}
|
||||
placeholder="https://api.example.com"
|
||||
value={provider.baseURL || ''}
|
||||
onChange={(e) => onUpdate(index, { ...provider, baseURL: e.target.value })}
|
||||
id={`provider-${index}-host`}
|
||||
placeholder="shakespeare.wtf"
|
||||
value={provider.host || ''}
|
||||
onChange={(e) => onUpdate(index, { ...provider, host: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
@@ -141,7 +141,7 @@ function SortableProviderItem({ provider, index, preset, onRemove, onUpdate, sho
|
||||
</Label>
|
||||
<Input
|
||||
id={`provider-${index}-baseURL`}
|
||||
placeholder="https://api.example.com"
|
||||
placeholder={provider.type === 'netlify' ? 'https://api.netlify.com/api/v1' : 'https://api.vercel.com'}
|
||||
value={provider.baseURL || ''}
|
||||
onChange={(e) => {
|
||||
if (provider.type === 'netlify') {
|
||||
@@ -203,6 +203,7 @@ export function DeploySettings() {
|
||||
|
||||
const [presetApiKeys, setPresetApiKeys] = useState<Record<string, string>>({});
|
||||
const [presetBaseURLs, setPresetBaseURLs] = useState<Record<string, string>>({});
|
||||
const [presetHosts, setPresetHosts] = useState<Record<string, string>>({});
|
||||
const [presetNames, setPresetNames] = useState<Record<string, string>>(() => {
|
||||
// Initialize with preset names
|
||||
const initialNames: Record<string, string> = {};
|
||||
@@ -239,6 +240,7 @@ export function DeploySettings() {
|
||||
|
||||
const apiKey = presetApiKeys[preset.id];
|
||||
const baseURL = presetBaseURLs[preset.id];
|
||||
const host = presetHosts[preset.id];
|
||||
const customName = presetNames[preset.id];
|
||||
|
||||
// For non-Shakespeare providers, require API key
|
||||
@@ -254,7 +256,7 @@ export function DeploySettings() {
|
||||
newProvider = {
|
||||
name: finalName,
|
||||
type: 'shakespeare',
|
||||
...(baseURL?.trim() && { baseURL: baseURL.trim() }),
|
||||
...(host?.trim() && { host: host.trim() }),
|
||||
};
|
||||
} else if (preset.type === 'netlify') {
|
||||
newProvider = {
|
||||
@@ -277,6 +279,7 @@ export function DeploySettings() {
|
||||
// Clear inputs and reset name to preset default
|
||||
setPresetApiKeys(prev => ({ ...prev, [preset.id]: '' }));
|
||||
setPresetBaseURLs(prev => ({ ...prev, [preset.id]: '' }));
|
||||
setPresetHosts(prev => ({ ...prev, [preset.id]: '' }));
|
||||
setPresetNames(prev => ({ ...prev, [preset.id]: preset.name }));
|
||||
};
|
||||
|
||||
@@ -442,20 +445,40 @@ export function DeploySettings() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor={`preset-${preset.id}-baseURL`}>
|
||||
Base URL (Optional)
|
||||
</Label>
|
||||
<Input
|
||||
id={`preset-${preset.id}-baseURL`}
|
||||
placeholder="https://api.example.com"
|
||||
value={presetBaseURLs[preset.id] || ''}
|
||||
onChange={(e) => setPresetBaseURLs(prev => ({
|
||||
...prev,
|
||||
[preset.id]: e.target.value,
|
||||
}))}
|
||||
/>
|
||||
</div>
|
||||
{preset.type === 'shakespeare' ? (
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor={`preset-${preset.id}-host`}>
|
||||
Host (Optional)
|
||||
</Label>
|
||||
<Input
|
||||
id={`preset-${preset.id}-host`}
|
||||
placeholder="shakespeare.wtf"
|
||||
value={presetHosts[preset.id] || ''}
|
||||
onChange={(e) => setPresetHosts(prev => ({
|
||||
...prev,
|
||||
[preset.id]: e.target.value,
|
||||
}))}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor={`preset-${preset.id}-baseURL`}>
|
||||
Base URL (Optional)
|
||||
</Label>
|
||||
<Input
|
||||
id={`preset-${preset.id}-baseURL`}
|
||||
placeholder={
|
||||
preset.type === 'netlify' ? 'https://api.netlify.com/api/v1' :
|
||||
'https://api.vercel.com'
|
||||
}
|
||||
value={presetBaseURLs[preset.id] || ''}
|
||||
onChange={(e) => setPresetBaseURLs(prev => ({
|
||||
...prev,
|
||||
[preset.id]: e.target.value,
|
||||
}))}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<Button
|
||||
onClick={() => handleAddPresetProvider(preset)}
|
||||
|
||||
Reference in new issue
Block a user