mirror of
https://github.com/penpot/penpot.git
synced 2026-01-05 21:08:56 -05:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6564736d3e | ||
|
|
ea7768117c | ||
|
|
5bfb39cdf6 | ||
|
|
3f34aa92fa | ||
|
|
b2010e5fd8 | ||
|
|
d5f5c440dd | ||
|
|
9f52709a42 | ||
|
|
85444f5a47 |
@@ -1,5 +1,11 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 2.1.5
|
||||
|
||||
### :bug: Bugs fixed
|
||||
|
||||
- Fix broken webhooks [Taiga #8370](https://tree.taiga.io/project/penpot/issue/8370)
|
||||
|
||||
## 2.1.4
|
||||
|
||||
### :bug: Bugs fixed
|
||||
|
||||
@@ -263,6 +263,8 @@
|
||||
(assoc ::wrk/dedupe dedupe?)
|
||||
(assoc ::wrk/label label)
|
||||
(assoc ::wrk/params (-> params
|
||||
(dissoc :source)
|
||||
(dissoc :context)
|
||||
(dissoc :ip-addr)
|
||||
(dissoc :type)))))))
|
||||
params))
|
||||
|
||||
@@ -66,21 +66,18 @@
|
||||
(defmethod ig/init-key ::process-event-handler
|
||||
[_ cfg]
|
||||
(fn [{:keys [props] :as task}]
|
||||
(let [event (:event props)]
|
||||
(l/dbg :hint "process webhook event" :name (:name event))
|
||||
|
||||
(when-let [items (lookup-webhooks cfg event)]
|
||||
(l/trc :hint "webhooks found for event" :total (count items))
|
||||
|
||||
(db/tx-run! cfg (fn [cfg]
|
||||
(doseq [item items]
|
||||
(wrk/submit! (-> cfg
|
||||
(assoc ::wrk/task :run-webhook)
|
||||
(assoc ::wrk/queue :webhooks)
|
||||
(assoc ::wrk/max-retries 3)
|
||||
(assoc ::wrk/params {:event event
|
||||
:config item}))))))))))
|
||||
(l/dbg :hint "process webhook event" :name (:name props))
|
||||
|
||||
(when-let [items (lookup-webhooks cfg props)]
|
||||
(l/trc :hint "webhooks found for event" :total (count items))
|
||||
(db/tx-run! cfg (fn [cfg]
|
||||
(doseq [item items]
|
||||
(wrk/submit! (-> cfg
|
||||
(assoc ::wrk/task :run-webhook)
|
||||
(assoc ::wrk/queue :webhooks)
|
||||
(assoc ::wrk/max-retries 3)
|
||||
(assoc ::wrk/params {:event props
|
||||
:config item})))))))))
|
||||
;; --- RUN
|
||||
|
||||
(declare interpret-exception)
|
||||
|
||||
@@ -727,13 +727,15 @@
|
||||
deleted 0
|
||||
total 0]
|
||||
(if-let [email (first emails)]
|
||||
(if-let [profile (db/get* system :profile
|
||||
{:email (str/lower email)}
|
||||
{::db/remove-deleted false})]
|
||||
(if-let [profile (some-> (db/get* system :profile
|
||||
{:email (str/lower email)}
|
||||
{::db/remove-deleted false})
|
||||
(profile/decode-row))]
|
||||
(do
|
||||
(audit/insert! system
|
||||
{::audit/name "delete-profile"
|
||||
::audit/type "action"
|
||||
::audit/profile-id (:id profile)
|
||||
::audit/tracked-at deleted-at
|
||||
::audit/props (audit/profile->props profile)
|
||||
::audit/context {:triggered-by "srepl"
|
||||
|
||||
@@ -21,10 +21,9 @@
|
||||
(with-mocks [submit-mock {:target 'app.worker/submit! :return nil}]
|
||||
(let [prof (th/create-profile* 1 {:is-active true})
|
||||
res (th/run-task! :process-webhook-event
|
||||
{:event
|
||||
{:type "command"
|
||||
:name "create-project"
|
||||
:props {:team-id (:default-team-id prof)}}})]
|
||||
{:type "command"
|
||||
:name "create-project"
|
||||
:props {:team-id (:default-team-id prof)}})]
|
||||
|
||||
(t/is (= 0 (:call-count @submit-mock)))
|
||||
(t/is (nil? res)))))
|
||||
@@ -34,10 +33,9 @@
|
||||
(let [prof (th/create-profile* 1 {:is-active true})
|
||||
whk (th/create-webhook* {:team-id (:default-team-id prof)})
|
||||
res (th/run-task! :process-webhook-event
|
||||
{:event
|
||||
{:type "command"
|
||||
:name "create-project"
|
||||
:props {:team-id (:default-team-id prof)}}})]
|
||||
{:type "command"
|
||||
:name "create-project"
|
||||
:props {:team-id (:default-team-id prof)}})]
|
||||
|
||||
(t/is (= 1 (:call-count @submit-mock)))
|
||||
(t/is (nil? res)))))
|
||||
|
||||
18
frontend/resources/templates/challenge.mustache
Normal file
18
frontend/resources/templates/challenge.mustache
Normal file
@@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Penpot - Challenge</title>
|
||||
<link rel="icon" href="images/favicon.png" />
|
||||
|
||||
<script>
|
||||
var params = new URL(document.location.toString()).searchParams;
|
||||
var redirectPath = params.get("redirect");
|
||||
setTimeout(() => {
|
||||
location.href = "/#" + redirectPath;
|
||||
}, 100);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
@@ -333,6 +333,13 @@ async function generateTemplates() {
|
||||
|
||||
await fs.writeFile("./resources/public/index.html", content);
|
||||
|
||||
content = await renderTemplate(
|
||||
"resources/templates/challenge.mustache",
|
||||
{},
|
||||
partials,
|
||||
);
|
||||
await fs.writeFile("./resources/public/challenge.html", content);
|
||||
|
||||
content = await renderTemplate("resources/templates/preview-body.mustache", {
|
||||
manifest: manifest,
|
||||
translations: JSON.stringify(translations),
|
||||
|
||||
@@ -137,13 +137,26 @@
|
||||
(when (not= previous-email email)
|
||||
(set-current-team! nil)))))))
|
||||
|
||||
(defn- on-fetch-profile-exception
|
||||
[cause]
|
||||
(let [data (ex-data cause)]
|
||||
(if (and (= :authorization (:type data))
|
||||
(= :challenge-required (:code data)))
|
||||
(let [path (rt/get-current-path)
|
||||
href (->> path
|
||||
(str "/challenge.html?redirect=")
|
||||
(js/encodeURIComponent))]
|
||||
(rx/of (rt/nav-raw href)))
|
||||
(rx/throw cause))))
|
||||
|
||||
(defn fetch-profile
|
||||
[]
|
||||
(ptk/reify ::fetch-profile
|
||||
ptk/WatchEvent
|
||||
(watch [_ _ _]
|
||||
(->> (rp/cmd! :get-profile)
|
||||
(rx/map profile-fetched)))))
|
||||
(rx/map profile-fetched)
|
||||
(rx/catch on-fetch-profile-exception)))))
|
||||
|
||||
;; --- EVENT: login
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
[cuerdas.core :as str]))
|
||||
|
||||
(defn handle-response
|
||||
[{:keys [status body] :as response}]
|
||||
[{:keys [status body headers] :as response}]
|
||||
(cond
|
||||
(= 204 status)
|
||||
;; We need to send "something" so the streams listening downstream can act
|
||||
@@ -40,6 +40,13 @@
|
||||
{:type :validation
|
||||
:code :request-body-too-large}))
|
||||
|
||||
(and (= status 403)
|
||||
(or (= "cloudflare" (get headers "server"))
|
||||
(= "challenge" (get headers "cf-mitigated"))))
|
||||
(rx/throw (ex-info "http error"
|
||||
{:type :authorization
|
||||
:code :challenge-required}))
|
||||
|
||||
(and (>= status 400) (map? body))
|
||||
(rx/throw (ex-info "http error" body))
|
||||
|
||||
@@ -48,6 +55,7 @@
|
||||
(ex-info "http error"
|
||||
{:type :unexpected-error
|
||||
:status status
|
||||
:headers headers
|
||||
:data body}))))
|
||||
|
||||
(def default-options
|
||||
|
||||
@@ -13,8 +13,10 @@
|
||||
[app.main.data.events :as ev]
|
||||
[app.util.browser-history :as bhistory]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.globals :as globals]
|
||||
[app.util.timers :as ts]
|
||||
[beicon.v2.core :as rx]
|
||||
[cuerdas.core :as str]
|
||||
[goog.events :as e]
|
||||
[potok.v2.core :as ptk]
|
||||
[reitit.core :as r]))
|
||||
@@ -143,6 +145,20 @@
|
||||
(= (.-hostname location) (:host referrer)))
|
||||
(nav-back))))
|
||||
|
||||
(defn nav-raw
|
||||
[href]
|
||||
(ptk/reify ::nav-raw
|
||||
ptk/EffectEvent
|
||||
(effect [_ _ _]
|
||||
(set! (.-href globals/location) href))))
|
||||
|
||||
(defn get-current-path
|
||||
[]
|
||||
(let [hash (.-hash globals/location)]
|
||||
(if (str/starts-with? hash "#")
|
||||
(subs hash 1)
|
||||
hash)))
|
||||
|
||||
;; --- History API
|
||||
|
||||
(defn initialize-history
|
||||
|
||||
Reference in New Issue
Block a user