Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const DAY_MS = HOUR_MS * 24;

// OAuth constants
export const CLIENT_ID = '95109';
export const PROTOCOL_PREFIX = 'wpcom-local-dev';
export const PROTOCOL_PREFIX = 'wp-studio';

export const LOCKFILE_NAME = 'appdata-v1.json.lock';
export const LOCKFILE_STALE_TIME = 5000;
Expand Down
4 changes: 2 additions & 2 deletions common/lib/tests/oauth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ describe( 'getAuthenticationUrl', () => {
const result = getAuthenticationUrl( 'en' );

expect( result ).toBe(
'https://public-api.wordpress.com/oauth2/authorize?response_type=token&client_id=95109&redirect_uri=wpcom-local-dev%3A%2F%2Fauth&scope=global&locale=en'
'https://public-api.wordpress.com/oauth2/authorize?response_type=token&client_id=95109&redirect_uri=wp-studio%3A%2F%2Fauth&scope=global&locale=en'
);
} );

it( 'should generate correct authentication URL with other locales', () => {
const result = getAuthenticationUrl( 'es' );

expect( result ).toBe(
'https://public-api.wordpress.com/oauth2/authorize?response_type=token&client_id=95109&redirect_uri=wpcom-local-dev%3A%2F%2Fauth&scope=global&locale=es'
'https://public-api.wordpress.com/oauth2/authorize?response_type=token&client_id=95109&redirect_uri=wp-studio%3A%2F%2Fauth&scope=global&locale=es'
);
} );
} );
4 changes: 2 additions & 2 deletions docs/linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ For easier access, you can create a desktop entry file that will add Studio to y
Exec=<absolute-path-to-repo>/out/Studio-linux-x64/studio %U
Type=Application
Terminal=false
MimeType=x-scheme-handler/wpcom-local-dev;
MimeType=x-scheme-handler/wp-studio;
Categories=Development;
```

Expand All @@ -93,7 +93,7 @@ For easier access, you can create a desktop entry file that will add Studio to y
update-desktop-database ~/.local/share/applications
```

Studio should now appear in your application launcher and can handle `wpcom-local-dev://` protocol URLs.
Studio should now appear in your application launcher and can handle `wp-studio://` protocol URLs.

## Running with Wayland

