Merge pull request #1299 from amitpanwar789/desktopApp

PR for desktop app
This commit is contained in:
KoalaSat 2024-09-05 19:46:03 +00:00 committed by GitHub
commit 612f1cc51e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
67 changed files with 520619 additions and 19 deletions

139
.github/workflows/desktop-build.yml vendored Normal file
View File

@ -0,0 +1,139 @@
name: "Build: Desktop"
on:
workflow_dispatch:
workflow_call:
inputs:
semver:
required: true
type: string
push:
branches: [ "main" ]
paths: [ "desktopApp", "frontend" ]
pull_request:
branches: [ "main" ]
paths: [ "desktopApp", "frontend" ]
jobs:
build-desktop:
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install dependencies
run: |
cd desktopApp
npm install
- name: Install zip utility
run: |
apt-get update
apt-get install -y zip
- name: Build for macOS
run: |
cd desktopApp
npm run package-mac
- name: Build for Windows
run: |
cd desktopApp
npm run package-win
- name: Build for Linux
run: |
cd desktopApp
npm run package-linux
- name: Create ZIP for macOS Build
run: |
cd desktopApp/release-builds/
zip -r /desktopApp-mac.zip ./Robosats-darwin-x64/*
- name: Create ZIP for Windows Build
run: |
cd desktopApp/release-builds/
zip -r /desktopApp-win.zip ./Robosats-win32-ia32/*
- name: Create ZIP for Linux Build
run: |
cd desktopApp/release-builds/
zip -r /desktopApp-linux.zip ./Robosats-linux-x64/*
- name: 'Get Commit Hash'
id: commit
uses: pr-mpt/actions-commit-hash@v3
- name: 'Upload mac-build Release Artifact (for Release)'
uses: actions/upload-artifact@v4
if: inputs.semver != '' # only if this workflow is called from a push to tag (a Release)
with:
name: robosats-desktop-${{ inputs.semver }}-mac.zip
path: desktopApp/release-builds/desktopApp-mac.zip
- name: 'Upload linux-build Release Artifact (for Release)'
uses: actions/upload-artifact@v4
if: inputs.semver != '' # only if this workflow is called from a push to tag (a Release)
with:
name: robosats-desktop-${{ inputs.semver }}-linux.zip
path: desktopApp/release-builds/desktopApp-linux.zip
- name: 'Upload win-build Release Artifact (for Release)'
uses: actions/upload-artifact@v4
if: inputs.semver != '' # only if this workflow is called from a push to tag (a Release)
with:
name: robosats-desktop-${{ inputs.semver }}-win.zip
path: desktopApp/release-builds/desktopApp-win.zip
- name: Create Pre-release
id: create_release
if: inputs.semver == '' # only if this workflow is not called from a push to tag (a Release)
uses: ncipollo/release-action@v1.13.0
with:
tag: desktop-${{ steps.commit.outputs.short }}
name: robosats-desktop-${{ steps.commit.outputs.short }}
prerelease: true
- name: Upload macOS Build Artifact
id: upload-release-mac-zip-asset
if: inputs.semver == '' # only if this workflow is not called from a push to tag (a Release)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /desktopApp-mac.zip
asset_name: robosats-desktop-${{ steps.commit.outputs.short }}-mac.zip
asset_content_type: application/zip
- name: Upload Windows Build Artifact
id: upload-release-win-zip-asset
if: inputs.semver == '' # only if this workflow is not called from a push to tag (a Release)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /desktopApp-win.zip
asset_name: robosats-desktop-${{ steps.commit.outputs.short }}-win.zip
asset_content_type: application/zip
- name: Upload Linux Build Artifact
id: upload-release-linux-zip-asset
if: inputs.semver == '' # only if this workflow is not called from a push to tag (a Release)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /desktopApp-linux.zip
asset_name: robosats-desktop-${{ steps.commit.outputs.short }}-linux.zip
asset_content_type: application/zip

View File

@ -74,9 +74,16 @@ jobs:
secrets: inherit
with:
semver: ${{ needs.check-versions.outputs.semver }}
desktop-build:
uses: RoboSats/robosats/.github/workflows/desktop-build.yml@main
needs: [frontend-build, check-versions]
secrets: inherit
with:
semver: ${{ needs.check-versions.outputs.semver }}
release:
needs: [check-versions, integration-tests, coordinator-image, selfhosted-client-image, web-client-image, android-build]
needs: [check-versions, integration-tests, coordinator-image, selfhosted-client-image, web-client-image, android-build, desktop-build]
runs-on: ubuntu-latest
steps:
- name: Checkout
@ -171,4 +178,52 @@ jobs:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: app-x86-release.apk
asset_name: robosats-${{ needs.check-versions.outputs.semver }}-x86.apk
asset_content_type: application/apk
asset_content_type: application/apk
- name: 'Download macOS Build Artifact'
uses: actions/download-artifact@v4
with:
name: robosats-desktop-${{ needs.check-versions.outputs.semver }}-mac.zip
path: .
- name: 'Upload macOS Build Artifact'
id: upload-release-mac-zip-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: desktopApp-mac.zip
asset_name: robosats-desktop-${{ needs.check-versions.outputs.semver }}-mac.zip
asset_content_type: application/zip
- name: 'Download linux Build Artifact'
uses: actions/download-artifact@v4
with:
name: robosats-desktop-${{ needs.check-versions.outputs.semver }}-linux.zip
path: .
- name: 'Upload linux Build Artifact'
id: upload-release-linux-zip-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: desktopApp-linux.zip
asset_name: robosats-desktop-${{ needs.check-versions.outputs.semver }}-linux.zip
asset_content_type: application/zip
- name: 'Download window Build Artifact'
uses: actions/download-artifact@v4
with:
name: robosats-desktop-${{ needs.check-versions.outputs.semver }}-win.zip
path: .
- name: 'Upload macOS Build Artifact'
id: upload-release-win-zip-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: desktopApp-win.zip
asset_name: robosats-desktop-${{ needs.check-versions.outputs.semver }}-win.zip
asset_content_type: application/zip

41
desktopApp/Readme.md Normal file
View File

@ -0,0 +1,41 @@
# RoboSats Desktop App
RoboSats desktop app serves the RoboSats frontend app directly and redirects all API requests to RoboSats P2P market coordinator through your TOR proxy.
## How to Use
### Step 1: Clone the Repository
First, clone the repository to your local machine:
```bash
git clone https://github.com/RoboSats/robosats.git
cd robosats
```
### Step 2: Install Dependencies
```bash
cd desktopApp
npm install
```
### Step 3: Run the App Locally
```bash
npm run start
```
### Step 4: Package the App
To package the app for different platforms (Linux, Windows, macOS), use the corresponding npm commands:
```bash
npm run package-linux
npm run package-win
npm run package-mac
```
### Additional Information
This desktop app ensures all API requests are redirected through a TOR proxy to maintain privacy and anonymity while accessing the RoboSats P2P market coordinator.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -0,0 +1,133 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="256px" height="256px" viewBox="0 0 256 256" enable-background="new 0 0 256 256" xml:space="preserve">
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="128" y1="256" x2="128" y2="0">
<stop offset="0.1269" style="stop-color:#CCCCCC"/>
<stop offset="0.2947" style="stop-color:#E1E1E1"/>
<stop offset="0.4889" style="stop-color:#FFFFFF"/>
</linearGradient>
<rect fill="url(#SVGID_1_)" width="256" height="256"/>
<g>
<g>
<g>
<g>
<g>
<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="-2.2432" y1="60.3643" x2="167.041" y2="264.634" gradientTransform="matrix(0.9999 -0.0101 0.0101 0.9999 1.9865 13.6532)">
<stop offset="0.3295" style="stop-color:#1976D2"/>
<stop offset="0.4214" style="stop-color:#2E69CC"/>
<stop offset="0.6106" style="stop-color:#6548BE"/>
<stop offset="0.7834" style="stop-color:#9C27B0"/>
</linearGradient>
<path fill="url(#SVGID_2_)" d="M65.814,152.139c0.91,0.784,1.91,1.396,2.96,1.85c-1.711-1.462-3.403-2.891-5.073-4.277
C64.274,150.59,64.974,151.414,65.814,152.139z"/>
<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="-2.2031" y1="60.4131" x2="167.0789" y2="264.6803" gradientTransform="matrix(0.9999 -0.0101 0.0101 0.9999 1.9865 13.6532)">
<stop offset="0.3295" style="stop-color:#1976D2"/>
<stop offset="0.4214" style="stop-color:#2E69CC"/>
<stop offset="0.6106" style="stop-color:#6548BE"/>
<stop offset="0.7834" style="stop-color:#9C27B0"/>
</linearGradient>
<path fill="url(#SVGID_3_)" d="M65.814,152.139c0.91,0.784,1.91,1.396,2.96,1.85c-1.711-1.462-3.403-2.891-5.073-4.277
C64.274,150.59,64.974,151.414,65.814,152.139z"/>
<linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="-1.457" y1="44.2812" x2="188.127" y2="273.0462" gradientTransform="matrix(0.9999 -0.0101 0.0101 0.9999 1.9865 13.6532)">
<stop offset="0.3295" style="stop-color:#1976D2"/>
<stop offset="0.4214" style="stop-color:#2E69CC"/>
<stop offset="0.6106" style="stop-color:#6548BE"/>
<stop offset="0.7834" style="stop-color:#9C27B0"/>
</linearGradient>
<path fill="url(#SVGID_4_)" d="M82.001,151.025c4.159-4.727,3.658-11.9-1.122-16.016c-4.78-4.117-12.026-3.62-16.188,1.109
c-3.428,3.899-3.682,9.45-0.99,13.592c1.67,1.387,3.362,2.815,5.073,4.277C73.242,155.909,78.634,154.855,82.001,151.025z"/>
<linearGradient id="SVGID_5_" gradientUnits="userSpaceOnUse" x1="6.127" y1="53.4326" x2="175.4021" y2="257.6916" gradientTransform="matrix(0.9999 -0.0101 0.0101 0.9999 1.9865 13.6532)">
<stop offset="0.3295" style="stop-color:#1976D2"/>
<stop offset="0.4214" style="stop-color:#2E69CC"/>
<stop offset="0.6106" style="stop-color:#6548BE"/>
<stop offset="0.7834" style="stop-color:#9C27B0"/>
</linearGradient>
<path fill="url(#SVGID_5_)" d="M82.001,151.025c4.159-4.727,3.658-11.9-1.122-16.016c-4.78-4.117-12.026-3.62-16.188,1.109
c-3.428,3.899-3.682,9.45-0.99,13.592c1.67,1.387,3.362,2.815,5.073,4.277C73.242,155.909,78.634,154.855,82.001,151.025z"/>
<linearGradient id="SVGID_6_" gradientUnits="userSpaceOnUse" x1="6.166" y1="53.4805" x2="175.4397" y2="257.7377" gradientTransform="matrix(0.9999 -0.0101 0.0101 0.9999 1.9865 13.6532)">
<stop offset="0.3295" style="stop-color:#1976D2"/>
<stop offset="0.4214" style="stop-color:#2E69CC"/>
<stop offset="0.6106" style="stop-color:#6548BE"/>
<stop offset="0.7834" style="stop-color:#9C27B0"/>
</linearGradient>
<path fill="url(#SVGID_6_)" d="M82.001,151.025c4.159-4.727,3.658-11.9-1.122-16.016c-4.78-4.117-12.026-3.62-16.188,1.109
c-3.428,3.899-3.682,9.45-0.99,13.592c1.67,1.387,3.362,2.815,5.073,4.277C73.242,155.909,78.634,154.855,82.001,151.025z"/>
<linearGradient id="SVGID_7_" gradientUnits="userSpaceOnUse" x1="6.5864" y1="37.6182" x2="196.1729" y2="266.3862" gradientTransform="matrix(0.9999 -0.0101 0.0101 0.9999 1.9865 13.6532)">
<stop offset="0.3295" style="stop-color:#1976D2"/>
<stop offset="0.4214" style="stop-color:#2E69CC"/>
<stop offset="0.6106" style="stop-color:#6548BE"/>
<stop offset="0.7834" style="stop-color:#9C27B0"/>
</linearGradient>
<path fill="url(#SVGID_7_)" d="M131.52,178.628c-4.778-4.118-12.026-3.625-16.188,1.107
c-4.159,4.729-3.654,11.902,1.124,16.021c4.779,4.114,12.028,3.62,16.185-1.113
C136.801,189.911,136.299,182.742,131.52,178.628z"/>
<linearGradient id="SVGID_8_" gradientUnits="userSpaceOnUse" x1="14.1919" y1="46.7949" x2="183.4888" y2="251.0801" gradientTransform="matrix(0.9999 -0.0101 0.0101 0.9999 1.9865 13.6532)">
<stop offset="0.3295" style="stop-color:#1976D2"/>
<stop offset="0.4214" style="stop-color:#2E69CC"/>
<stop offset="0.6106" style="stop-color:#6548BE"/>
<stop offset="0.7834" style="stop-color:#9C27B0"/>
</linearGradient>
<path fill="url(#SVGID_8_)" d="M131.52,178.628c-4.778-4.118-12.026-3.625-16.188,1.107
c-4.159,4.729-3.654,11.902,1.124,16.021c4.779,4.114,12.028,3.62,16.185-1.113
C136.801,189.911,136.299,182.742,131.52,178.628z"/>
<linearGradient id="SVGID_9_" gradientUnits="userSpaceOnUse" x1="14.2378" y1="46.8506" x2="183.5231" y2="251.1217" gradientTransform="matrix(0.9999 -0.0101 0.0101 0.9999 1.9865 13.6532)">
<stop offset="0.3295" style="stop-color:#1976D2"/>
<stop offset="0.4214" style="stop-color:#2E69CC"/>
<stop offset="0.6106" style="stop-color:#6548BE"/>
<stop offset="0.7834" style="stop-color:#9C27B0"/>
</linearGradient>
<path fill="url(#SVGID_9_)" d="M131.52,178.628c-4.778-4.118-12.026-3.625-16.188,1.107
c-4.159,4.729-3.654,11.902,1.124,16.021c4.779,4.114,12.028,3.62,16.185-1.113
C136.801,189.911,136.299,182.742,131.52,178.628z"/>
</g>
<linearGradient id="SVGID_10_" gradientUnits="userSpaceOnUse" x1="-56.7104" y1="46.0752" x2="181.1495" y2="333.0932" gradientTransform="matrix(0.9999 -0.0101 0.0101 0.9999 1.9865 13.6532)">
<stop offset="0.3295" style="stop-color:#1976D2"/>
<stop offset="0.4214" style="stop-color:#2E69CC"/>
<stop offset="0.6106" style="stop-color:#6548BE"/>
<stop offset="0.7834" style="stop-color:#9C27B0"/>
</linearGradient>
<path fill="url(#SVGID_10_)" d="M47.215,171.653c-0.005,7.697-0.009,15.186-0.014,22.144c2.244-2.067,4.739-4.303,7.153-6.622
c0.744-0.719,1.28-0.813,2.038-0.109c1.297,1.197,2.635,2.35,4.001,3.56c1.243-1.401,2.409-2.72,3.618-4.084
C58.394,181.564,52.874,176.668,47.215,171.653z"/>
<linearGradient id="SVGID_11_" gradientUnits="userSpaceOnUse" x1="-71.7656" y1="17.4062" x2="178.9234" y2="319.9048" gradientTransform="matrix(0.9999 -0.0101 0.0101 0.9999 1.9865 13.6532)">
<stop offset="0.3295" style="stop-color:#1976D2"/>
<stop offset="0.4214" style="stop-color:#2E69CC"/>
<stop offset="0.6106" style="stop-color:#6548BE"/>
<stop offset="0.7834" style="stop-color:#9C27B0"/>
</linearGradient>
<path fill="url(#SVGID_11_)" d="M96.606,215.496c-5.554-4.934-10.928-9.709-16.356-14.536c-1.225,1.39-2.362,2.679-3.551,4.024
c1.533,1.378,2.997,2.693,4.539,4.078c-2.06,2.116-4.067,4.186-6.239,6.42C82.293,215.486,89.327,215.491,96.606,215.496z"/>
<linearGradient id="SVGID_12_" gradientUnits="userSpaceOnUse" x1="48.644" y1="2.749" x2="238.2449" y2="231.5344" gradientTransform="matrix(0.9999 -0.0101 0.0101 0.9999 1.9865 13.6532)">
<stop offset="0.3295" style="stop-color:#1976D2"/>
<stop offset="0.4214" style="stop-color:#2E69CC"/>
<stop offset="0.6106" style="stop-color:#6548BE"/>
<stop offset="0.7834" style="stop-color:#9C27B0"/>
</linearGradient>
<path fill="url(#SVGID_12_)" d="M151.123,140.642c4.551-2.31,8.836-5.034,12.748-8.313c7.891-6.625,13.992-14.499,16.895-24.56
c2.469-8.565,3.027-17.312,2.158-26.142c-0.596-6.125-2.252-11.961-5.594-17.219c-7.176-11.29-17.574-18.036-30.375-21.218
c-8.9-2.214-18.036-2.651-27.165-2.687c-23.748-0.088-47.498-0.055-71.249-0.067c-0.423-0.001-0.847,0.036-1.287,0.056
c-0.015,24.535-0.031,48.95-0.046,73.32c15.731-11.838,31.863-14.195,48.42-2.57c2.176-2.02,4.324-4.011,6.562-6.088
c-2.269-1.653-4.427-3.226-6.688-4.872c5.694-4.126,11.212-8.121,16.712-12.105c-1.47-3.392-0.892-6.063,1.599-7.667
c2.145-1.383,5.17-0.997,6.868,0.874c1.745,1.923,1.889,4.86,0.337,6.912c-1.768,2.34-4.548,2.716-7.774,0.995
c-2.781,3.42-5.572,6.854-8.424,10.36c2.357,1.672,4.611,3.269,6.938,4.919c-4.579,3.08-9.056,6.089-13.548,9.107
c0.167,0.201,0.234,0.306,0.324,0.386c16.396,14.547,32.791,29.093,49.197,43.631c3.506,3.105,7.074,6.147,9.555,10.212
c6.645,10.863,7.08,22.205,2.514,33.884c-2.002,5.131-5.035,9.634-9.098,13.737c19.465,0.012,38.66,0.024,58.096,0.036
c-19.633-24.874-39.131-49.577-58.684-74.348C150.508,140.993,150.805,140.802,151.123,140.642z"/>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 9.1 KiB

63
desktopApp/index.html Normal file
View File

@ -0,0 +1,63 @@
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" type="image/png" href="./static/assets/images/favicon-96x96.png" />
<link rel="icon" type="image/png" href="./static/assets/images/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="./static/assets/images/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="./static/assets/images/favicon-192x192.png" sizes="192x192">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="A simple and private way to exchange bitcoin for national currencies. Robosats simplifies the peer-to-peer user experience and uses lightning hold invoices to minimize custody and trust requirements. No user registration required.">
<title>RoboSats - Simple and Private Bitcoin Exchange</title>
<link rel="stylesheet" type="text/css" href="./static/css/fonts.css"/>
<link rel="stylesheet" type="text/css" href="./static/css/loader.css"/>
<link rel="stylesheet" type="text/css" href="./static/css/index.css"/>
<link rel="stylesheet" type="text/css" href="./static/css/leaflet.css"/>
</head>
<body>
<noscript>
<div>
This site requires JavaScript. This message is only visible if you have it disabled. <br/><br/>
If you are using TOR browser set the "Security Level" to "Standard". If you keep seeing this message clear cache and storage of TOR browser app and retry.<br/><br/>
If the problem persists, ask for support in the RoboSats telegram group<a href="https://t.me/robosats"> (t.me/robosats)</a>
</div>
</noscript>
<div id="main">
<div id="app">
<div class="loaderCenter">
<div class="loaderSpinner"></div>
<div class="content-slider">
<div class="slider">
<div class="mask">
<ul>
<li class="anim1">
<div class="quote">Looking for robot parts ...</div>
</li>
<li class="anim2">
<div class="quote">Adding layers to the onion ...</div>
</li>
<li class="anim3">
<div class="quote">Winning at game theory ...</div>
</li>
<li class="anim4">
<div class="quote">Moving Sats at light speed ...</div>
</li>
<li class="anim5">
<div class="quote">Hiding in 2^256 bits of entropy...</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<script>
window.RobosatsSettings = 'web-basic'
window.RobosatsClient = 'desktop-app'
</script>
<script src="./static/frontend/main.js"></script>
</body>
</html>

94
desktopApp/index.js Normal file
View File

@ -0,0 +1,94 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// Modules to control application life and create native browser window
var electron_1 = require("electron");
var child_process_1 = require("child_process");
var path = require("path");
var os = require("os");
var tor = null;
// Function to determine the current OS and find the appropriate Tor binary
function checkPlatformAndRunTor() {
var platform = os.platform();
switch (platform) {
case 'win32':
tor = (0, child_process_1.spawn)(path.join(__dirname, '/tor/tor-win/tor/tor.exe'));
break;
case 'darwin':
tor = (0, child_process_1.spawn)(path.join(__dirname, '/tor/tor-mac/tor/tor'));
break;
case 'linux':
tor = (0, child_process_1.spawn)(path.join(__dirname, '/tor/tor-linux/tor/tor'));
break;
default:
throw new Error("Unsupported platform: ".concat(platform));
}
}
// Function to start Tor process
checkPlatformAndRunTor();
// Listen for Tor process stdout data
tor.stdout.on("data", function (data) {
var message = data.toString();
console.log("Data received: ".concat(message));
});
// Listen for Tor process stderr data
tor.stderr.on("data", function (data) {
console.error("Error received: ".concat(data.toString()));
electron_1.app.exit(1); // Exit the app if there's an error in the Tor process
});
// Function to create the main application window
function createWindow() {
// Create the browser window with specific dimensions
var mainWindow = new electron_1.BrowserWindow({
width: 1200,
height: 800,
icon: path.join(__dirname, '/static/assets/images/favicon-32x32.png'),
webPreferences: {
nodeIntegration: false, // Disable Node.js integration in the renderer
contextIsolation: true, // Enable context isolation for security
},
});
// Load the index.html file from the app directory
mainWindow.loadURL("file://".concat(path.resolve(__dirname, 'index.html#/robot')), {
extraHeaders: "pragma: no-cache\n" // Prevent caching of the loaded file
});
// Handle failed load attempts by reloading the file
mainWindow.webContents.on("did-fail-load", function () {
console.log("Failed to load the page, retrying...");
mainWindow.loadURL("file://".concat(__dirname, "/index.html#/robot"));
});
// Uncomment the following line to open the DevTools
// mainWindow.webContents.openDevTools();
}
// This method is called when Electron has finished initialization
electron_1.app.whenReady().then(function () {
// Create the window after the app is ready
createWindow();
// Re-create a window if the app is activated and there are no other windows open (MacOS specific behavior)
electron_1.app.on("activate", function () {
if (electron_1.BrowserWindow.getAllWindows().length === 0)
createWindow();
});
});
// Setup the app session when Electron is ready
electron_1.app.on("ready", function () {
// Redirect requests to static files
electron_1.session.defaultSession.webRequest.onBeforeRequest({ urls: ['file:///static/*'] }, function (details, callback) {
var url = details.url;
var modifiedUrl = url.slice(7);
var staticFilePath = path.join(__dirname, modifiedUrl);
callback({ redirectURL: "file://".concat(staticFilePath) });
});
// Set the proxy for the session to route through Tor
electron_1.session.defaultSession.setProxy({
proxyRules: "socks://localhost:9050",
proxyBypassRules: "<local>",
});
});
// Handle all windows closed event except on macOS
electron_1.app.on("window-all-closed", function () {
// Terminate the Tor process if it exists
tor === null || tor === void 0 ? void 0 : tor.kill();
if (process.platform !== "darwin")
electron_1.app.quit();
});
//# sourceMappingURL=index.js.map

1
desktopApp/index.js.map Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"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"}

106
desktopApp/index.ts Normal file
View File

@ -0,0 +1,106 @@
// Modules to control application life and create native browser window
import { app, BrowserWindow, session, protocol, net } from 'electron';
import { spawn, ChildProcessWithoutNullStreams } from 'child_process';
import * as path from 'path';
import * as os from "os";
let tor: ChildProcessWithoutNullStreams | null = null;
// Function to determine the current OS and find the appropriate Tor binary
function checkPlatformAndRunTor(): void {
const platform = os.platform();
switch (platform) {
case 'win32':
tor = spawn(path.join(__dirname, '/tor/tor-win/tor/tor.exe'));
break;
case 'darwin':
tor = spawn(path.join(__dirname, '/tor/tor-mac/tor/tor'));
break;
case 'linux':
tor = spawn(path.join(__dirname, '/tor/tor-linux/tor/tor'));
break;
default:
throw new Error(`Unsupported platform: ${platform}`);
}
}
// Function to start Tor process
checkPlatformAndRunTor()
// Listen for Tor process stdout data
tor.stdout.on("data", (data: Buffer) => {
const message = data.toString();
console.log(`Data received: ${message}`);
});
// Listen for Tor process stderr data
tor.stderr.on("data", (data: Buffer) => {
console.error(`Error received: ${data.toString()}`);
app.exit(1); // Exit the app if there's an error in the Tor process
});
// Function to create the main application window
function createWindow(): void {
// Create the browser window with specific dimensions
const mainWindow = new BrowserWindow({
width: 1200,
height: 800,
icon:path.join(__dirname, '/static/assets/images/favicon-32x32.png'),
webPreferences: {
nodeIntegration: false, // Disable Node.js integration in the renderer
contextIsolation: true, // Enable context isolation for security
},
});
// Load the index.html file from the app directory
mainWindow.loadURL(`file://${path.resolve(__dirname, 'index.html#/robot')}`, {
extraHeaders: "pragma: no-cache\n" // Prevent caching of the loaded file
});
// Handle failed load attempts by reloading the file
mainWindow.webContents.on("did-fail-load", () => {
console.log("Failed to load the page, retrying...");
mainWindow.loadURL(`file://${__dirname}/index.html#/robot`);
});
// Uncomment the following line to open the DevTools
// mainWindow.webContents.openDevTools();
}
// This method is called when Electron has finished initialization
app.whenReady().then(() => {
// Create the window after the app is ready
createWindow();
// Re-create a window if the app is activated and there are no other windows open (MacOS specific behavior)
app.on("activate", () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow();
});
});
// Setup the app session when Electron is ready
app.on("ready", () => {
// Redirect requests to static files
session.defaultSession.webRequest.onBeforeRequest({ urls: ['file:///static/*'] }, (details, callback) => {
const url = details.url;
const modifiedUrl = url.slice(7);
const staticFilePath = path.join(__dirname, modifiedUrl);
callback({ redirectURL: `file://${staticFilePath}` });
});
// Set the proxy for the session to route through Tor
session.defaultSession.setProxy({
proxyRules: "socks://localhost:9050",
proxyBypassRules: "<local>",
});
});
// Handle all windows closed event except on macOS
app.on("window-all-closed", () => {
// Terminate the Tor process if it exists
tor?.kill();
if (process.platform !== "darwin") app.quit();
});

4526
desktopApp/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

48
desktopApp/package.json Normal file
View File

@ -0,0 +1,48 @@
{
"name": "desktop-app",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "electron .",
"compile": "./node_modules/.bin/tsc",
"test": "echo \"Error: no test specified\" && exit 1",
"package-linux": "npx @electron/packager . Robosats --platform=linux --arch=x64 --icon=./assets/icon/Robosats.svg --overwrite --out=release-builds",
"package-win": "npx @electron/packager . Robosats --platform=win32 --arch=ia32 --icon=./assets/icon/Robosats.ico --overwrite --out=release-builds",
"package-mac": "npx @electron/packager . Robosats --platform=darwin --arch=x64 --icon=./assets/icon/Robosats.icns --overwrite --out=release-builds"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@electron/packager": "^18.3.2",
"electron": "^30.0.3",
"typescript": "^5.4.5"
},
"dependencies": {
"cors": "^2.8.5",
"express": "^4.19.2"
},
"build": {
"appId": "com.electron.robosats",
"productName": "RobosatsApp",
"directories": {
"output": "dist"
},
"win": {
"target": [
"NSIS"
]
},
"mac": {
"target": [
"dmg"
]
},
"linux": {
"target": [
"AppImage",
"deb"
]
}
}
}

1
desktopApp/static Symbolic link
View File

@ -0,0 +1 @@
../frontend/static

View File

@ -0,0 +1,28 @@
# Conjure
[Conjure](https://jhalderm.com/pub/papers/conjure-ccs19.pdf) is an anti-censorship tool in the refraction networking (a.k.a. decoy routing) lineage of circumvention systems. The key innovation of Conjure is to turn the unused IP address space of deploying ISPs into a large pool of **phantom** proxies that users can connect to. Due to the size of unused IPv6 address space and the potential for collateral damage against real websites hosted by the deploying ISPs, Conjure provides an effective solution to the problem of censors enumerating deployed bridges or proxies.
Conjure is currenty deployed on the University of Colorado network and a small to mid size ISP in Michigan.
# Conjure Pluggable Transport for Tor
This repository is an implementation of both the client and bridge side of a Tor pluggable transport that uses the deployed Conjure network to allow users to connect to the Tor network. The client side calls the [`gotapdance` library](https://github.com/refraction-networking/gotapdance) to communicate with deployed Conjure stations and route client traffic through the phantom proxies assigned by the station. The bridge side receives [haproxy](https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt) connections from the Conjure station that wrap the proxied client traffic.
# Deployment details
We currently have deployed a low capacity Conjure bridge named [Haunt](https://metrics.torproject.org/rs.html#details/A84C946BF4E14E63A3C92E140532A4594F2C24CD). To connect through this bridge, use the `torrc` file in the `client/` directory as follows:
```
cd client/
tor -f torrc
```
# Warnings
This tool and the deployment is still under active development. We are still working on securing the connection between the deployed Conjure stations and the Conjure bridge. We are also working on improving the censorship resistance of the registration connection between the client and the station. Do not expect this to work out of the box in all areas.
The Conjure station sometimes suffers from a heavy load of users. When this happens, connections will fail. If you are testing this out, try waiting awhile and trying again later.
# Conjure development
Due to the complex nature of the Conjure deployment, it can be difficult to set up a local development environment. Check out [phantombox](https://gitlab.torproject.org/cohosh/phantombox) for an automated libvirt-based setup that works on Linux.

View File

@ -0,0 +1,109 @@
# Snowflake
[![Build Status](https://travis-ci.org/keroserene/snowflake.svg?branch=master)](https://travis-ci.org/keroserene/snowflake)
Pluggable Transport using WebRTC, inspired by Flashproxy.
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**
- [Structure of this Repository](#structure-of-this-repository)
- [Usage](#usage)
- [Using Snowflake with Tor](#using-snowflake-with-tor)
- [Running a Snowflake Proxy](#running-a-snowflake-proxy)
- [Using the Snowflake Library with Other Applications](#using-the-snowflake-library-with-other-applications)
- [Test Environment](#test-environment)
- [FAQ](#faq)
- [More info and links](#more-info-and-links)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
### Structure of this Repository
- `broker/` contains code for the Snowflake broker
- `doc/` contains Snowflake documentation and manpages
- `client/` contains the Tor pluggable transport client and client library code
- `common/` contains generic libraries used by multiple pieces of Snowflake
- `proxy/` contains code for the Go standalone Snowflake proxy
- `probetest/` contains code for a NAT probetesting service
- `server/` contains the Tor pluggable transport server and server library code
### Usage
Snowflake is currently deployed as a pluggable transport for Tor.
#### Using Snowflake with Tor
To use the Snowflake client with Tor, you will need to add the appropriate `Bridge` and `ClientTransportPlugin` lines to your [torrc](https://2019.www.torproject.org/docs/tor-manual.html.en) file. See the [client README](client) for more information on building and running the Snowflake client.
#### Running a Snowflake Proxy
You can contribute to Snowflake by running a Snowflake proxy. We have the option to run a proxy in your browser or as a standalone Go program. See our [community documentation](https://community.torproject.org/relay/setup/snowflake/) for more details.
#### Using the Snowflake Library with Other Applications
Snowflake can be used as a Go API, and adheres to the [v2.1 pluggable transports specification](). For more information on using the Snowflake Go library, see the [Snowflake library documentation](doc/using-the-snowflake-library.md).
### Test Environment
There is a Docker-based test environment at https://github.com/cohosh/snowbox.
### FAQ
**Q: How does it work?**
In the Tor use-case:
1. Volunteers visit websites which host the "snowflake" proxy. (just
like flashproxy)
2. Tor clients automatically find available browser proxies via the Broker
(the domain fronted signaling channel).
3. Tor client and browser proxy establish a WebRTC peer connection.
4. Proxy connects to some relay.
5. Tor occurs.
More detailed information about how clients, snowflake proxies, and the Broker
fit together on the way...
**Q: What are the benefits of this PT compared with other PTs?**
Snowflake combines the advantages of flashproxy and meek. Primarily:
- It has the convenience of Meek, but can support magnitudes more
users with negligible CDN costs. (Domain fronting is only used for brief
signalling / NAT-piercing to setup the P2P WebRTC DataChannels which handle
the actual traffic.)
- Arbitrarily high numbers of volunteer proxies are possible like in
flashproxy, but NATs are no longer a usability barrier - no need for
manual port forwarding!
**Q: Why is this called Snowflake?**
It utilizes the "ICE" negotiation via WebRTC, and also involves a great
abundance of ephemeral and short-lived (and special!) volunteer proxies...
### More info and links
We have more documentation in the [Snowflake wiki](https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/wikis/home) and at https://snowflake.torproject.org/.
##### -- Android AAR Reproducible Build Setup --
Using `gomobile` it is possible to build snowflake as shared libraries for all
the architectures supported by Android. This is in the _.gitlab-ci.yml_, which
runs in GitLab CI. It is also possible to run this setup in a Virtual Machine
using [vagrant](https://www.vagrantup.com/). Just run `vagrant up` and it will
create and provision the VM. `vagrant ssh` to get into the VM to use it as a
development environment.
##### uTLS Settings
Snowflake communicate with broker that serves as signaling server with TLS based domain fronting connection, which may be identified by its usage of Go language TLS stack.
uTLS is a software library designed to initiate the TLS Client Hello fingerprint of browsers or other popular software's TLS stack to evade censorship based on TLS client hello fingerprint with `-utls-imitate` . You can use `-version` to see a list of supported values.
Depending on client and server configuration, it may not always work as expected as not all extensions are correctly implemented.
You can also remove SNI (Server Name Indication) from client hello to evade censorship with `-utls-nosni`, not all servers supports this.

View File

@ -0,0 +1,263 @@
# WebTunnel
Pluggable Transport based on HTTP Upgrade(HTTPT)
WebTunnel is pluggable transport that attempt to imitate web browsing activities based on [HTTPT](https://censorbib.nymity.ch/#Frolov2020b).
## Client Usage
Connect to a WebTunnel server with a Tor configuration file like:
```
UseBridges 1
DataDirectory datadir
ClientTransportPlugin webtunnel exec ./client
Bridge webtunnel 192.0.2.3:1 url=https://akbwadp9lc5fyyz0cj4d76z643pxgbfh6oyc-167-71-71-157.sslip.io/5m9yq0j4ghkz0fz7qmuw58cvbjon0ebnrsp0
SocksPort auto
Log info
```
## Server Setup
#### Install Tor
On a Debian system, first install tor normally with
```
apt install apt-transport-https
lsb_release -c
nano /etc/apt/sources.list.d/tor.list
wget -qO- https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --dearmor | tee /usr/share/keyrings/tor-archive-keyring.gpg >/dev/null
apt update
apt install tor deb.torproject.org-keyring
```
### Disable default instance
The default Tor configuration is not useful for this setup, so the next step will be disabling them.
```
systemctl stop tor@default.service
systemctl mask tor@default.service
```
### Get Environment Ready
```
#copy server file to server
scp server root@$SERVER_ADDRESS:/var/lib/torwebtunnel/webtunnel
```
then create server torrc at `/var/lib/torwebtunnel/torrc`
```
BridgeRelay 1
ORPort 10000
ServerTransportPlugin webtunnel exec /var/lib/torwebtunnel/webtunnel
ServerTransportListenAddr webtunnel 127.0.0.1:11000
ExtORPort auto
ContactInfo WebTunnel email: tor.relay.email@torproject.net ciissversion:2
Nickname WebTunnelTest
PublishServerDescriptor 1
BridgeDistribution none
DataDirectory /var/lib/torwebtunnel/tor-data
CacheDirectory /tmp/tor-tmp-torwebtunnel
SocksPort 0
```
#### Configure service unit file
Create a service unit file as follow
```
[Unit]
Description=Tor Web Tunnel
[Service]
Type=simple
DynamicUser=yes
PrivateUsers=true
PrivateMounts=true
ProtectSystem=strict
PrivateTmp=true
PrivateDevices=true
ProtectClock=true
NoNewPrivileges=true
ProtectHome=tmpfs
ProtectKernelModules=true
ProtectKernelLogs=true
StateDirectory=torwebtunnel
ExecStart=/usr/bin/tor -f /var/lib/torwebtunnel/torrc --RunAsDaemon 0
[Install]
WantedBy=default.target
```
#### Obtain Certificate
WebTunnel Requires a valid TLS certificate, to obtain that
```
curl https://get.acme.sh | sh -s email=my@example.com
~/.acme.sh/acme.sh --issue --standalone --domain $SERVER_ADDRESS
```
#### Install & Configure Nginx
To coexist with other content at a single port, it is necessary to install a reverse proxy like nginx:
```
apt install nginx
```
And then configure HTTP Upgrade forwarding at /etc/nginx/nginx.conf.
```
--- a/before.conf
+++ b/after.conf
@@ -60,6 +60,13 @@ http {
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
+
+ #WebSocket Support
+ map $http_upgrade $connection_upgrade {
+ default upgrade;
+ '' close;
+ }
+
}
```
Finally, add http forwarding setting to a new file at /etc/nginx/site-enabled .
```
server {
listen [::]:443 ssl http2;
listen 443 ssl http2;
server_name $SERVER_ADDRESS;
#ssl on;
# certs sent to the client in SERVER HELLO are concatenated in ssl_certificate
ssl_certificate /etc/nginx/ssl/fullchain.cer;
ssl_certificate_key /etc/nginx/ssl/key.key;
ssl_session_timeout 15m;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;
ssl_session_cache shared:MozSSL:50m;
#ssl_ecdh_curve secp521r1,prime256v1,secp384r1;
ssl_session_tickets off;
add_header Strict-Transport-Security "max-age=63072000" always;
location /$PATH {
proxy_pass http://127.0.0.1:11000;
proxy_http_version 1.1;
###Set WebSocket headers ####
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
### Set Proxy headers ####
proxy_set_header Accept-Encoding "";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
add_header Front-End-Https on;
proxy_redirect off;
}
}
```
## Docker Setup
Webtunnel is a new pluggable transport available for bridge operators.
### Prerequisites
An existing website using nginx balancer to handle traffic. (other load banlancer is currently untested)
Handle traffic directly, without CDN. (CDN passthrough is currently untested)
A container runtime like Docker.
### Configure nginx Forwarding
If you haven't already, configure websocket forwarding support in nginx by configure HTTP Upgrade forwarding at /etc/nginx/nginx.conf:
```
--- a/before.conf
+++ b/after.conf
@@ -60,6 +60,13 @@ http {
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
+
+ #WebSocket Support
+ map $http_upgrade $connection_upgrade {
+ default upgrade;
+ '' close;
+ }
+
}
```
And add a forwarded path under one the served domain, typically defined in files within `/etc/nginx/sites-enabled/`, replace $PATH with a random string(which you could generate with `echo $(cat /dev/urandom | tr -cd "qwertyuiopasdfghjklzxcvbnmMNBVCXZLKJHGFDSAQWERTUIOP0987654321"|head -c 24)`):
```
location /$PATH {
proxy_pass http://127.0.0.1:11000;
proxy_http_version 1.1;
###Set WebSocket headers ####
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
### Set Proxy headers ####
proxy_set_header Accept-Encoding "";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
add_header Front-End-Https on;
proxy_redirect off;
}
```
### Install Docker Runtime(if necessary)
```
apt install curl sudo
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh ./get-docker.sh
```
### Run Dockerlized Webtunnel Server
Replace `URL` with your domain and path, and `OPERATOR_EMAIL` with your email address, then run:
```
truncate --size 0 .env
echo "URL=https://yourdomain/and/path" >> .env
echo "OPERATOR_EMAIL=your@email.org" >> .env
echo "BRIDGE_NICKNAME=WTBr$(cat /dev/urandom | tr -cd 'qwertyuiopasdfghjklzxcvbnmMNBVCXZLKJHGFDSAQWERTUIOP0987654321'|head -c 10)" >> .env
echo "GENEDORPORT=4$(cat /dev/urandom | tr -cd '0987654321'|head -c 4)" >> .env
```
This will create an environment file for the configuration of webtunnel bridge.
After creating the configure file, download the webtunnel docker compose file, and instancize it.
````shell
curl https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/webtunnel/-/raw/main/release/container/docker-compose.yml?inline=false > docker-compose.yml
docker compose up -d
````
It includes auto update by default, and will update webtunnel bridge server without any further action. Remove `watchtower` to disable this behavior.
### Get Bridgeline and Check it is Running
You can obtain bridgeline and verify if it is working by running
```shell
docker compose exec webtunnel-bridge get-bridge-line.sh
```

359517
desktopApp/tor/geoip Normal file

File diff suppressed because it is too large Load Diff

155241
desktopApp/tor/geoip6 Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
../../geoip

View File

@ -0,0 +1 @@
../../geoip6

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
../../../README.CONJURE.md

View File

@ -0,0 +1 @@
../../../README.SNOWFLAKE.md

View File

@ -0,0 +1 @@
../../../README.WEBTUNNEL.md

Binary file not shown.

View File

@ -0,0 +1,32 @@
{
"recommendedDefault" : "obfs4",
"pluggableTransports" : {
"lyrebird" : "ClientTransportPlugin meek_lite,obfs2,obfs3,obfs4,scramblesuit exec ${pt_path}lyrebird",
"snowflake" : "ClientTransportPlugin snowflake exec ${pt_path}snowflake-client",
"webtunnel" : "ClientTransportPlugin webtunnel exec ${pt_path}webtunnel-client",
"conjure" : "ClientTransportPlugin conjure exec ${pt_path}conjure-client -registerURL https://registration.refraction.network/api"
},
"bridges" : {
"meek-azure" : [
"meek_lite 192.0.2.18:80 BE776A53492E1E044A26F17306E1BC46A55A1625 url=https://meek.azureedge.net/ front=ajax.aspnetcdn.com"
],
"obfs4" : [
"obfs4 192.95.36.142:443 CDF2E852BF539B82BD10E27E9115A31734E378C2 cert=qUVQ0srL1JI/vO6V6m/24anYXiJD3QP2HgzUKQtQ7GRqqUvs7P+tG43RtAqdhLOALP7DJQ iat-mode=1",
"obfs4 37.218.245.14:38224 D9A82D2F9C2F65A18407B1D2B764F130847F8B5D cert=bjRaMrr1BRiAW8IE9U5z27fQaYgOhX1UCmOpg2pFpoMvo6ZgQMzLsaTzzQNTlm7hNcb+Sg iat-mode=0",
"obfs4 85.31.186.98:443 011F2599C0E9B27EE74B353155E244813763C3E5 cert=ayq0XzCwhpdysn5o0EyDUbmSOx3X/oTEbzDMvczHOdBJKlvIdHHLJGkZARtT4dcBFArPPg iat-mode=0",
"obfs4 85.31.186.26:443 91A6354697E6B02A386312F68D82CF86824D3606 cert=PBwr+S8JTVZo6MPdHnkTwXJPILWADLqfMGoVvhZClMq/Urndyd42BwX9YFJHZnBB3H0XCw iat-mode=0",
"obfs4 193.11.166.194:27015 2D82C2E354D531A68469ADF7F878FA6060C6BACA cert=4TLQPJrTSaDffMK7Nbao6LC7G9OW/NHkUwIdjLSS3KYf0Nv4/nQiiI8dY2TcsQx01NniOg iat-mode=0",
"obfs4 193.11.166.194:27020 86AC7B8D430DAC4117E9F42C9EAED18133863AAF cert=0LDeJH4JzMDtkJJrFphJCiPqKx7loozKN7VNfuukMGfHO0Z8OGdzHVkhVAOfo1mUdv9cMg iat-mode=0",
"obfs4 193.11.166.194:27025 1AE2C08904527FEA90C4C4F8C1083EA59FBC6FAF cert=ItvYZzW5tn6v3G4UnQa6Qz04Npro6e81AP70YujmK/KXwDFPTs3aHXcHp4n8Vt6w/bv8cA iat-mode=0",
"obfs4 209.148.46.65:443 74FAD13168806246602538555B5521A0383A1875 cert=ssH+9rP8dG2NLDN2XuFw63hIO/9MNNinLmxQDpVa+7kTOa9/m+tGWT1SmSYpQ9uTBGa6Hw iat-mode=0",
"obfs4 146.57.248.225:22 10A6CD36A537FCE513A322361547444B393989F0 cert=K1gDtDAIcUfeLqbstggjIw2rtgIKqdIhUlHp82XRqNSq/mtAjp1BIC9vHKJ2FAEpGssTPw iat-mode=0",
"obfs4 45.145.95.6:27015 C5B7CD6946FF10C5B3E89691A7D3F2C122D2117C cert=TD7PbUO0/0k6xYHMPW3vJxICfkMZNdkRrb63Zhl5j9dW3iRGiCx0A7mPhe5T2EDzQ35+Zw iat-mode=0",
"obfs4 51.222.13.177:80 5EDAC3B810E12B01F6FD8050D2FD3E277B289A08 cert=2uplIpLQ0q9+0qMFrK5pkaYRDOe460LL9WHBvatgkuRr/SL31wBOEupaMMJ6koRE6Ld0ew iat-mode=0"
],
"snowflake" : [
"snowflake 192.0.2.3:80 2B280B23E1107BB62ABFC40DDCC8824814F80A72 fingerprint=2B280B23E1107BB62ABFC40DDCC8824814F80A72 url=https://1098762253.rsc.cdn77.org/ fronts=www.cdn77.com,www.phpmyadmin.net ice=stun:stun.l.google.com:19302,stun:stun.antisip.com:3478,stun:stun.bluesip.net:3478,stun:stun.dus.net:3478,stun:stun.epygi.com:3478,stun:stun.sonetel.com:3478,stun:stun.uls.co.za:3478,stun:stun.voipgate.com:3478,stun:stun.voys.nl:3478 utls-imitate=hellorandomizedalpn",
"snowflake 192.0.2.4:80 8838024498816A039FCBBAB14E6F40A0843051FA fingerprint=8838024498816A039FCBBAB14E6F40A0843051FA url=https://1098762253.rsc.cdn77.org/ fronts=www.cdn77.com,www.phpmyadmin.net ice=stun:stun.l.google.com:19302,stun:stun.antisip.com:3478,stun:stun.bluesip.net:3478,stun:stun.dus.net:3478,stun:stun.epygi.com:3478,stun:stun.sonetel.net:3478,stun:stun.uls.co.za:3478,stun:stun.voipgate.com:3478,stun:stun.voys.nl:3478 utls-imitate=hellorandomizedalpn"
]
}
}

BIN
desktopApp/tor/tor-linux/tor/tor Executable file

Binary file not shown.

View File

@ -0,0 +1 @@
../../geoip

View File

@ -0,0 +1 @@
../../geoip6

Binary file not shown.

View File

@ -0,0 +1 @@
../../../README.CONJURE.md

View File

@ -0,0 +1 @@
../../../README.SNOWFLAKE.md

View File

@ -0,0 +1 @@
../../../README.WEBTUNNEL.md

Binary file not shown.

View File

@ -0,0 +1,32 @@
{
"recommendedDefault" : "obfs4",
"pluggableTransports" : {
"lyrebird" : "ClientTransportPlugin meek_lite,obfs2,obfs3,obfs4,scramblesuit exec ${pt_path}lyrebird",
"snowflake" : "ClientTransportPlugin snowflake exec ${pt_path}snowflake-client",
"webtunnel" : "ClientTransportPlugin webtunnel exec ${pt_path}webtunnel-client",
"conjure" : "ClientTransportPlugin conjure exec ${pt_path}conjure-client -registerURL https://registration.refraction.network/api"
},
"bridges" : {
"meek-azure" : [
"meek_lite 192.0.2.18:80 BE776A53492E1E044A26F17306E1BC46A55A1625 url=https://meek.azureedge.net/ front=ajax.aspnetcdn.com"
],
"obfs4" : [
"obfs4 192.95.36.142:443 CDF2E852BF539B82BD10E27E9115A31734E378C2 cert=qUVQ0srL1JI/vO6V6m/24anYXiJD3QP2HgzUKQtQ7GRqqUvs7P+tG43RtAqdhLOALP7DJQ iat-mode=1",
"obfs4 37.218.245.14:38224 D9A82D2F9C2F65A18407B1D2B764F130847F8B5D cert=bjRaMrr1BRiAW8IE9U5z27fQaYgOhX1UCmOpg2pFpoMvo6ZgQMzLsaTzzQNTlm7hNcb+Sg iat-mode=0",
"obfs4 85.31.186.98:443 011F2599C0E9B27EE74B353155E244813763C3E5 cert=ayq0XzCwhpdysn5o0EyDUbmSOx3X/oTEbzDMvczHOdBJKlvIdHHLJGkZARtT4dcBFArPPg iat-mode=0",
"obfs4 85.31.186.26:443 91A6354697E6B02A386312F68D82CF86824D3606 cert=PBwr+S8JTVZo6MPdHnkTwXJPILWADLqfMGoVvhZClMq/Urndyd42BwX9YFJHZnBB3H0XCw iat-mode=0",
"obfs4 193.11.166.194:27015 2D82C2E354D531A68469ADF7F878FA6060C6BACA cert=4TLQPJrTSaDffMK7Nbao6LC7G9OW/NHkUwIdjLSS3KYf0Nv4/nQiiI8dY2TcsQx01NniOg iat-mode=0",
"obfs4 193.11.166.194:27020 86AC7B8D430DAC4117E9F42C9EAED18133863AAF cert=0LDeJH4JzMDtkJJrFphJCiPqKx7loozKN7VNfuukMGfHO0Z8OGdzHVkhVAOfo1mUdv9cMg iat-mode=0",
"obfs4 193.11.166.194:27025 1AE2C08904527FEA90C4C4F8C1083EA59FBC6FAF cert=ItvYZzW5tn6v3G4UnQa6Qz04Npro6e81AP70YujmK/KXwDFPTs3aHXcHp4n8Vt6w/bv8cA iat-mode=0",
"obfs4 209.148.46.65:443 74FAD13168806246602538555B5521A0383A1875 cert=ssH+9rP8dG2NLDN2XuFw63hIO/9MNNinLmxQDpVa+7kTOa9/m+tGWT1SmSYpQ9uTBGa6Hw iat-mode=0",
"obfs4 146.57.248.225:22 10A6CD36A537FCE513A322361547444B393989F0 cert=K1gDtDAIcUfeLqbstggjIw2rtgIKqdIhUlHp82XRqNSq/mtAjp1BIC9vHKJ2FAEpGssTPw iat-mode=0",
"obfs4 45.145.95.6:27015 C5B7CD6946FF10C5B3E89691A7D3F2C122D2117C cert=TD7PbUO0/0k6xYHMPW3vJxICfkMZNdkRrb63Zhl5j9dW3iRGiCx0A7mPhe5T2EDzQ35+Zw iat-mode=0",
"obfs4 51.222.13.177:80 5EDAC3B810E12B01F6FD8050D2FD3E277B289A08 cert=2uplIpLQ0q9+0qMFrK5pkaYRDOe460LL9WHBvatgkuRr/SL31wBOEupaMMJ6koRE6Ld0ew iat-mode=0"
],
"snowflake" : [
"snowflake 192.0.2.3:80 2B280B23E1107BB62ABFC40DDCC8824814F80A72 fingerprint=2B280B23E1107BB62ABFC40DDCC8824814F80A72 url=https://1098762253.rsc.cdn77.org/ fronts=www.cdn77.com,www.phpmyadmin.net ice=stun:stun.l.google.com:19302,stun:stun.antisip.com:3478,stun:stun.bluesip.net:3478,stun:stun.dus.net:3478,stun:stun.epygi.com:3478,stun:stun.sonetel.com:3478,stun:stun.uls.co.za:3478,stun:stun.voipgate.com:3478,stun:stun.voys.nl:3478 utls-imitate=hellorandomizedalpn",
"snowflake 192.0.2.4:80 8838024498816A039FCBBAB14E6F40A0843051FA fingerprint=8838024498816A039FCBBAB14E6F40A0843051FA url=https://1098762253.rsc.cdn77.org/ fronts=www.cdn77.com,www.phpmyadmin.net ice=stun:stun.l.google.com:19302,stun:stun.antisip.com:3478,stun:stun.bluesip.net:3478,stun:stun.dus.net:3478,stun:stun.epygi.com:3478,stun:stun.sonetel.net:3478,stun:stun.uls.co.za:3478,stun:stun.voipgate.com:3478,stun:stun.voys.nl:3478 utls-imitate=hellorandomizedalpn"
]
}
}

BIN
desktopApp/tor/tor-mac/tor/tor Executable file

Binary file not shown.

View File

@ -0,0 +1 @@
../../geoip

View File

@ -0,0 +1 @@
../../geoip6

View File

@ -0,0 +1 @@
../../../README.CONJURE.md

View File

@ -0,0 +1 @@
../../../README.SNOWFLAKE.md

View File

@ -0,0 +1 @@
../../../README.WEBTUNNEL.md

Binary file not shown.

View File

@ -0,0 +1,32 @@
{
"recommendedDefault" : "obfs4",
"pluggableTransports" : {
"lyrebird" : "ClientTransportPlugin meek_lite,obfs2,obfs3,obfs4,scramblesuit exec ${pt_path}lyrebird.exe",
"snowflake" : "ClientTransportPlugin snowflake exec ${pt_path}snowflake-client.exe",
"webtunnel" : "ClientTransportPlugin webtunnel exec ${pt_path}webtunnel-client.exe",
"conjure" : "ClientTransportPlugin conjure exec ${pt_path}conjure-client.exe -registerURL https://registration.refraction.network/api"
},
"bridges" : {
"meek-azure" : [
"meek_lite 192.0.2.18:80 BE776A53492E1E044A26F17306E1BC46A55A1625 url=https://meek.azureedge.net/ front=ajax.aspnetcdn.com"
],
"obfs4" : [
"obfs4 192.95.36.142:443 CDF2E852BF539B82BD10E27E9115A31734E378C2 cert=qUVQ0srL1JI/vO6V6m/24anYXiJD3QP2HgzUKQtQ7GRqqUvs7P+tG43RtAqdhLOALP7DJQ iat-mode=1",
"obfs4 37.218.245.14:38224 D9A82D2F9C2F65A18407B1D2B764F130847F8B5D cert=bjRaMrr1BRiAW8IE9U5z27fQaYgOhX1UCmOpg2pFpoMvo6ZgQMzLsaTzzQNTlm7hNcb+Sg iat-mode=0",
"obfs4 85.31.186.98:443 011F2599C0E9B27EE74B353155E244813763C3E5 cert=ayq0XzCwhpdysn5o0EyDUbmSOx3X/oTEbzDMvczHOdBJKlvIdHHLJGkZARtT4dcBFArPPg iat-mode=0",
"obfs4 85.31.186.26:443 91A6354697E6B02A386312F68D82CF86824D3606 cert=PBwr+S8JTVZo6MPdHnkTwXJPILWADLqfMGoVvhZClMq/Urndyd42BwX9YFJHZnBB3H0XCw iat-mode=0",
"obfs4 193.11.166.194:27015 2D82C2E354D531A68469ADF7F878FA6060C6BACA cert=4TLQPJrTSaDffMK7Nbao6LC7G9OW/NHkUwIdjLSS3KYf0Nv4/nQiiI8dY2TcsQx01NniOg iat-mode=0",
"obfs4 193.11.166.194:27020 86AC7B8D430DAC4117E9F42C9EAED18133863AAF cert=0LDeJH4JzMDtkJJrFphJCiPqKx7loozKN7VNfuukMGfHO0Z8OGdzHVkhVAOfo1mUdv9cMg iat-mode=0",
"obfs4 193.11.166.194:27025 1AE2C08904527FEA90C4C4F8C1083EA59FBC6FAF cert=ItvYZzW5tn6v3G4UnQa6Qz04Npro6e81AP70YujmK/KXwDFPTs3aHXcHp4n8Vt6w/bv8cA iat-mode=0",
"obfs4 209.148.46.65:443 74FAD13168806246602538555B5521A0383A1875 cert=ssH+9rP8dG2NLDN2XuFw63hIO/9MNNinLmxQDpVa+7kTOa9/m+tGWT1SmSYpQ9uTBGa6Hw iat-mode=0",
"obfs4 146.57.248.225:22 10A6CD36A537FCE513A322361547444B393989F0 cert=K1gDtDAIcUfeLqbstggjIw2rtgIKqdIhUlHp82XRqNSq/mtAjp1BIC9vHKJ2FAEpGssTPw iat-mode=0",
"obfs4 45.145.95.6:27015 C5B7CD6946FF10C5B3E89691A7D3F2C122D2117C cert=TD7PbUO0/0k6xYHMPW3vJxICfkMZNdkRrb63Zhl5j9dW3iRGiCx0A7mPhe5T2EDzQ35+Zw iat-mode=0",
"obfs4 51.222.13.177:80 5EDAC3B810E12B01F6FD8050D2FD3E277B289A08 cert=2uplIpLQ0q9+0qMFrK5pkaYRDOe460LL9WHBvatgkuRr/SL31wBOEupaMMJ6koRE6Ld0ew iat-mode=0"
],
"snowflake" : [
"snowflake 192.0.2.3:80 2B280B23E1107BB62ABFC40DDCC8824814F80A72 fingerprint=2B280B23E1107BB62ABFC40DDCC8824814F80A72 url=https://1098762253.rsc.cdn77.org/ fronts=www.cdn77.com,www.phpmyadmin.net ice=stun:stun.l.google.com:19302,stun:stun.antisip.com:3478,stun:stun.bluesip.net:3478,stun:stun.dus.net:3478,stun:stun.epygi.com:3478,stun:stun.sonetel.com:3478,stun:stun.uls.co.za:3478,stun:stun.voipgate.com:3478,stun:stun.voys.nl:3478 utls-imitate=hellorandomizedalpn",
"snowflake 192.0.2.4:80 8838024498816A039FCBBAB14E6F40A0843051FA fingerprint=8838024498816A039FCBBAB14E6F40A0843051FA url=https://1098762253.rsc.cdn77.org/ fronts=www.cdn77.com,www.phpmyadmin.net ice=stun:stun.l.google.com:19302,stun:stun.antisip.com:3478,stun:stun.bluesip.net:3478,stun:stun.dus.net:3478,stun:stun.epygi.com:3478,stun:stun.sonetel.net:3478,stun:stun.uls.co.za:3478,stun:stun.voipgate.com:3478,stun:stun.voys.nl:3478 utls-imitate=hellorandomizedalpn"
]
}
}

Binary file not shown.

Binary file not shown.

14
desktopApp/tsconfig.json Normal file
View File

@ -0,0 +1,14 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"outDir": "."
},
"exclude": [ "node_modules" ]
}

View File

@ -6,7 +6,7 @@
"scripts": {
"dev": "node --max-old-space-size=4096 ./node_modules/.bin/webpack --watch --progress --mode development",
"test": "jest",
"build": "webpack --mode production",
"build": "webpack --config webpack.config.ts --mode production",
"lint": "eslint src/**/*.{ts,tsx}",
"lint:fix": "eslint --fix 'src/**/*.{ts,tsx}'",
"format": "prettier --write '**/**/*.{js,jsx,ts,tsx,css,md,json}' --config ./.prettierrc"

