#522: Fixed hybrid gmail and outlook app to properly work

This commit is contained in:
frikky
2021-10-07 01:51:13 +02:00
parent 030adab327
commit 0887289149
8 changed files with 119 additions and 1731 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ module shuffle
go 1.13 go 1.13
//replace github.com/frikky/shuffle-shared => ../../../../git/shuffle-shared replace github.com/frikky/shuffle-shared => ../../../../git/shuffle-shared
//replace github.com/frikky/kin-openapi => ../../../../git/kin-openapi //replace github.com/frikky/kin-openapi => ../../../../git/kin-openapi
+24 -24
View File
@@ -7,7 +7,7 @@ import (
"bytes" "bytes"
"context" "context"
"crypto/md5" "crypto/md5"
"crypto/tls" //"crypto/tls"
//"crypto/x509" //"crypto/x509"
"encoding/hex" "encoding/hex"
"encoding/json" "encoding/json"
@@ -49,7 +49,7 @@ import (
"github.com/go-git/go-git/v5" "github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/storage/memory" "github.com/go-git/go-git/v5/storage/memory"
githttp "gopkg.in/src-d/go-git.v4/plumbing/transport/http" //githttp "gopkg.in/src-d/go-git.v4/plumbing/transport/http"
// Random // Random
xj "github.com/basgys/goxml2json" xj "github.com/basgys/goxml2json"
@@ -59,7 +59,7 @@ import (
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
// PROXY overrides // PROXY overrides
"gopkg.in/src-d/go-git.v4/plumbing/transport/client" //"gopkg.in/src-d/go-git.v4/plumbing/transport/client"
// githttp "gopkg.in/src-d/go-git.v4/plumbing/transport/http" // githttp "gopkg.in/src-d/go-git.v4/plumbing/transport/http"
// Web // Web
@@ -3591,7 +3591,7 @@ func handleCloudJob(job shuffle.CloudSyncJob) error {
if job.Action == "execute" { if job.Action == "execute" {
// FIXME: Get the email // FIXME: Get the email
ctx := context.Background() ctx := context.Background()
maildata := shuffle.MailData{} maildata := shuffle.MailDataOutlook{}
err := json.Unmarshal([]byte(job.ThirdItem), &maildata) err := json.Unmarshal([]byte(job.ThirdItem), &maildata)
if err != nil { if err != nil {
log.Printf("Maildata unmarshal error: %s", err) log.Printf("Maildata unmarshal error: %s", err)
@@ -3613,7 +3613,7 @@ func handleCloudJob(job shuffle.CloudSyncJob) error {
return err return err
} }
emails, err := getOutlookEmail(outlookClient, maildata) emails, err := shuffle.GetOutlookEmail(outlookClient, maildata)
//log.Printf("EMAILS: %d", len(emails)) //log.Printf("EMAILS: %d", len(emails))
//log.Printf("INSIDE GET OUTLOOK EMAIL!: %#v, %s", emails, err) //log.Printf("INSIDE GET OUTLOOK EMAIL!: %#v, %s", emails, err)
@@ -4135,14 +4135,14 @@ func runInitEs(ctx context.Context) {
log.Printf("[INFO] Getting and validating workflowapps. Got %d with err %#v", len(workflowapps), err) log.Printf("[INFO] Getting and validating workflowapps. Got %d with err %#v", len(workflowapps), err)
// accept any certificate (might be useful for testing) // accept any certificate (might be useful for testing)
customGitClient := &http.Client{ //customGitClient := &http.Client{
Transport: &http.Transport{ // Transport: &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, // TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}, // },
Timeout: 15 * time.Second, // Timeout: 15 * time.Second,
} //}
client.InstallProtocol("http", githttp.NewClient(customGitClient)) //client.InstallProtocol("http", githttp.NewClient(customGitClient))
client.InstallProtocol("https", githttp.NewClient(customGitClient)) //client.InstallProtocol("https", githttp.NewClient(customGitClient))
if err != nil && len(workflowapps) == 0 { if err != nil && len(workflowapps) == 0 {
log.Printf("[WARNING] Failed getting apps (runInit): %s", err) log.Printf("[WARNING] Failed getting apps (runInit): %s", err)
@@ -5855,20 +5855,20 @@ func initHandlers() {
r.HandleFunc("/api/v1/get_openapi/{key}", getOpenapi).Methods("GET", "OPTIONS") r.HandleFunc("/api/v1/get_openapi/{key}", getOpenapi).Methods("GET", "OPTIONS")
// Specific triggers // Specific triggers
r.HandleFunc("/api/v1/workflows/{key}/outlook", handleCreateOutlookSub).Methods("POST", "OPTIONS") r.HandleFunc("/api/v1/workflows/{key}/outlook", shuffle.HandleCreateOutlookSub).Methods("POST", "OPTIONS")
r.HandleFunc("/api/v1/workflows/{key}/outlook/{triggerId}", handleDeleteOutlookSub).Methods("DELETE", "OPTIONS") r.HandleFunc("/api/v1/workflows/{key}/outlook/{triggerId}", shuffle.HandleDeleteOutlookSub).Methods("DELETE", "OPTIONS")
r.HandleFunc("/api/v1/triggers/outlook/register", handleNewOutlookRegister).Methods("GET", "OPTIONS") r.HandleFunc("/api/v1/triggers/outlook/register", shuffle.HandleNewOutlookRegister).Methods("GET", "OPTIONS")
r.HandleFunc("/api/v1/triggers/outlook/getFolders", shuffle.HandleGetOutlookFolders).Methods("GET", "OPTIONS") r.HandleFunc("/api/v1/triggers/outlook/getFolders", shuffle.HandleGetOutlookFolders).Methods("GET", "OPTIONS")
r.HandleFunc("/api/v1/triggers/outlook/{key}", handleGetSpecificTrigger).Methods("GET", "OPTIONS") r.HandleFunc("/api/v1/triggers/outlook/{key}", shuffle.HandleGetSpecificTrigger).Methods("GET", "OPTIONS")
r.HandleFunc("/api/v1/triggers/gmail/register", handleNewGmailRegister).Methods("GET", "OPTIONS") r.HandleFunc("/api/v1/triggers/gmail/register", shuffle.HandleNewGmailRegister).Methods("GET", "OPTIONS")
r.HandleFunc("/api/v1/triggers/gmail/getFolders", shuffle.HandleGetGmailFolders).Methods("GET", "OPTIONS") r.HandleFunc("/api/v1/triggers/gmail/getFolders", shuffle.HandleGetGmailFolders).Methods("GET", "OPTIONS")
// FIXME: This should only be cloud. Done locally with ngrok to test // FIXME: This should only be cloud. Done locally with ngrok to test
r.HandleFunc("/api/v1/triggers/gmail/routing", handleGmailRouting).Methods("POST", "OPTIONS") //r.HandleFunc("/api/v1/triggers/gmail/routing", handleGmailRouting).Methods("POST", "OPTIONS")
r.HandleFunc("/api/v1/triggers/gmail/{key}", handleGetSpecificTrigger).Methods("GET", "OPTIONS") r.HandleFunc("/api/v1/triggers/gmail/{key}", shuffle.HandleGetSpecificTrigger).Methods("GET", "OPTIONS")
r.HandleFunc("/api/v1/workflows/{key}/gmail", handleCreateGmailSub).Methods("POST", "OPTIONS") r.HandleFunc("/api/v1/workflows/{key}/gmail", shuffle.HandleCreateGmailSub).Methods("POST", "OPTIONS")
r.HandleFunc("/api/v1/workflows/{key}/gmail/{triggerId}", handleDeleteGmailSub).Methods("DELETE", "OPTIONS") r.HandleFunc("/api/v1/workflows/{key}/gmail/{triggerId}", shuffle.HandleDeleteGmailSub).Methods("DELETE", "OPTIONS")
//r.HandleFunc("/api/v1/triggers/gmail/{key}", handleGetSpecificGmailTrigger).Methods("GET", "OPTIONS") //r.HandleFunc("/api/v1/triggers/gmail/{key}", handleGetSpecificGmailTrigger).Methods("GET", "OPTIONS")
//r.HandleFunc("/api/v1/triggers/outlook/getFolders", shuffle.HandleGetOutlookFolders).Methods("GET", "OPTIONS") //r.HandleFunc("/api/v1/triggers/outlook/getFolders", shuffle.HandleGetOutlookFolders).Methods("GET", "OPTIONS")
@@ -5879,8 +5879,8 @@ func initHandlers() {
// EVERYTHING below here is NEW for 0.8.0 (written 25.05.2021) // EVERYTHING below here is NEW for 0.8.0 (written 25.05.2021)
r.HandleFunc("/api/v1/workflows/{key}/publish", makeWorkflowPublic).Methods("POST", "OPTIONS") r.HandleFunc("/api/v1/workflows/{key}/publish", makeWorkflowPublic).Methods("POST", "OPTIONS")
r.HandleFunc("/api/v1/cloud/setup", handleCloudSetup).Methods("POST", "OPTIONS") r.HandleFunc("/api/v1/cloud/setup", handleCloudSetup).Methods("POST", "OPTIONS")
r.HandleFunc("/api/v1/orgs", shuffle.HandleGetOrgs).Methods("GET", "OPTIONS") //r.HandleFunc("/api/v1/orgs", shuffle.HandleGetOrgs).Methods("GET", "OPTIONS")
r.HandleFunc("/api/v1/orgs/", shuffle.HandleGetOrgs).Methods("GET", "OPTIONS") //r.HandleFunc("/api/v1/orgs/", shuffle.HandleGetOrgs).Methods("GET", "OPTIONS")
r.HandleFunc("/api/v1/orgs/{orgId}", shuffle.HandleGetOrg).Methods("GET", "OPTIONS") r.HandleFunc("/api/v1/orgs/{orgId}", shuffle.HandleGetOrg).Methods("GET", "OPTIONS")
r.HandleFunc("/api/v1/orgs/{orgId}", shuffle.HandleEditOrg).Methods("POST", "OPTIONS") r.HandleFunc("/api/v1/orgs/{orgId}", shuffle.HandleEditOrg).Methods("POST", "OPTIONS")
r.HandleFunc("/api/v1/orgs/{orgId}/create_sub_org", shuffle.HandleCreateSubOrg).Methods("POST", "OPTIONS") r.HandleFunc("/api/v1/orgs/{orgId}/create_sub_org", shuffle.HandleCreateSubOrg).Methods("POST", "OPTIONS")
File diff suppressed because it is too large Load Diff
+7 -2
View File
@@ -1080,9 +1080,14 @@ func deleteWorkflow(resp http.ResponseWriter, request *http.Request) {
// log.Printf("Failed to delete webhook: %s", err) // log.Printf("Failed to delete webhook: %s", err)
//} //}
} else if item.TriggerType == "EMAIL" { } else if item.TriggerType == "EMAIL" {
err = handleOutlookSubRemoval(ctx, user, workflow.ID, item.ID) err = shuffle.HandleOutlookSubRemoval(ctx, user, workflow.ID, item.ID)
if err != nil { if err != nil {
log.Printf("Failed to delete email sub: %s", err) log.Printf("Failed to delete OUTLOOK email sub (checking gmail after): %s", err)
}
err = shuffle.HandleGmailSubRemoval(ctx, user, workflow.ID, item.ID)
if err != nil {
log.Printf("Failed to delete gmail email sub: %s", err)
} }
} }
File diff suppressed because one or more lines are too long
+2
View File
@@ -1153,6 +1153,8 @@ const AppCreator = (props) => {
if (queryitem.name.toLowerCase() == "url" if (queryitem.name.toLowerCase() == "url"
|| queryitem.name.toLowerCase() == "body" || queryitem.name.toLowerCase() == "body"
|| queryitem.name.toLowerCase() == "self"
|| queryitem.name.toLowerCase() == "ssl_verify"
|| queryitem.name.toLowerCase() == "queries" || queryitem.name.toLowerCase() == "queries"
|| queryitem.name.toLowerCase() == "headers" || queryitem.name.toLowerCase() == "headers"
|| queryitem.name.includes("[") || queryitem.name.includes("[")
+5 -2
View File
@@ -1069,9 +1069,12 @@ const Apps = (props) => {
<CircularProgress style={{width: 40, height: 40, margin: "auto"}}/> <CircularProgress style={{width: 40, height: 40, margin: "auto"}}/>
: :
<Paper square style={uploadViewPaperStyle}> <Paper square style={uploadViewPaperStyle}>
<h4 style={{margin: 10}}> <Typography variant="h6" style={{margin: 10}}>
No apps have been created, uploaded or downloaded yet. Click "Load existing apps" above to get the baseline. This may take a while as its building docker images. No apps have been created, uploaded or downloaded yet. Click "Load existing apps" above to get the baseline. This may take a while as its building docker images.
</h4> </Typography>
<Typography variant="h6" style={{margin: 10}}>
If you're still not able to see any apps, please follow our <a href={"https://shuffler.io/docs/troubleshooting#load_all_apps_locally"} style={{textDecoration: "none", color: "#f85a3e"}} target="_blank">troubleshooting guide for loading apps!</a>
</Typography>
</Paper> </Paper>
} }
</div> </div>
+12 -2
View File
@@ -187,6 +187,7 @@ const Docs = (props) => {
} }
const parseElementScroll = () => { const parseElementScroll = () => {
const offset = 45
var parent = document.getElementById("markdown_wrapper_outer") var parent = document.getElementById("markdown_wrapper_outer")
if (parent !== null) { if (parent !== null) {
//console.log("IN PARENT") //console.log("IN PARENT")
@@ -204,7 +205,12 @@ const Docs = (props) => {
// Fix location.. // Fix location..
if (element.innerHTML.toLowerCase() === name) { if (element.innerHTML.toLowerCase() === name) {
element.scrollIntoView({behavior: "smooth"}) console.log(element.offsetTop)
//element.scrollIntoView({behavior: "smooth"})
element.scrollTo({
top: element.offsetTop+offset,
behavior: "smooth"
})
found = true found = true
//element.scrollTo({ //element.scrollTo({
// top: element.offsetTop-100, // top: element.offsetTop-100,
@@ -226,7 +232,11 @@ const Docs = (props) => {
// Fix location.. // Fix location..
if (element.innerHTML.toLowerCase() === name) { if (element.innerHTML.toLowerCase() === name) {
element.scrollIntoView({behavior: "smooth"}) //element.scrollIntoView({behavior: "smooth"})
element.scrollTo({
top: element.offsetTop-offset,
behavior: "smooth"
})
found = true found = true
//element.scrollTo({ //element.scrollTo({
// top: element.offsetTop-100, // top: element.offsetTop-100,