mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Remove excess deploy fields, add baseURL
This commit is contained in:
7 files changed
+178
-265
No files matched your search
@@ -22,9 +22,11 @@ interface NetlifyBuildResponse {
|
||||
*/
|
||||
export class NetlifyAdapter implements DeployAdapter {
|
||||
private config: NetlifyDeployConfig;
|
||||
private baseURL: string;
|
||||
|
||||
constructor(config: NetlifyDeployConfig) {
|
||||
this.config = config;
|
||||
this.baseURL = config.baseURL || 'https://api.netlify.com/api/v1';
|
||||
}
|
||||
|
||||
async deploy(options: DeployOptions): Promise<DeployResult> {
|
||||
@@ -74,7 +76,7 @@ export class NetlifyAdapter implements DeployAdapter {
|
||||
}
|
||||
|
||||
private async createSite(apiKey: string, name: string): Promise<NetlifySite> {
|
||||
const response = await fetch('https://api.netlify.com/api/v1/sites', {
|
||||
const response = await fetch(`${this.baseURL}/sites`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': `Bearer ${apiKey}`,
|
||||
@@ -95,7 +97,7 @@ export class NetlifyAdapter implements DeployAdapter {
|
||||
}
|
||||
|
||||
private async getSite(apiKey: string, siteId: string): Promise<NetlifySite> {
|
||||
const response = await fetch(`https://api.netlify.com/api/v1/sites/${siteId}`, {
|
||||
const response = await fetch(`${this.baseURL}/sites/${siteId}`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Authorization': `Bearer ${apiKey}`,
|
||||
@@ -111,7 +113,7 @@ export class NetlifyAdapter implements DeployAdapter {
|
||||
}
|
||||
|
||||
private async triggerDeploy(apiKey: string, siteId: string, zipBlob: Blob): Promise<NetlifyBuildResponse> {
|
||||
const response = await fetch(`https://api.netlify.com/api/v1/sites/${siteId}/deploys`, {
|
||||
const response = await fetch(`${this.baseURL}/sites/${siteId}/deploys`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': `Bearer ${apiKey}`,
|
||||
|
||||
@@ -8,9 +8,11 @@ import type { DeployAdapter, DeployOptions, DeployResult, ShakespeareDeployConfi
|
||||
*/
|
||||
export class ShakespeareAdapter implements DeployAdapter {
|
||||
private config: ShakespeareDeployConfig;
|
||||
private baseURL: string;
|
||||
|
||||
constructor(config: ShakespeareDeployConfig) {
|
||||
this.config = config;
|
||||
this.baseURL = config.baseURL || 'https://shakespeare.wtf';
|
||||
}
|
||||
|
||||
async deploy(options: DeployOptions): Promise<DeployResult> {
|
||||
@@ -19,7 +21,7 @@ export class ShakespeareAdapter implements DeployAdapter {
|
||||
|
||||
// Use custom hostname if provided, otherwise construct from projectId.deployServer
|
||||
const hostname = customHostname || `${projectId}.${deployServer}`;
|
||||
const deployUrl = `https://${deployServer}/deploy`;
|
||||
const deployUrl = `${this.baseURL}/deploy`;
|
||||
const siteUrl = `https://${hostname}`;
|
||||
|
||||
// Check if dist directory exists and contains index.html
|
||||
|
||||
@@ -18,9 +18,11 @@ interface VercelDeployment {
|
||||
*/
|
||||
export class VercelAdapter implements DeployAdapter {
|
||||
private config: VercelDeployConfig;
|
||||
private baseURL: string;
|
||||
|
||||
constructor(config: VercelDeployConfig) {
|
||||
this.config = config;
|
||||
this.baseURL = config.baseURL || 'https://api.vercel.com';
|
||||
}
|
||||
|
||||
async deploy(options: DeployOptions): Promise<DeployResult> {
|
||||
@@ -50,7 +52,7 @@ export class VercelAdapter implements DeployAdapter {
|
||||
};
|
||||
|
||||
// Build API URL with optional team parameter
|
||||
let apiUrl = 'https://api.vercel.com/v13/deployments';
|
||||
let apiUrl = `${this.baseURL}/v13/deployments`;
|
||||
if (teamId) {
|
||||
apiUrl += `?teamId=${teamId}`;
|
||||
}
|
||||
|
||||
@@ -28,12 +28,14 @@ export interface ShakespeareDeployConfig {
|
||||
signer: NostrSigner;
|
||||
deployServer?: string;
|
||||
customHostname?: string;
|
||||
baseURL?: string;
|
||||
}
|
||||
|
||||
export interface NetlifyDeployConfig {
|
||||
apiKey: string;
|
||||
siteId?: string;
|
||||
siteName?: string;
|
||||
baseURL?: string;
|
||||
}
|
||||
|
||||
export interface VercelDeployConfig {
|
||||
@@ -41,4 +43,5 @@ export interface VercelDeployConfig {
|
||||
projectId?: string;
|
||||
teamId?: string;
|
||||
projectName?: string;
|
||||
baseURL?: string;
|
||||
}
|
||||
Reference in new issue
Block a user