Skip to content
This repository has been archived by the owner on Jun 22, 2022. It is now read-only.

Commit

Permalink
updated powershell script and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ahsan-a committed Mar 27, 2021
1 parent 0315a3e commit 2bfaf7d
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 20 deletions.
58 changes: 58 additions & 0 deletions Phonelink/Phonelink/assets/installer.iss
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "PhoneLink"
#define MyAppVersion "1.2.0"
#define MyAppPublisher "ahsan-a"
#define MyAppURL "https://github.com/ahsan-a/PhoneLink/"
#define MyAppExeName "Phonelink.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{C4ED68EF-3D75-4F1F-9136-289307056959}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={autopf}\{#MyAppName}
DisableProgramGroupPage=yes
LicenseFile=D:\Users\Ahsan\Downloads\gpl3.txt
InfoBeforeFile=D:\Users\Ahsan\Downloads\before.txt
; Uncomment the following line to run in non administrative install mode (install for current user only.)
;PrivilegesRequired=lowest
OutputDir=D:\Users\Ahsan\Downloads\PhoneLink
OutputBaseFilename=PhoneLink
SetupIconFile=D:\Users\Ahsan\Documents\Programming\C#\PhoneLink\Phonelink\Phonelink\icon.ico
Compression=lzma
SolidCompression=yes
WizardStyle=modern

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Files]
Source: "D:\Users\Ahsan\Documents\Programming\C#\PhoneLink\PhonelinkInstaller\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\Users\Ahsan\Documents\Programming\C#\PhoneLink\PhonelinkInstaller\Mayerch1.GithubUpdateCheck.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\Users\Ahsan\Documents\Programming\C#\PhoneLink\PhonelinkInstaller\Microsoft.Toolkit.Uwp.Notifications.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\Users\Ahsan\Documents\Programming\C#\PhoneLink\PhonelinkInstaller\Microsoft.Toolkit.Uwp.Notifications.pdb"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\Users\Ahsan\Documents\Programming\C#\PhoneLink\PhonelinkInstaller\MimeTypesMap.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\Users\Ahsan\Documents\Programming\C#\PhoneLink\PhonelinkInstaller\Newtonsoft.Json.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\Users\Ahsan\Documents\Programming\C#\PhoneLink\PhonelinkInstaller\Octokit.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\Users\Ahsan\Documents\Programming\C#\PhoneLink\PhonelinkInstaller\Phonelink.exe.Config"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\Users\Ahsan\Documents\Programming\C#\PhoneLink\PhonelinkInstaller\Phonelink.pdb"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\Users\Ahsan\Documents\Programming\C#\PhoneLink\PhonelinkInstaller\Semver.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\Users\Ahsan\Documents\Programming\C#\PhoneLink\PhonelinkInstaller\setup.ps1"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\Users\Ahsan\Documents\Programming\C#\PhoneLink\PhonelinkInstaller\SimpleHTTP.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\Users\Ahsan\Documents\Programming\C#\PhoneLink\PhonelinkInstaller\System.ValueTuple.dll"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

33 changes: 15 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,34 @@ Send links to your computer from your phone, or from any device in your local ne

## Installation

1. Download the latest release, or clone and build with Visual Studio.
2. Change your port inside of your `Phonelink.exe.config` file to whatever you want it to be.
3. inside of the `setup.ps1` file, set your port to whatever it is inside of your config. Save and run the script. It should prompt you to **run as an Administrator**.
4. (Optional, but recommended) Right click the `Phonelink.exe` file and click `Create shortcut`. Rename this to whatever you like, and drag this inside of the `startup` folder. This folder is a shortcut to your startup folder, meaning the application will run at system startup.
5. Run the executable.
6. Download the [iOS Companion Shortcut](https://www.icloud.com/shortcuts/19bfb332f6be4ffd8b5ebcbc55d15cfb) and answer the questions you are prompted to, or edit the texts inside of the actual shortcut. (You can run the `ipconfig` command in powershell to find your ip address).
1. Run the Installer. Then, run the `setup.ps1` file to trust your chosen port, and add it to your firewall. Requests **will not work** if you do not do this. (if you manually installed before I created an installer, please delete your PhoneLink folder from wherever you placed it, and delete your startup shortcut.)
2. Edit your settings by clicking on the icon in your tray. Make sure to change your save location, as it saves it to a folder inside of it's current path by default.
3. Download these shortcuts:
- [Open Link on Computer](https://www.icloud.com/shortcuts/19bfb332f6be4ffd8b5ebcbc55d15cfb)
- [Save File on Computer](https://www.icloud.com/shortcuts/8c3aa77aecb944a9aa4ee5e202ee4bed)

Answer the questions you are prompted to, or edit the texts inside of the actual shortcut. (You can run the `ipconfig` command in powershell to find your IP address).

## Usage

With the shortcut, when you share a link, an option should appear in your share sheet saying "_Open link on computer_". Once clicked, the link should appear on your computer's browser.
When you share a link, an option should show in your share sheet called "Open link on computer". Once clicked, the link should appear on your computer's browser.
When you share a file or image, an option in your share sheet should show called "Save File on Computer". Once clicked, the file should save wherever you specified.

Alternatively, you can make an http request, by using `curl`, `fetch`, or just your browser. I would not reccommend this and i would recommend making an android-alternative to shortcuts, makng a script, etc. The request should look like this:
`http://IP_ADDRESS:PORT/PASSWORD/REQUEST_TYPE/URL`
Alternatively, you can make an HTTP request, I would not reccommend this and i would recommend making an android-alternative to shortcuts, makng a script, etc.

or without your password disabled:
`http://IP_ADDRESS:PORT/REQUEST_TYPE/URL`
### Requests:

Currently, the only valid request type is `url`.
- URL: `http://(IP):(PORT)/(PASSWORD)/url/(URL_ADDRESS)`
- File/Image: `http://(IP):(PORT)/(PASSWORD)/file`. Your file(s) inside of a form-data body. The key can be anything and the value is your file. You can have multiple of these.

an example with a password of `1234`:

`http://192.168.0.69:1234/1234/url/google.com`
(use of http or https in the link isn't required.)

If you run into any problems, contact me on discord, ahsan#4403, or make an issue.

## Configuration

You can configure the port and password in the `Phonelink.exe.config` file, and customise whether you'd like to check for updates and have a password in the right click context menu.

## Updating
~~You can configure the port and password in the `Phonelink.exe.config` file, and customise whether you'd like to check for updates and have a password in the right click context menu.~~

1. Download the self-extracting archive from the releases tab.
2. Extract the files to your current installation location, or just copy and paste them in. Make sure you copy and paste all of the files, or it may not work as intended.
A settings menu is now available by clicking on the PhoneLink icon in the system tray.
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

### 1.2.0 (27/3/2021)

- Added settings UI.
- Added ability to send files
- Created an installer.

### 1.1.0 (24/3/2021)

- Added the ability to check for updates from the github releases tab.
Expand Down
3 changes: 1 addition & 2 deletions setup.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$port = 1234 # Change this number to what you want your port to be. Remember to also change it in your App.Config.
$port = Read-Host "What is your port? (default is 1234)"

if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
Expand All @@ -7,6 +7,5 @@ if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdenti
Break
}

echo "Make sure you are running as Administrator. your current port is $port."
netsh http add urlacl url=http://+:$port/ user="Everyone"
New-NetFirewallRule -DisplayName "Phonelink" -Direction Inbound -LocalPort $port -Protocol TCP -Action Allow

0 comments on commit 2bfaf7d

Please sign in to comment.