Expand Down
6 changes: 3 additions & 3 deletions src/lib/deeplink/deeplink-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { handleSyncConnectSiteDeeplink } from 'src/lib/deeplink/handlers/sync-co
/**
* Main deeplink handler that routes incoming deeplinks to the appropriate handler.
* Supports the following deeplink schemes:
* - wpcom-local-dev://auth - OAuth authentication callback
* - wpcom-local-dev://sync-connect-site - Sync site connection from WordPress.com
* - wpcom-local-dev://add-site?blueprint_url=<encoded-url> - Add site with blueprint from URL
* - wp-studio://auth - OAuth authentication callback
* - wp-studio://sync-connect-site - Sync site connection from WordPress.com
* - wp-studio://add-site?blueprint_url=<encoded-url> - Add site with blueprint from URL
*/
export async function handleDeeplink( url: string ): Promise< void > {
const urlObject = new URL( url );
Expand Down
2 changes: 1 addition & 1 deletion src/lib/deeplink/handlers/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async function handleAuthCallback( hash: string ): Promise< StoredToken > {
/**
* Handles the OAuth authentication deeplink callback.
* This function is called when the user completes authentication on WordPress.com
* and is redirected back to the app via wpcom-local-dev://auth
* and is redirected back to the app via wp-studio://auth
*/
export async function handleAuthDeeplink( urlObject: URL ): Promise< void > {
const { hash } = urlObject;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/deeplink/handlers/sync-connect-site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { sendIpcEventToRenderer } from 'src/ipc-utils';
/**
* Handles the sync-connect-site deeplink callback.
* This function is called when a user initiates a sync connection from WordPress.com
* and is redirected back to the app via wpcom-local-dev://sync-connect-site
* and is redirected back to the app via wp-studio://sync-connect-site
*/
export async function handleSyncConnectSiteDeeplink( urlObject: URL ): Promise< void > {
const { searchParams } = urlObject;
Expand Down
8 changes: 4 additions & 4 deletions src/lib/deeplink/tests/auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe( 'handleAuthDeeplink', () => {
req: { get: mockWpcomGet },
} as unknown as WPCOM );

const url = new URL( 'wpcom-local-dev://auth#access_token=mock-token&expires_in=3600' );
const url = new URL( 'wp-studio://auth#access_token=mock-token&expires_in=3600' );
await handleAuthDeeplink( url );

expect( sendIpcEventToRenderer ).toHaveBeenCalledWith( 'auth-updated', {
Expand All @@ -49,7 +49,7 @@ describe( 'handleAuthDeeplink', () => {
} );

it( 'should handle authentication error from WordPress.com', async () => {
const url = new URL( 'wpcom-local-dev://auth#error=access_denied' );
const url = new URL( 'wp-studio://auth#error=access_denied' );
await handleAuthDeeplink( url );

expect( sendIpcEventToRenderer ).toHaveBeenCalledWith( 'auth-updated', {
Expand All @@ -59,7 +59,7 @@ describe( 'handleAuthDeeplink', () => {
} );

it( 'should handle invalid token response', async () => {
const url = new URL( 'wpcom-local-dev://auth#access_token=mock-token&expires_in=invalid' );
const url = new URL( 'wp-studio://auth#access_token=mock-token&expires_in=invalid' );
await handleAuthDeeplink( url );

expect( sendIpcEventToRenderer ).toHaveBeenCalledWith( 'auth-updated', {
Expand All @@ -74,7 +74,7 @@ describe( 'handleAuthDeeplink', () => {
req: { get: mockWpcomGet },
} as unknown as WPCOM );

const url = new URL( 'wpcom-local-dev://auth#access_token=mock-token&expires_in=3600' );
const url = new URL( 'wp-studio://auth#access_token=mock-token&expires_in=3600' );
await handleAuthDeeplink( url );

expect( sendIpcEventToRenderer ).toHaveBeenCalledWith( 'auth-updated', {
Expand Down
6 changes: 2 additions & 4 deletions src/lib/deeplink/tests/sync-connect-site.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ describe( 'handleSyncConnectSiteDeeplink', () => {
} );

it( 'should handle sync connect site callback', async () => {
const url = new URL(
'wpcom-local-dev://sync-connect-site?remoteSiteId=123&studioSiteId=local-site'
);
const url = new URL( 'wp-studio://sync-connect-site?remoteSiteId=123&studioSiteId=local-site' );
await handleSyncConnectSiteDeeplink( url );

expect( sendIpcEventToRenderer ).toHaveBeenCalledWith( 'sync-connect-site', {
Expand All @@ -24,7 +22,7 @@ describe( 'handleSyncConnectSiteDeeplink', () => {
} );

it( 'should not send sync connect site event if parameters are missing', async () => {
const url = new URL( 'wpcom-local-dev://sync-connect-site?remoteSiteId=123' );
const url = new URL( 'wp-studio://sync-connect-site?remoteSiteId=123' );
await handleSyncConnectSiteDeeplink( url );

expect( sendIpcEventToRenderer ).not.toHaveBeenCalled();
Expand Down
2 changes: 1 addition & 1 deletion src/lib/tests/oauth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe( 'getSignUpUrl', () => {
it( 'should include encoded authentication URL as oauth2_redirect parameter', () => {
const locale: SupportedLocale = 'es';
const mockAuthUrl =
'https://public-api.wordpress.com/oauth2/authorize?response_type=token&client_id=95109&redirect_uri=wpcom-local-dev%3A%2F%2Fauth&scope=global&locale=es';
'https://public-api.wordpress.com/oauth2/authorize?response_type=token&client_id=95109&redirect_uri=wp-studio%3A%2F%2Fauth&scope=global&locale=es';
const result = getSignUpUrl( locale );

const url = new URL( result );
Expand Down
2 changes: 1 addition & 1 deletion src/tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe( 'App initialization', () => {
require( '../index' );
const { 'open-url': openUrl } = mockedEvents;

const testUrl = 'wpcom-local-dev://auth#test-hash';
const testUrl = 'wp-studio://auth#test-hash';
await openUrl( {}, testUrl );
expect( mockHandleDeeplink ).toHaveBeenCalledWith( testUrl );

Expand Down