mirror of
https://github.com/go-i2p/go-i2pbrowser.git
synced 2025-06-08 10:31:51 -04:00
update index.html
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
i2pbrowser/i2pbrowser
|
16
README.md
16
README.md
@ -2,9 +2,25 @@
|
||||
--
|
||||
import "github.com/eyedeekay/go-i2pbrowser"
|
||||
|
||||
Package goi2pbrowser is a package which can be used to manage an I2P browsing
|
||||
profile using a pre-configured, common profile which is used by the I2P
|
||||
Easy-Install bundle and the i2p.plugins.firefox profile manager. It is a Go
|
||||
clone of i2p.plugins.firefox for use in native applications.
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
var BaseProfile []byte
|
||||
```
|
||||
BaseProfile is a zip of a Firefox profile with NoScript, HTTPS Everywhere, and
|
||||
I2PIPB
|
||||
|
||||
```go
|
||||
var UsabilityProfile []byte
|
||||
```
|
||||
UsabilityProfile is a zip of a Firefox profile with Jshelter, HTTPS Everywhere,
|
||||
uBlock Origin, LocalCDN, OICT, and I2PIPB
|
||||
|
||||
#### func BrowseStrict
|
||||
|
||||
```go
|
||||
|
11
embed.go
11
embed.go
@ -1,14 +1,15 @@
|
||||
//go:build !generate
|
||||
// +build !generate
|
||||
|
||||
package goi2pbrowser
|
||||
|
||||
import _ "embed"
|
||||
|
||||
// BaseProfile is a zip of a Firefox profile with NoScript, HTTPS Everywhere, and I2PIPB
|
||||
//
|
||||
//go:embed i2p.firefox.base.profile.zip
|
||||
var baseProfile []byte
|
||||
var BaseProfile []byte
|
||||
|
||||
// UsabilityProfile is a zip of a Firefox profile with Jshelter, HTTPS Everywhere, uBlock Origin, LocalCDN, OICT, and I2PIPB
|
||||
//
|
||||
//go:embed i2p.firefox.usability.profile.zip
|
||||
var usabilityProfile []byte
|
||||
var UsabilityProfile []byte
|
||||
|
||||
//go:generate go run --tags=generate generate.go
|
||||
|
46
i2pbrowser/main.go
Normal file
46
i2pbrowser/main.go
Normal file
@ -0,0 +1,46 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
goi2pbrowser "github.com/eyedeekay/go-i2pbrowser"
|
||||
)
|
||||
|
||||
var (
|
||||
u = flag.Bool("usability", false, "Launch in usability mode")
|
||||
d = flag.String("directory", defaultDir(), "Directory to store profiles in")
|
||||
)
|
||||
|
||||
func defaultDir() string {
|
||||
wd, err := os.Getwd()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
ret := filepath.Join(wd, "i2p-profiles")
|
||||
userHome, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if wd == userHome {
|
||||
ret = filepath.Join(userHome, ".i2p/plugins/i2pbrowser")
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
url := "http://127.0.0.1:7657"
|
||||
if len(flag.Args()) > 0 {
|
||||
url = flag.Arg(0)
|
||||
}
|
||||
usability := *u
|
||||
switch usability {
|
||||
case true:
|
||||
goi2pbrowser.BrowseUsability(*d, url)
|
||||
default:
|
||||
goi2pbrowser.BrowseStrict(*d, url)
|
||||
}
|
||||
}
|
18
index.html
18
index.html
@ -45,9 +45,27 @@
|
||||
–
|
||||
import “github.com/eyedeekay/go-i2pbrowser”
|
||||
</p>
|
||||
<p>
|
||||
Package goi2pbrowser is a package which can be used to manage an I2P browsing
|
||||
profile using a pre-configured, common profile which is used by the I2P
|
||||
Easy-Install bundle and the i2p.plugins.firefox profile manager. It is a Go
|
||||
clone of i2p.plugins.firefox for use in native applications.
|
||||
</p>
|
||||
<h2>
|
||||
Usage
|
||||
</h2>
|
||||
<pre><code class="language-go">var BaseProfile []byte
|
||||
</code></pre>
|
||||
<p>
|
||||
BaseProfile is a zip of a Firefox profile with NoScript, HTTPS Everywhere, and
|
||||
I2PIPB
|
||||
</p>
|
||||
<pre><code class="language-go">var UsabilityProfile []byte
|
||||
</code></pre>
|
||||
<p>
|
||||
UsabilityProfile is a zip of a Firefox profile with Jshelter, HTTPS Everywhere,
|
||||
uBlock Origin, LocalCDN, OICT, and I2PIPB
|
||||
</p>
|
||||
<h4>
|
||||
func BrowseStrict
|
||||
</h4>
|
||||
|
49
run.go
Normal file
49
run.go
Normal file
@ -0,0 +1,49 @@
|
||||
// Package goi2pbrowser is a package which can be used to manage an I2P browsing
|
||||
// profile using a pre-configured, common profile which is used by the I2P Easy-Install
|
||||
// bundle and the i2p.plugins.firefox profile manager. It is a Go clone of
|
||||
// i2p.plugins.firefox for use in native applications.
|
||||
package goi2pbrowser
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
fcw "github.com/eyedeekay/go-fpw"
|
||||
)
|
||||
|
||||
// BrowseStrict launches a Firefox browser configured to use I2P and waits for it to exit.
|
||||
// The profile is in "Strict" mode
|
||||
func BrowseStrict(profileDir, url string) {
|
||||
var profilePath string
|
||||
var err error
|
||||
profilePath, err = UnpackBase(profileDir)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
FIREFOX, ERROR := fcw.BasicFirefox(profilePath, false, url)
|
||||
if ERROR != nil {
|
||||
log.Println(ERROR)
|
||||
return
|
||||
}
|
||||
defer FIREFOX.Close()
|
||||
<-FIREFOX.Done()
|
||||
}
|
||||
|
||||
// BrowseUsability launches a Firefox browser configured to use I2P and waits for it to exit.
|
||||
// The profile is in "Usability" mode
|
||||
func BrowseUsability(profileDir, url string) {
|
||||
var profilePath string
|
||||
var err error
|
||||
profilePath, err = UnpackUsability(profileDir)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
FIREFOX, ERROR := fcw.BasicFirefox(profilePath, false, url)
|
||||
if ERROR != nil {
|
||||
log.Println(ERROR)
|
||||
return
|
||||
}
|
||||
defer FIREFOX.Close()
|
||||
<-FIREFOX.Done()
|
||||
}
|
@ -1,6 +1,3 @@
|
||||
//go:build !generate
|
||||
// +build !generate
|
||||
|
||||
package goi2pbrowser
|
||||
|
||||
import (
|
||||
@ -29,7 +26,7 @@ func UnpackBase(profileDir string) (string, error) {
|
||||
}
|
||||
os.MkdirAll(filepath.Dir(profileDir), 0755)
|
||||
zipFile := filepath.Join(filepath.Dir(profileDir), "i2p.firefox.base.profile.zip")
|
||||
err := ioutil.WriteFile(zipFile, baseProfile, 0644)
|
||||
err := ioutil.WriteFile(zipFile, BaseProfile, 0644)
|
||||
if err != nil {
|
||||
return filepath.Join(profileDir, "i2p.firefox.base.profile"), err
|
||||
}
|
||||
@ -51,7 +48,7 @@ func UnpackUsability(profileDir string) (string, error) {
|
||||
}
|
||||
os.MkdirAll(filepath.Dir(profileDir), 0755)
|
||||
zipFile := filepath.Join(filepath.Dir(profileDir), "i2p.firefox.usability.profile.zip")
|
||||
err := ioutil.WriteFile(zipFile, usabilityProfile, 0644)
|
||||
err := ioutil.WriteFile(zipFile, UsabilityProfile, 0644)
|
||||
if err != nil {
|
||||
return filepath.Join(profileDir, "i2p.firefox.usability.profile"), err
|
||||
}
|
||||
|
Reference in New Issue
Block a user