Added more potential for liquid formatting and usecase discovery
This commit is contained in:
@@ -3,6 +3,7 @@ import copy
|
||||
import sys
|
||||
import re
|
||||
import time
|
||||
import base64
|
||||
import json
|
||||
import liquid
|
||||
import logging
|
||||
@@ -48,10 +49,52 @@ def minus(a, b):
|
||||
b = int(b)
|
||||
return standard_filter_manager.filters["minus"](a, b)
|
||||
|
||||
@shuffle_filters.register
|
||||
def multiply(a, b):
|
||||
a = int(a)
|
||||
b = int(b)
|
||||
return standard_filter_manager.filters["multiply"](a, b)
|
||||
|
||||
@shuffle_filters.register
|
||||
def divide(a, b):
|
||||
a = int(a)
|
||||
b = int(b)
|
||||
return standard_filter_manager.filters["divide"](a, b)
|
||||
|
||||
@shuffle_filters.register
|
||||
def md5(a):
|
||||
a = str(a)
|
||||
return hashlib.md5(a.encode('utf-8')).hexdigest()
|
||||
|
||||
@shuffle_filters.register
|
||||
def sha256(a):
|
||||
a = str(a)
|
||||
return hashlib.sha256(str(a).encode("utf-8")).hexdigest()
|
||||
|
||||
@shuffle_filters.register
|
||||
def md5_base64(a):
|
||||
a = str(a)
|
||||
foundhash = hashlib.md5(a.encode('utf-8')).hexdigest()
|
||||
return base64.b64encode(foundhash.encode('utf-8'))
|
||||
|
||||
@shuffle_filters.register
|
||||
def base64_encode(a):
|
||||
a = str(a)
|
||||
return base64.b64encode(a.encode('utf-8')).decode()
|
||||
|
||||
@shuffle_filters.register
|
||||
def base64_decode(a):
|
||||
a = str(a)
|
||||
return base64.b64decode(a).decode()
|
||||
|
||||
#print(standard_filter_manager.filters)
|
||||
#print(shuffle_filters.filters)
|
||||
print(Liquid("{{ '10' | plus: 1}}", filters=shuffle_filters.filters).render())
|
||||
print(Liquid("{{ '10' | minus: 1}}", filters=shuffle_filters.filters).render())
|
||||
#print(Liquid("{{ '10' | plus: 1}}", filters=shuffle_filters.filters).render())
|
||||
#print(Liquid("{{ '10' | minus: 1}}", filters=shuffle_filters.filters).render())
|
||||
#print(Liquid("{{ asd | size }}", filters=shuffle_filters.filters).render())
|
||||
#print(Liquid("{{ 'asd' | md5 }}", filters=shuffle_filters.filters).render())
|
||||
#print(Liquid("{{ 'asd' | sha256 }}", filters=shuffle_filters.filters).render())
|
||||
#print(Liquid("{{ 'asd' | md5_base64 | base64_decode }}", filters=shuffle_filters.filters).render())
|
||||
|
||||
###
|
||||
###
|
||||
@@ -1855,7 +1898,7 @@ class AppBase:
|
||||
if len(template) > 100:
|
||||
self.logger.info("[DEBUG] Running liquid with data of length %d" % len(template))
|
||||
#self.logger.info(f"[DEBUG] Data: {template}")
|
||||
run = Liquid(template, mode="wild", from_file=False)
|
||||
run = Liquid(template, mode="wild", from_file=False, filters=shuffle_filters.filters)
|
||||
|
||||
# Can't handle self yet (?)
|
||||
ret = run.render(**globals())
|
||||
|
||||
@@ -2,7 +2,7 @@ module main
|
||||
|
||||
go 1.16
|
||||
|
||||
replace github.com/shuffle/shuffle-shared => ../../../shuffle-shared
|
||||
//replace github.com/shuffle/shuffle-shared => ../../../shuffle-shared
|
||||
|
||||
//replace github.com/frikky/kin-openapi => ../../../../git/kin-openapi
|
||||
//replace github.com/frikky/go-elasticsearch => ../../../../git/go-elasticsearch
|
||||
@@ -24,7 +24,7 @@ require (
|
||||
github.com/h2non/filetype v1.1.3
|
||||
github.com/nirasan/go-oauth-pkce-code-verifier v0.0.0-20170819232839-0fbfe93532da // indirect
|
||||
github.com/satori/go.uuid v1.2.0
|
||||
github.com/shuffle/shuffle-shared v0.2.3
|
||||
github.com/shuffle/shuffle-shared v0.2.4
|
||||
go4.org v0.0.0-20201209231011-d4a079459e60 // indirect
|
||||
golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce
|
||||
google.golang.org/api v0.65.0
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
version: '3'
|
||||
services:
|
||||
frontend:
|
||||
#build: ./frontend
|
||||
build: ./frontend
|
||||
image: ghcr.io/frikky/shuffle-frontend:nightly
|
||||
container_name: shuffle-frontend
|
||||
hostname: shuffle-frontend
|
||||
|
||||
@@ -15,7 +15,7 @@ import theme from "./theme";
|
||||
import Apps from "./views/Apps";
|
||||
import AppCreator from "./views/AppCreator";
|
||||
|
||||
import Dashboard from "./views/Dashboard";
|
||||
import Dashboard from "./views/Dashboard.jsx";
|
||||
import AdminSetup from "./views/AdminSetup";
|
||||
import Admin from "./views/Admin";
|
||||
import Docs from "./views/Docs";
|
||||
|
||||
@@ -812,7 +812,7 @@ const Dashboard = (props) => {
|
||||
</div>
|
||||
|
||||
{usecases !== null && usecases !== undefined && usecases.length > 0 ?
|
||||
<div style={{ display: "flex", marginLeft: 100,}}>
|
||||
<div style={{ display: "flex", marginLeft: 120,}}>
|
||||
{usecases.map((usecase, index) => {
|
||||
return (
|
||||
<Chip
|
||||
|
||||
@@ -2191,7 +2191,7 @@ const GettingStarted = (props) => {
|
||||
ele.style.borderWidth = "2px"
|
||||
|
||||
} else {
|
||||
alert.success("TBD: Coming in version 1.0.0");
|
||||
//alert.success("TBD: Coming in version 1.0.0");
|
||||
}
|
||||
}}>
|
||||
workflows made by other creators</span>!
|
||||
@@ -2211,7 +2211,7 @@ const GettingStarted = (props) => {
|
||||
Learn to use Shuffle by
|
||||
<span style={{cursor: "pointer", color: "#f86a3e",}} onClick={() => {setModalOpen(true)}}>
|
||||
creating your first workflow
|
||||
</span> and <Link to="/docs" style={{textDecoration: "none", color: "#f86a3e",}}>reading the docs.</Link>
|
||||
</span> and <Link to="/docs/getting_started" style={{textDecoration: "none", color: "#f86a3e",}}>reading the docs.</Link>
|
||||
</Typography>
|
||||
),
|
||||
tutorial: "learn_shuffle",
|
||||
|
||||
@@ -733,7 +733,7 @@ const Settings = (props) => {
|
||||
{isCloud ?
|
||||
<span>
|
||||
<Typography variant="body1" color="textSecondary">
|
||||
By connecting your Github account, you agree to our <a href="/docs/terms-of-service" target="_blank" style={{ textDecoration: "none", color: "#f86a3e"}}>Terms of Service</a>, and acknowledge that your non-sensitive data will be turned into a <a target="_blank" style={{ textDecoration: "none", color: "#f86a3e"}} href="https://shuffler.io/search?tab=creators">creator account</a>. This enables you to earn a passive income from Shuffle. This IS reversible.
|
||||
By connecting your Github account, you agree to our <a href="/docs/terms_of_service" target="_blank" style={{ textDecoration: "none", color: "#f86a3e"}}>Terms of Service</a>, and acknowledge that your non-sensitive data will be turned into a <a target="_blank" style={{ textDecoration: "none", color: "#f86a3e"}} href="https://shuffler.io/search?tab=creators">creator account</a>. This enables you to earn a passive income from Shuffle. This IS reversible.
|
||||
</Typography>
|
||||
<Button
|
||||
style={{ height: 40, marginTop: 10 }}
|
||||
|
||||
@@ -2885,7 +2885,7 @@ const Workflows = (props) => {
|
||||
return (
|
||||
<div style={viewStyle}>
|
||||
<div style={workflowViewStyle}>
|
||||
<div style={{ display: "flex" }}>
|
||||
<div style={{ display: "flex", marginTop: 25, }}>
|
||||
<div style={{ flex: 1 }}>
|
||||
<Typography variant="h1" style={{fontSize: 30}}>
|
||||
Workflows
|
||||
@@ -2994,9 +2994,9 @@ const Workflows = (props) => {
|
||||
backgroundColor: filters.includes(usecase.name.toLowerCase()) ? usecase.color : theme.palette.surfaceColor,
|
||||
borderRadius: theme.palette.borderRadius,
|
||||
marginRight: index === usecases.length-1 ? 0 : 10,
|
||||
height: 65,
|
||||
height: 60,
|
||||
cursor: "pointer",
|
||||
border: `1px solid ${usecase.color}`,
|
||||
border: `2px solid ${usecase.color}`,
|
||||
overflow: "hidden",
|
||||
padding: 10,
|
||||
}}
|
||||
@@ -3017,7 +3017,7 @@ const Workflows = (props) => {
|
||||
{usecase.name}
|
||||
</Typography>
|
||||
<Typography variant="body2" color="textSecondary">
|
||||
Finished: {usecase.matches.length}/{usecase.list.length}
|
||||
In use: {usecase.matches.length}/{usecase.list.length}
|
||||
</Typography>
|
||||
</a>
|
||||
</Paper>
|
||||
|
||||
Reference in New Issue
Block a user