Skip to content

Commit

Permalink
Remove Sentry/ Fix Helper Error
Browse files Browse the repository at this point in the history
  • Loading branch information
wallydz committed Mar 18, 2020
1 parent 3e45061 commit a76feff
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 226 deletions.
17 changes: 0 additions & 17 deletions packages/client/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ import { lastRelease } from "../helpers/github";
import { repository } from "../helpers/utils";
import { info, error as errorLog, warning } from "../helpers/logger";

// Will be removed after Alpha phase
import { init as initSentry } from "@sentry/electron/dist/main";

import {
SETTINGS as SETTINGS_VIEW,
LOGS as LOGS_VIEW,
Expand All @@ -47,20 +44,6 @@ if (isDev) {
info("Running in development mode");
}

// Will be run only during Alpha
// Will be removed soon
crashReporter.start({
productName: "Desktop",
companyName: "VPN.ht",
submitURL:
"https://sentry.io/api/2765469/minidump/?sentry_key=5cac3e9abc124d6a9b2b1a9dbbcbd96d",
uploadToServer: true
});

initSentry({
dsn: "https://[email protected]/2765469"
});

app.allowRendererProcessReuse = true;

const gotTheLock = app.requestSingleInstanceLock();
Expand Down
6 changes: 0 additions & 6 deletions packages/client/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import React, { useReducer } from "react";
import { webFrame } from "electron";
import { render } from "react-dom";
import isDev from "electron-is-dev";
// Will be removed after Alpha phase
import { init as initSentry } from "@sentry/electron/dist/renderer";

import ApolloClient from "apollo-client";
import { InMemoryCache } from "apollo-cache-inmemory";
Expand All @@ -26,10 +24,6 @@ if (process.platform === "linux") {
webFrame.setZoomFactor(1.2);
}

initSentry({
dsn: "https://[email protected]/2765469"
});

const initialState = {};

const httpLink = new HttpLink({
Expand Down
1 change: 0 additions & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"@fortawesome/free-brands-svg-icons": "^5.12.1",
"@fortawesome/free-solid-svg-icons": "^5.12.1",
"@fortawesome/react-fontawesome": "^0.1.8",
"@sentry/electron": "^1.2.0",
"@shopify/react-form-state": "^0.11.17",
"@shopify/react-graphql": "^6.0.6",
"apollo-boost": "^0.4.7",
Expand Down
16 changes: 6 additions & 10 deletions packages/service/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
"syscall"
"time"

"github.com/sirupsen/logrus"
"github.com/dropbox/godropbox/errors"
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"
"github.com/vpnht/desktop/packages/service/auth"
"github.com/vpnht/desktop/packages/service/autoclean"
"github.com/vpnht/desktop/packages/service/constants"
Expand All @@ -25,8 +25,6 @@ import (
"github.com/vpnht/desktop/packages/service/servers"
"github.com/vpnht/desktop/packages/service/utils"
"github.com/vpnht/desktop/packages/service/watch"

"github.com/getsentry/sentry-go"
)

func main() {
Expand All @@ -36,10 +34,6 @@ func main() {
constants.Development = true
}

sentry.Init(sentry.ClientOptions{
Dsn: "https://[email protected]/2765469",
})

err := utils.PidInit()
if err != nil {
panic(err)
Expand Down Expand Up @@ -159,6 +153,11 @@ func main() {
}()
server.Shutdown(webCtx)
server.Close()

if runtime.GOOS == "linux" || runtime.GOOS == "darwin" {
logrus.Info("Cleaning socket")
syscall.Unlink("/var/run/vpnht.sock")
}
}()

time.Sleep(250 * time.Millisecond)
Expand All @@ -169,7 +168,4 @@ func main() {
}

time.Sleep(750 * time.Millisecond)

sentry.Flush(time.Second * 5)
time.Sleep(750 * time.Millisecond)
}
53 changes: 24 additions & 29 deletions packages/service/servers/servers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,31 @@ package servers
import (
"encoding/json"
"io/ioutil"
"net"
"net/http"
"sync"
"time"
"net"
"fmt"

"github.com/vpnht/desktop/packages/service/event"
"github.com/vpnht/desktop/packages/service/profile"
"github.com/sirupsen/logrus"
"github.com/tatsushid/go-fastping"

"github.com/getsentry/sentry-go"
"github.com/vpnht/desktop/packages/service/event"
"github.com/vpnht/desktop/packages/service/profile"
)

type Server struct {
Online bool `json:"online"`
Host string `json:"host"`
IP string `json:"ip"`
Country string `json:"country"`
CountryName string `json:"countryName"`
Distance float64 `json:"distance"`
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
City string `json:"city"`
Region string `json:"regionName"`
SpeedTest string `json:"speedtest"`
AvgPing time.Duration `json:"avgPing"`
Updated time.Time
Online bool `json:"online"`
Host string `json:"host"`
IP string `json:"ip"`
Country string `json:"country"`
CountryName string `json:"countryName"`
Distance float64 `json:"distance"`
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
City string `json:"city"`
Region string `json:"regionName"`
SpeedTest string `json:"speedtest"`
AvgPing time.Duration `json:"avgPing"`
Updated time.Time
}

var (
Expand Down Expand Up @@ -79,18 +76,18 @@ func PingServersTicker() {
quit := make(chan struct{})
go func() {
for {
select {
case <- ticker.C:
select {
case <-ticker.C:
PingServers()
case <- quit:
case <-quit:
ticker.Stop()
return
}
}
}()
}()

// trigger it right now
PingServers()
// trigger it right now
PingServers()
}

func PingServers() {
Expand Down Expand Up @@ -145,7 +142,7 @@ func PingServers() {

logrus.WithFields(logrus.Fields{
"online": onlineServers,
"all": allServers,
"all": allServers,
}).Info("servers: Ping completed")

// send event to frontend
Expand All @@ -154,8 +151,6 @@ func PingServers() {
}
evt.Init()

sentry.CaptureMessage(fmt.Sprintf("Found %d servers online", onlineServers))

return
}

Expand Down Expand Up @@ -215,7 +210,7 @@ func UpdateServersList() {
Servers.Lock()
Servers.m[value.Host] = value
Servers.Unlock()
}
}

return
}
Expand Down
Loading

0 comments on commit a76feff

Please sign in to comment.