View File

@ -24,7 +24,7 @@ const App = (): JSX.Element => {
<GarageContextProvider>
<FederationContextProvider>
<CssBaseline />
{window.NativeRobosats === undefined ? <HostAlert /> : <TorConnectionBadge />}
{(window.NativeRobosats === undefined && window.RobosatsClient === undefined )? <HostAlert /> : <TorConnectionBadge />}
<Main />
</FederationContextProvider>
</GarageContextProvider>

View File

@ -1,5 +1,5 @@
import React, { useContext } from 'react';
import { MemoryRouter, BrowserRouter, Routes, Route } from 'react-router-dom';
import { MemoryRouter,HashRouter ,BrowserRouter, Routes, Route } from 'react-router-dom';
import { Box, Slide, Typography, styled } from '@mui/material';
import { type UseAppStoreType, AppContext, closeAll } from '../contexts/AppContext';
@ -10,7 +10,16 @@ import Notifications from '../components/Notifications';
import { useTranslation } from 'react-i18next';
import { GarageContext, type UseGarageStoreType } from '../contexts/GarageContext';
const Router = window.NativeRobosats === undefined ? BrowserRouter : MemoryRouter;
function getRouter() {
if (window.NativeRobosats === undefined && window.RobosatsClient === undefined) {
return BrowserRouter;
} else if (window.RobosatsClient === 'desktop-app') {
return HashRouter;
} else {
return MemoryRouter;
}
}
const Router = getRouter();
const TestnetTypography = styled(Typography)({
height: 0,
@ -53,6 +62,7 @@ const Main: React.FC = () => {
)}
<MainBox navbarHeight={navbarHeight}>
<Routes>
{['/robot/:token?', '/', ''].map((path, index) => {
return (

View File

@ -39,7 +39,7 @@ const audioPath =
window.NativeRobosats === undefined
? '/static/assets/sounds'
: 'file:///android_asset/Web.bundle/assets/sounds';
const EncryptedTurtleChat: React.FC<Props> = ({
order,
userNick,

View File

@ -40,6 +40,7 @@ export interface SlideDirection {
export type TorStatus = 'ON' | 'STARTING' | 'STOPPING' | 'OFF';
export const isNativeRoboSats = !(window.NativeRobosats === undefined);
export const isDesktopRoboSats = !(window.RobosatsClient === undefined);
const pageFromPath = window.location.pathname.split('/')[1];
const isPagePathEmpty = pageFromPath === '';
@ -77,15 +78,18 @@ const makeTheme = function (settings: Settings): Theme {
const getHostUrl = (network = 'mainnet'): string => {
let host = '';
let protocol = '';
if (window.NativeRobosats === undefined) {
if(isDesktopRoboSats){
host = defaultFederation.exp[network].onion;
protocol = 'http:';
}
else if (window.NativeRobosats === undefined) {
host = getHost();
protocol = location.protocol;
} else {
host = defaultFederation.exp[network].Onion;
host = defaultFederation.exp[network].onion;
protocol = 'http:';
}
const hostUrl = `${protocol}//${host}`;
const hostUrl = `${host}`;
return hostUrl;
};

View File

@ -16,8 +16,23 @@ type FederationHooks = 'onCoordinatorUpdate' | 'onFederationUpdate';
export class Federation {
constructor(origin: Origin, settings: Settings, hostUrl: string) {
this.coordinators = {};
this.exchange = { ...defaultExchange };
this.coordinators = Object.entries(defaultFederation).reduce(
(acc: Record<string, Coordinator>, [key, value]: [string, any]) => {
if (getHost() !== '127.0.0.1:8000' && key === 'local') {
// Do not add `Local Dev` unless it is running on localhost
return acc;
} else {
acc[key] = new Coordinator(value, origin, settings, hostUrl);
return acc;
}
},
{},
);
this.exchange = {
...defaultExchange,
totalCoordinators: Object.keys(this.coordinators).length,
};
this.book = [];
this.hooks = {
onCoordinatorUpdate: [],

View File

@ -5,6 +5,7 @@ declare global {
ReactNativeWebView?: ReactNativeWebView;
NativeRobosats?: NativeRobosats;
RobosatsSettings: 'web-basic' | 'web-pro' | 'selfhosted-basic' | 'selfhosted-pro';
RobosatsClient: 'desktop-app' | undefined;
}
}

View File

@ -0,0 +1,70 @@
import { type SystemClient } from '..';
class SystemDesktopClient implements SystemClient {
public loading = false;
public copyToClipboard: (value: string) => void = (value) => {
// navigator clipboard api needs a secure context (https)
// this function attempts to copy also on http contexts
// useful on the http i2p site and on torified browsers
if (navigator.clipboard !== undefined && window.isSecureContext) {
// navigator clipboard api method'
void navigator.clipboard.writeText(value);
} else {
// text area method
const textArea = document.createElement('textarea');
textArea.value = value;
// make the textarea out of viewport
textArea.style.position = 'fixed';
textArea.style.visibility = 'hidden';
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
// here the magic happens
document.execCommand('copy');
textArea.remove();
}
};
// Cookies
public getCookie: (key: string) => string = (key) => {
let cookieValue = null;
if (document?.cookie !== '') {
const cookies = document.cookie.split(';');
for (let i = 0; i < cookies.length; i++) {
const cookie = cookies[i].trim();
// Does this cookie string begin with the key we want?
if (cookie.substring(0, key.length + 1) === key + '=') {
cookieValue = decodeURIComponent(cookie.substring(key.length + 1));
break;
}
}
}
return cookieValue ?? '';
};
public setCookie: (key: string, value: string) => void = (key, value) => {
document.cookie = `${key}=${value};path=/;SameSite=None;Secure`;
};
public deleteCookie: (key: string) => void = (key) => {
document.cookie = `${key}= ;path=/; expires = Thu, 01 Jan 1970 00:00:00 GMT`;
};
// Local storage
public getItem: (key: string) => string = (key) => {
const value = window.sessionStorage.getItem(key);
return value ?? '';
};
public setItem: (key: string, value: string) => void = (key, value) => {
window.sessionStorage.setItem(key, value);
};
public deleteItem: (key: string) => void = (key) => {
window.sessionStorage.removeItem(key);
};
}
export default SystemDesktopClient;

View File

@ -1,5 +1,6 @@
import SystemNativeClient from './SystemNativeClient';
import SystemWebClient from './SystemWebClient';
import SystemDesktopClient from './SystemDesktopClient';
export interface SystemClient {
loading: boolean;
@ -12,9 +13,18 @@ export interface SystemClient {
deleteItem: (key: string) => void;
}
export const systemClient: SystemClient =
// If userAgent has "RoboSats", we assume the app is running inside of the
// react-native-web view of the RoboSats Android app.
window.navigator.userAgent.includes('robosats')
? new SystemNativeClient()
: new SystemWebClient();
function getSystemClient(): SystemClient {
if (window.navigator.userAgent.includes('robosats')) {
// If userAgent has "RoboSats", we assume the app is running inside of the
// react-native-web view of the RoboSats Android app.
return new SystemNativeClient();
} else if (window.navigator.userAgent.includes('Electron')) {
// If userAgent has "Electron", we assume the app is running inside of an Electron app.
return new SystemDesktopClient();
} else {
// Otherwise, we assume the app is running in a web browser.
return new SystemWebClient();
}
}
export const systemClient: SystemClient = getSystemClient();