-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
init commit for wordpress tool oauth
- Loading branch information
Showing
7 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { z } from "zod"; | ||
|
||
import { | ||
OAuthAppSpec, | ||
OAuthFormStep, | ||
getOAuthLinks, | ||
} from "~/lib/model/oauthApps/oauth-helpers"; | ||
import { assetUrl } from "~/lib/utils"; | ||
|
||
const schema = z.object({ | ||
clientID: z.string().min(1, "Client ID is required"), | ||
clientSecret: z.string().min(1, "Client Secret is required"), | ||
}); | ||
|
||
const steps: OAuthFormStep<z.infer<typeof schema>>[] = [ | ||
{ | ||
type: "markdown", | ||
text: | ||
"### Step 1: Create a New Application at Developer.wordpress.com:\n" + | ||
"If you already have an app, you can skip to Step 2.\n\n" + | ||
"- Ensure you are logged into your preferred Wordpress.com account.\n" + | ||
"- You can create and manage your apps at the [Apps](https://developer.wordpress.com/apps/) page.\n" + | ||
"- Click **Create New Application** on the top right corner.\n" + | ||
"- Enter a **Name**, **Description**, and **Website** for your application.\n" + | ||
"- Copy the url below and paste it into the **Redirect URL** field.\n", | ||
}, | ||
{ | ||
type: "copy", | ||
text: getOAuthLinks("wordpress").redirectURL, | ||
}, | ||
{ | ||
type: "markdown", | ||
text: | ||
"- Leave **Javascript Origins** blank for now, but you can update it later.\n" + | ||
"- For **Type**, select **Web**.\n" + | ||
"- Click **Create**.\n" + | ||
"- You will be redirected to the **Manage Application** page of the app you just created.\n", | ||
}, | ||
{ | ||
type: "markdown", | ||
text: | ||
"### Step 2: Register your App with Obot\n" + | ||
"- In the **Manage Application** page, you can find the **Client ID** and **Client Secret** in the **OAuth Information** section.\n" + | ||
"- Copy and paste them into the respective fields below.\n", | ||
}, | ||
{ type: "input", input: "clientID", label: "Client ID" }, | ||
{ | ||
type: "input", | ||
input: "clientSecret", | ||
label: "Client Secret", | ||
inputType: "password", | ||
}, | ||
{ | ||
type: "markdown", | ||
text: | ||
"### (Optional) Create a New Site\n" + | ||
"If you don't have a site yet, you can create one by following these steps:\n" + | ||
"- Visit [WordPress Sites](https://wordpress.com/sites).\n" + | ||
"- Click **Add New Site** in the top-right corner, and follow the instructions to create a new site.\n", | ||
}, | ||
]; | ||
|
||
export const WordPressOAuthApp = { | ||
schema, | ||
alias: "wordpress", | ||
type: "wordpress", | ||
displayName: "WordPress", | ||
logo: assetUrl("/assets/wordpress-logo.png"), | ||
steps: steps, | ||
noGatewayIntegration: true, | ||
} satisfies OAuthAppSpec; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.