From 73e61f48bd04e18e4ffb22d50eaa301f143ca820 Mon Sep 17 00:00:00 2001 From: crschnick Date: Sat, 13 Jul 2024 06:56:22 +0000 Subject: [PATCH] Move ptb auth file --- .../io/xpipe/app/resources/misc/api.md | 13 ++++++++++-- .../io/xpipe/core/util/XPipeInstallation.java | 2 +- openapi.yaml | 21 +++++++++++++++---- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/app/src/main/resources/io/xpipe/app/resources/misc/api.md b/app/src/main/resources/io/xpipe/app/resources/misc/api.md index 032417a5d..e0361cee1 100644 --- a/app/src/main/resources/io/xpipe/app/resources/misc/api.md +++ b/app/src/main/resources/io/xpipe/app/resources/misc/api.md @@ -3535,7 +3535,7 @@ xor |Name|Type|Required|Restrictions|Description| |---|---|---|---|---| -|*anonymous*|[Local](#schemalocal)|false|none|Authentication method for local applications. Uses file system access as proof of authentication.| +|*anonymous*|[Local](#schemalocal)|false|none|Authentication method for local applications. Uses file system access as proof of authentication.

You can find the authentication file at:
- %TEMP%\xpipe_auth on Windows
- $TMP/xpipe_auth on Linux
- $TMPDIR/xpipe_auth on macOS

For the PTB releases the file name is changed to xpipe_ptb_auth to prevent collisions.

As the temporary directory on Linux is global, the daemon might run as another user and your current user might not have permissions to access the auth file.|

ApiKey

@@ -3578,12 +3578,21 @@ API key authentication Authentication method for local applications. Uses file system access as proof of authentication. +You can find the authentication file at: +- %TEMP%\xpipe_auth on Windows +- $TMP/xpipe_auth on Linux +- $TMPDIR/xpipe_auth on macOS + +For the PTB releases the file name is changed to xpipe_ptb_auth to prevent collisions. + +As the temporary directory on Linux is global, the daemon might run as another user and your current user might not have permissions to access the auth file. +

Properties

|Name|Type|Required|Restrictions|Description| |---|---|---|---|---| |type|string|true|none|none| -|authFileContent|string|true|none|The contents of the local file $TEMP/xpipe_auth. This file is automatically generated when XPipe starts.| +|authFileContent|string|true|none|The contents of the local file /xpipe_auth. This file is automatically generated when XPipe starts.|

ClientInformation

diff --git a/core/src/main/java/io/xpipe/core/util/XPipeInstallation.java b/core/src/main/java/io/xpipe/core/util/XPipeInstallation.java index b5557c39a..09b0e8994 100644 --- a/core/src/main/java/io/xpipe/core/util/XPipeInstallation.java +++ b/core/src/main/java/io/xpipe/core/util/XPipeInstallation.java @@ -32,7 +32,7 @@ public class XPipeInstallation { } public static Path getLocalBeaconAuthFile() { - return Path.of(System.getProperty("java.io.tmpdir"), "xpipe_auth"); + return Path.of(System.getProperty("java.io.tmpdir"), isStaging() ? "xpipe_ptb_auth" : "xpipe_auth"); } public static String createExternalAsyncLaunchCommand( diff --git a/openapi.yaml b/openapi.yaml index d8547f806..1d77e7a5f 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -55,11 +55,14 @@ paths: $ref: '#/components/schemas/HandshakeRequest' examples: standard: - summary: Standard handshake + summary: API key handshake value: { "auth": { "type": "ApiKey", "key": "" }, "client": { "type": "Api", "name": "My client name" } } local: summary: Local application handshake - value: { "auth": { "type": "Local", "authFileContent": "" }, "client": { "type": "Api", "name": "My client name" } } + value: { "auth": { "type": "Local", "authFileContent": "/xpipe_auth>" }, "client": { "type": "Api", "name": "My client name" } } + local-ptb: + summary: Local PTB application handshake + value: { "auth": { "type": "Local", "authFileContent": "/xpipe_ptb_auth>" }, "client": { "type": "Api", "name": "My client name" } } responses: '200': description: The handshake was successful. The returned token can be used for authentication in this session. The token is valid as long as XPipe is running. @@ -966,14 +969,24 @@ components: - key - type Local: - description: Authentication method for local applications. Uses file system access as proof of authentication. + description: | + Authentication method for local applications. Uses file system access as proof of authentication. + + You can find the authentication file at: + - %TEMP%\xpipe_auth on Windows + - $TMP/xpipe_auth on Linux + - $TMPDIR/xpipe_auth on macOS + + For the PTB releases the file name is changed to xpipe_ptb_auth to prevent collisions. + + As the temporary directory on Linux is global, the daemon might run as another user and your current user might not have permissions to access the auth file. type: object properties: type: type: string authFileContent: type: string - description: The contents of the local file $TEMP/xpipe_auth. This file is automatically generated when XPipe starts. + description: The contents of the local file /xpipe_auth. This file is automatically generated when XPipe starts. required: - authFileContent - type