added code to clone package manager
This commit is contained in:
3
plugin/.dockerignore
Normal file
3
plugin/.dockerignore
Normal file
@@ -0,0 +1,3 @@
|
||||
.idea
|
||||
.DS_Store
|
||||
Dockerfile
|
||||
2
plugin/.gitignore
vendored
Normal file
2
plugin/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
.idea
|
||||
.DS_Store
|
||||
102
plugin/README.md
Normal file
102
plugin/README.md
Normal file
@@ -0,0 +1,102 @@
|
||||
# Laplace
|
||||
|
||||
Laplace is an open-source project to enable screen sharing directly via browser.
|
||||
Made possible using WebRTC for low latency peer-to-peer connections, and WebSocket implemented in golang for WebRTC signaling.
|
||||
|
||||
> Demo video: https://youtu.be/E8cUaPrAlzE
|
||||
|
||||
[](https://youtu.be/E8cUaPrAlzE)
|
||||
|
||||
|
||||
## Try Demo
|
||||
|
||||
For demo, you can visit https://laplace.madeby.monster/
|
||||
|
||||

|
||||
|
||||
|
||||
## Motivation
|
||||
|
||||
There are already possible solutions to share your computer screen, e.g. TeamViewer.
|
||||
But most of them require installations of software or plugins.
|
||||
What Laplace provides is a simple solution to this problem.
|
||||
For users wanting to share their screen, all they need to do is to open a website page with their browsers, clicking some buttons, then share some session ID with their peers.
|
||||
No installation or registration required.
|
||||
|
||||
#### Solving the latency problem
|
||||
|
||||
This project also serves as a proof-of-concept (PoC) for screen sharing capability directly in browsers based on WebRTC.
|
||||
Using WebRTC, real-time communication is made possible through peer-to-peer connections.
|
||||
This proves to be very useful in solving one of the biggest problems is screen streaming: **Latency**.
|
||||
The latency represents how long the delay is from the source to transmit to the remote client.
|
||||
If you notice, this latency problem is usually highlighted by game streaming services, since gameplay relies heavily on the interactivity of inputs and outputs.
|
||||
|
||||
|
||||
#### Low server cost
|
||||
This solution also solves the server cost problem, since the expensive operations (encoding and transmission) are done on client browsers.
|
||||
The server is only needed for serving frontends and for WebRTC signaling.
|
||||
|
||||
|
||||
#### Possible Use Cases
|
||||
|
||||
- Game streaming from PC to mobile devices.
|
||||
- Collaborative work where you need to share your screen with remote coworkers.
|
||||
- Mirroring presentation slides and demonstrations.
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
Build from source
|
||||
|
||||
```bash
|
||||
$ git clone https://github.com/adamyordan/laplace.git
|
||||
$ cd laplace && go build -o laplace main.go
|
||||
$ ./laplace --help
|
||||
```
|
||||
|
||||
OR, pull the pre-built docker image
|
||||
|
||||
```bash
|
||||
$ docker pull adamyordan/laplace
|
||||
$ docker run adamyordan/laplace ./laplace --help
|
||||
```
|
||||
|
||||
|
||||
## Program Execution
|
||||
|
||||
Executing this project basically serves an HTTP server that will host the frontend and the WebSocket implementation.
|
||||
Note that you sometimes need to run HTTPs in order for browser to connect to websocket.
|
||||
|
||||
```bash
|
||||
$ ./laplace --help
|
||||
-addr string
|
||||
Listen address (default "0.0.0.0:443")
|
||||
-certFile string
|
||||
TLS cert file (default "files/server.crt")
|
||||
-keyFile string
|
||||
TLS key file (default "files/server.key")
|
||||
-tls
|
||||
Use TLS (default true)
|
||||
```
|
||||
|
||||
By default, you can run the executable without any argument to listen to TLS port 443.
|
||||
A self-signed certificate files are provided to ease up development.
|
||||
|
||||
```bash
|
||||
$ ./laplace
|
||||
2020/03/25 01:01:10 Listening on TLS: 0.0.0.0:443
|
||||
```
|
||||
|
||||
You can then open https://localhost:443/ to view Laplace page.
|
||||
You may need to add certificate exceptions. In Chrome, you can type `thisisunsafe`.
|
||||
|
||||
|
||||
|
||||
## Contributing
|
||||
|
||||
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
[MIT](https://choosealicense.com/licenses/mit/)
|
||||
43
plugin/packageManager.go
Normal file
43
plugin/packageManager.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package plugin
|
||||
|
||||
import (
|
||||
"git.sr.ht/~akilan1999/p2p-rendering-computation/config"
|
||||
"github.com/go-git/go-git/v5"
|
||||
"os"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// DownloadPlugin This functions downloads package from
|
||||
// a git repo
|
||||
func DownloadPlugin(pluginurl string) error {
|
||||
// paring plugin url
|
||||
u, err := url.Parse(pluginurl)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
path := u.Path
|
||||
// Trim first character of the string
|
||||
path = path[1:]
|
||||
// trim last element of the string
|
||||
path = path[:len(path)-1]
|
||||
// Replaces / with _
|
||||
folder := strings.Replace(path, "/", "_", -1)
|
||||
// Reads plugin path from the config path
|
||||
config, err := config.ConfigInit()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// clones a repo and stores it at the plugin directory
|
||||
_, err = git.PlainClone(config.PluginPath + "/" + folder, false, &git.CloneOptions{
|
||||
URL: pluginurl,
|
||||
Progress: os.Stdout,
|
||||
})
|
||||
// returns error if raised
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -235,4 +235,11 @@ func TestCheckRunPlugin(t *testing.T) {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestDownloadPlugin(t *testing.T) {
|
||||
err := DownloadPlugin("https://github.com/Akilan1999/laplace/")
|
||||
if err != nil {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user