Merge pull request #135 from openreplay/dev

v1.3.0 hotfix(1)
This commit is contained in:
Alex K 2021-08-07 18:11:00 +08:00 committed by GitHub
commit 5e44cb9a3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 20 additions and 17 deletions

View file

@ -34,7 +34,7 @@
OpenReplay is a session replay stack that lets you see what users do on your web app, helping you troubleshoot issues faster. It's the only open-source alternative to products such as FullStory and LogRocket.
- **Session replay.** OpenReplay replays what users do, but not only. It also shows you what went under the hood, how your website or app behaves by capturing network activity, console logs, JS errors, store actions/state, page speed metrics, cpu/memory usage and much more.
- **Low footprint**. With a ~16KB (.gz) tracker that asynchronously sends minimal data for a very limited impact on performance.
- **Low footprint**. With a ~18KB (.gz) tracker that asynchronously sends minimal data for a very limited impact on performance.
- **Self-hosted**. No more security compliance checks, 3rd-parties processing user data. Everything OpenReplay captures stays in your cloud for a complete control over your data.
- **Privacy controls**. Fine-grained security features for sanitizing user data.
- **Easy deploy**. With support of major public cloud providers (AWS, GCP, Azure, DigitalOcean).

View file

@ -71,7 +71,8 @@ func ResolveCSS(baseURL string, css string) string {
func (r *Rewriter) RewriteCSS(sessionID uint64, baseurl string, css string) string {
css = rewriteLinks(css, func(rawurl string) string {
return r.RewriteURL(sessionID, baseurl, rawurl)
url , _ := r.RewriteURL(sessionID, baseurl, rawurl)
return url
})
return strings.Replace(css, ":hover", ".-asayer-hover", -1)
}

View file

@ -57,7 +57,7 @@ func GetFullCachableURL(baseURL string, relativeURL string) (string, bool) {
const OPENREPLAY_QUERY_START = "OPENREPLAY_QUERY"
func getCachePath(rawurl string) string {
return strings.ReplaceAll(url.QueryEscape(rawurl), "%", "!") // s3 keys are ok with "!"
return "/" + strings.ReplaceAll(url.QueryEscape(rawurl), "%", "!") // s3 keys are ok with "!"
// u, _ := url.Parse(rawurl)
// s := "/" + u.Scheme + "/" + u.Hostname() + u.Path
// if u.RawQuery != "" {
@ -82,14 +82,14 @@ func GetCachePathForAssets(sessionID uint64, rawurl string) string {
}
func (r *Rewriter) RewriteURL(sessionID uint64, baseURL string, relativeURL string) string {
func (r *Rewriter) RewriteURL(sessionID uint64, baseURL string, relativeURL string) (string, bool) {
// TODO: put it in one check within GetFullCachableURL
if !isRelativeCachable(relativeURL) {
return relativeURL
return relativeURL, false
}
fullURL := ResolveURL(baseURL, relativeURL)
if !isCachable(fullURL) {
return relativeURL
return relativeURL, false
}
u := url.URL{
@ -98,6 +98,6 @@ func (r *Rewriter) RewriteURL(sessionID uint64, baseURL string, relativeURL stri
Scheme: r.assetsURL.Scheme,
}
return u.String()
return u.String(), true
}

View file

@ -21,8 +21,11 @@ func sendAssetsForCacheFromCSS(sessionID uint64, baseURL string, css string) {
func handleURL(sessionID uint64, baseURL string, url string) string {
if cacheAssets {
sendAssetForCache(sessionID, baseURL, url)
return rewriter.RewriteURL(sessionID, baseURL, url)
rewrittenURL, isCachable := rewriter.RewriteURL(sessionID, baseURL, url)
if isCachable {
sendAssetForCache(sessionID, baseURL, url)
}
return rewrittenURL
}
return assets.ResolveURL(baseURL, url)
}

View file

@ -66,15 +66,15 @@ func startSessionHandlerWeb(w http.ResponseWriter, r *http.Request) {
return
}
dice := byte(rand.Intn(100)) // [0, 100)
if dice >= p.SampleRate {
responseWithError(w, http.StatusForbidden, errors.New("cancel"))
return
}
userUUID := getUUID(req.UserUUID)
tokenData, err := tokenizer.Parse(req.Token)
if err != nil || req.Reset { // Starting the new one
dice := byte(rand.Intn(100)) // [0, 100)
if dice >= p.SampleRate {
responseWithError(w, http.StatusForbidden, errors.New("cancel"))
return
}
ua := uaParser.ParseFromHTTPRequest(r)
if ua == nil {
responseWithError(w, http.StatusForbidden, errors.New("browser not recognized"))

View file

@ -29,7 +29,7 @@ env:
AWS_SECRET_ACCESS_KEY: "m1n10s3CretK3yPassw0rd"
AWS_REGION: us-east-1
POSTGRES_STRING: postgres://postgres:asayerPostgres@postgresql.db.svc.cluster.local:5432
CACHE_ASSETS: true
CACHE_ASSETS: false
#
REDIS_STRING: redis-master.db.svc.cluster.local:6379
KAFKA_SERVERS: kafka.db.svc.cluster.local:9092

View file

@ -43,4 +43,3 @@ env:
KAFKA_SERVERS: kafka.db.svc.cluster.local:9092
KAFKA_USE_SSL: false
LICENSE_KEY: ""
FS_CLEAN_HRS: 12