Skip to content

Server, client, and shortcut for quick share of text between devices

License

Notifications You must be signed in to change notification settings

RobinClaesson/TextShare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Text Share

Text share is a collection of programs and scripts to store and share text with rest API. It can be used to store share text between devices on different platforms and ecosystems, such as Windows and iOS.

Text Share Server

Host a server for Text Share that will store text with Ids. Can be configured to use either HTTP, HTTPS, or both. Also provides a web interface to show stored texts with an option to enable Swagger UI to access API in the interface.

Command line options

Option Short Function
--http-port -p The port to listen for HTTP requests. Default value: '5000'.
--https-port -s The port to listen for HTTPS requests. HTTPS turned of if not set.
--no-http Turn off HTTP. Requires HTTPS port to be set.
--localhost -l Allow connection only from localhost.
--swagger -w Allows direct API access with Swagger UI.
--help Display help text.
--version Display version information.

API

Text Share Server exposes the following REST Api:

Url Method Explanation Example calls & responses
/Text/ListIds GET Get all id's which have stored text.
/Text/ListIds
[Foo, Author]
/Text/ListEntries GET Get all id's with their stored texts.
/Text/ListEntries
[
    { "id": "Author", "text": "Robin Claesson\n" },
    { "id": "Foo", "text": "Bar\nHello World\n" }
]
/Text/Peek/{id} GET Get the text stored with {id}.

Leaves the text on the server

/Text/Peek/Foo
Bar
Hello World
/Text/Pop/{id} GET Get the text stored with {id}.

Deletes the text from the server

/Text/Pop/Foo
Bar
Hello World
/Text/Push POST Stores "text" to "id".

Appends to existing values for {id}.

/Text/Push
{
  "id": "Foo",
  "text": "Bar"
}
Stored text 'Bar' to 'Foo'
/Text/Delete/{id} DELETE Deletes the text stored for {id}.
/Text/Delete/Foo
Text for 'Foo' deleted

Web Interface

The server also have a simple web page to show the currently stored texts.

Text Share Server web interface

Swagger

If the program is launched with the --swagger option set, the API can be access in the web browser with Swagger UI at /swagger/index.html. The Access API link in the web interface leading to this page is only visible if Swagger is enabled.

Text Share Server Swagger interface

TextShareClient

Command line client for performing actions towards a server. Actions can be performed either by selection from a main menu or directly as command line options.

Settings

The settings for the client can be set in settings.json. All of the settings can also be overloaded with command line options.

Setting Function
BaseAddress Base address to server, ex http://localhost:5000.
QuickAccessId The id to use for quick actions in the menu, such as Quck Peek.
CopyValuesToClipboard True if you want the client to copy any peeked/popped values to the clipboard.

Command line actions & options

You can perform the following actions directly with command line arguments:

Verb Usage Function
menu TextShareClient menu [options] Select action from a menu.
peek TextShareClient peek [options] Get text contents stored to . Keeps the text on the server.
pop TextShareClient pop [options] Get text contents stored to . Deletes the text from the server.
push TextShareClient push [options] Stores to .
list-id TextShareClient list-id [options] List all ids.
list-entries TextShareClient list-entries [options] List all entries.
help TextShareClient help [options] Show help text
version TextShareClient version [options] Display version information.

The following command line options are available for all actions:

Option Short Function
--copy -c Copy the text entry to the clipboard. Overloads settings if set.
--quick-access -q Set the quick access id. Overloads settings if set.
--base-address -a Set the base address of the server. Overloads settings if set.
--help Displays the help screen for a given action, ex: TextShareClient pop --help
--version Display version information.

Text Share Siri Shortcut

For people with Iphone/Ipad/Mac can use this Shortcut.

The shortcut can perform the peek, pop, push, and list entries actions and copies the fetched values to the clipboard. It is also also added in the share-menu for quick pushes to an id.

To setup the shortcut change the API adress (first textbox) from http://example.com to the address of your server. Optionally you can also change the Quick-id (second textbox) to alter the id used for items stored with the share-menu.

Text Share Shortcut menu

Build & Run

Built with .NET Core 7.0 & ASP.NET Core.

Run any of the projects directly from source with:

dotnet run [options]

Due to how dotnet works with running from source some short-hand options such as -p does not work, all long option variants does however still work.

To not have to build every time, or to not have dotnet interfere with the options, publish the project and then run:

Windows Linux / Mac
dotnet publish
cd <PUBLISH_PATH> 
./TextShareServer.exe [options]
dotnet publish
cd <PUBLISH_PATH> 
dotnet TextShareServer.dll [options]

About

Server, client, and shortcut for quick share of text between devices

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published