This repository has been archived by the owner on Jul 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from gazes-media/main
Add Major updates (Video preview on Discord)
- Loading branch information
Showing
29 changed files
with
256 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package functions | ||
|
||
import ( | ||
"os" | ||
"sync" | ||
"time" | ||
) | ||
|
||
type Cache struct { | ||
data map[string]interface{} | ||
mutex sync.RWMutex | ||
} | ||
|
||
func NewCache() *Cache { | ||
return &Cache{ | ||
data: make(map[string]interface{}), | ||
} | ||
} | ||
|
||
func (c *Cache) Set(key string, value interface{}) { | ||
c.mutex.Lock() | ||
defer c.mutex.Unlock() | ||
c.data[key] = value | ||
// auto remove after 12 hours | ||
go func() { | ||
time.Sleep(12 * time.Hour) | ||
e := os.Remove(value.(string)) | ||
if e == nil { | ||
c.Remove(key) | ||
} | ||
}() | ||
} | ||
|
||
func (c *Cache) Get(key string) (interface{}, bool) { | ||
c.mutex.RLock() | ||
defer c.mutex.RUnlock() | ||
value, found := c.data[key] | ||
return value, found | ||
} | ||
|
||
func (c *Cache) Remove(key string) { | ||
c.mutex.Lock() | ||
defer c.mutex.Unlock() | ||
delete(c.data, key) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package functions | ||
|
||
import ( | ||
"net/http" | ||
"crypto/tls" | ||
) | ||
|
||
type HttpClient struct { | ||
client *http.Client | ||
} | ||
|
||
func NewHttpClient() *HttpClient { | ||
return &HttpClient{ | ||
client: &http.Client{ | ||
Transport: &http.Transport{ | ||
TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, // ignore expired SSL certificates | ||
}, | ||
}, | ||
} | ||
} | ||
|
||
func (c *HttpClient) Get(url string) (*http.Response, error) { | ||
return c.client.Get(url) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
public/assets/errors-4a626a97.js → public/assets/errors-adf7cfe7.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
public/assets/errors-4a626a97.js.map → public/assets/errors-adf7cfe7.js.map
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 4 additions & 4 deletions
8
public/assets/index-d8a8d4d1.js → public/assets/index-6ed63385.js
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
public/assets/index-d8a8d4d1.js.map → public/assets/index-6ed63385.js.map
Large diffs are not rendered by default.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
public/assets/prod-c7a7ffcc.js → public/assets/prod-127d96e2.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.