Merge branch 'main' into develop

This commit is contained in:
Andrey Antukh 2021-09-16 11:36:15 +02:00
commit 7fcf481243
6 changed files with 25 additions and 48 deletions

View file

@ -135,7 +135,7 @@
ws-send (mtx/wrap-counter ws-send mtx-messages ["send"])] ws-send (mtx/wrap-counter ws-send mtx-messages ["send"])]
(letfn [(on-connect [conn] (letfn [(on-connect [conn]
(mtx-aconn :inc) ((::mtx/fn mtx-aconn) {:cmd :inc :by 1})
;; A subscription channel should use a lossy buffer ;; A subscription channel should use a lossy buffer
;; because we can't penalize normal clients when one ;; because we can't penalize normal clients when one
;; slow client is connected to the room. ;; slow client is connected to the room.
@ -162,8 +162,8 @@
(a/<! (handle-connect cfg)) (a/<! (handle-connect cfg))
;; when connection is closed ;; when connection is closed
(mtx-aconn :dec) ((::mtx/fn mtx-aconn) {:cmd :dec :by 1})
(mtx-sessions :observe (/ (inst-ms (dt/diff created-at (dt/now))) 1000.0)) ((::mtx/fn mtx-sessions) {:val (/ (inst-ms (dt/diff created-at (dt/now))) 1000.0)})
;; close subscription ;; close subscription
(a/close! sub-ch)))) (a/close! sub-ch))))

View file

@ -5,7 +5,8 @@ ARG DEBIAN_FRONTEND=noninteractive
ENV LANG=en_US.UTF-8 \ ENV LANG=en_US.UTF-8 \
LC_ALL=en_US.UTF-8 \ LC_ALL=en_US.UTF-8 \
NODE_VERSION=v14.17.5 NODE_VERSION=v14.17.5 \
PENPOT_BROWSER_EXECUTABLE_PATH=/usr/bin/chromium
RUN set -ex; \ RUN set -ex; \
mkdir -p /etc/resolvconf/resolv.conf.d; \ mkdir -p /etc/resolvconf/resolv.conf.d; \

View file

@ -35,17 +35,13 @@ PENPOT_SMTP_DEFAULT_REPLY_TO=no-reply@example.com
# PENPOT_SMTP_TLS=true # PENPOT_SMTP_TLS=true
# PENPOT_SMTP_SSL=false # PENPOT_SMTP_SSL=false
# Enable or disable external user registration process. # Feature flags. Right now they are only affect frontend, but in
PENPOT_REGISTRATION_ENABLED=true # future release they will affect to both backend and frontend.
PENPOT_FLAGS="enable-registration enable-demo-users"
# Comma separated list of allowed domains to register. Empty to allow all. # Comma separated list of allowed domains to register. Empty to allow all.
# PENPOT_REGISTRATION_DOMAIN_WHITELIST="" # PENPOT_REGISTRATION_DOMAIN_WHITELIST=""
# Penpot comes with the facility to create quick demo users that are
# automatically deleted after some time. This settings enables or disables the
# creation of demo users.
PENPOT_ALLOW_DEMO_USERS=true
## Authentication providers ## Authentication providers
# Google # Google

View file

@ -9,26 +9,6 @@ log() {
## App Frontend config ## App Frontend config
######################################### #########################################
update_demo_warning() {
if [ -n "$PENPOT_DEMO_WARNING" ]; then
log "Updating Demo Warning: $PENPOT_DEMO_WARNING"
sed -i \
-e "s|^//var penpotDemoWarning = .*;|var penpotDemoWarning = $PENPOT_DEMO_WARNING;|g" \
"$1"
fi
}
update_allow_demo_users() {
if [ -n "$PENPOT_ALLOW_DEMO_USERS" ]; then
log "Updating Allow Demo Users: $PENPOT_ALLOW_DEMO_USERS"
sed -i \
-e "s|^//var penpotAllowDemoUsers = .*;|var penpotAllowDemoUsers = $PENPOT_ALLOW_DEMO_USERS;|g" \
"$1"
fi
}
update_google_client_id() { update_google_client_id() {
if [ -n "$PENPOT_GOOGLE_CLIENT_ID" ]; then if [ -n "$PENPOT_GOOGLE_CLIENT_ID" ]; then
log "Updating Google Client Id: $PENPOT_GOOGLE_CLIENT_ID" log "Updating Google Client Id: $PENPOT_GOOGLE_CLIENT_ID"
@ -67,6 +47,7 @@ update_oidc_client_id() {
fi fi
} }
# DEPRECATED
update_login_with_ldap() { update_login_with_ldap() {
if [ -n "$PENPOT_LOGIN_WITH_LDAP" ]; then if [ -n "$PENPOT_LOGIN_WITH_LDAP" ]; then
log "Updating Login with LDAP: $PENPOT_LOGIN_WITH_LDAP" log "Updating Login with LDAP: $PENPOT_LOGIN_WITH_LDAP"
@ -76,7 +57,7 @@ update_login_with_ldap() {
fi fi
} }
# DEPRECATED
update_registration_enabled() { update_registration_enabled() {
if [ -n "$PENPOT_REGISTRATION_ENABLED" ]; then if [ -n "$PENPOT_REGISTRATION_ENABLED" ]; then
log "Updating Registration Enabled: $PENPOT_REGISTRATION_ENABLED" log "Updating Registration Enabled: $PENPOT_REGISTRATION_ENABLED"
@ -86,14 +67,6 @@ update_registration_enabled() {
fi fi
} }
update_analytics_enabled() {
if [ -n "$PENPOT_ANALYTICS_ENABLED" ]; then
sed -i \
-e "s|^//var penpotAnalyticsEnabled = .*;|var penpotAnalyticsEnabled = $PENPOT_ANALYTICS_ENABLED;|g" \
"$1"
fi
}
update_flags() { update_flags() {
if [ -n "$PENPOT_FLAGS" ]; then if [ -n "$PENPOT_FLAGS" ]; then
sed -i \ sed -i \
@ -102,14 +75,11 @@ update_flags() {
fi fi
} }
update_demo_warning /var/www/app/js/config.js
update_allow_demo_users /var/www/app/js/config.js
update_google_client_id /var/www/app/js/config.js update_google_client_id /var/www/app/js/config.js
update_gitlab_client_id /var/www/app/js/config.js update_gitlab_client_id /var/www/app/js/config.js
update_github_client_id /var/www/app/js/config.js update_github_client_id /var/www/app/js/config.js
update_oidc_client_id /var/www/app/js/config.js update_oidc_client_id /var/www/app/js/config.js
update_login_with_ldap /var/www/app/js/config.js update_login_with_ldap /var/www/app/js/config.js
update_registration_enabled /var/www/app/js/config.js update_registration_enabled /var/www/app/js/config.js
update_analytics_enabled /var/www/app/js/config.js
update_flags /var/www/app/js/config.js update_flags /var/www/app/js/config.js
exec "$@"; exec "$@";

View file

@ -7,13 +7,13 @@
(ns app.config (ns app.config
(:refer-clojure :exclude [get]) (:refer-clojure :exclude [get])
(:require (:require
[app.common.data :as d]
["process" :as process] ["process" :as process]
[cljs.pprint] [app.common.data :as d]
[cuerdas.core :as str]
[app.common.spec :as us] [app.common.spec :as us]
[cljs.spec.alpha :as s]
[cljs.core :as c] [cljs.core :as c]
[cljs.pprint]
[cljs.spec.alpha :as s]
[cuerdas.core :as str]
[lambdaisland.uri :as u])) [lambdaisland.uri :as u]))
(def defaults (def defaults
@ -22,6 +22,7 @@
:browser-concurrency 5 :browser-concurrency 5
:browser-strategy :incognito}) :browser-strategy :incognito})
(s/def ::browser-executable-path ::us/string)
(s/def ::public-uri ::us/string) (s/def ::public-uri ::us/string)
(s/def ::http-server-port ::us/integer) (s/def ::http-server-port ::us/integer)
(s/def ::browser-concurrency ::us/integer) (s/def ::browser-concurrency ::us/integer)
@ -31,7 +32,8 @@
(s/keys :opt-un [::public-uri (s/keys :opt-un [::public-uri
::http-server-port ::http-server-port
::browser-concurrency ::browser-concurrency
::browser-strategy])) ::browser-strategy
::browser-executable-path]))
(defn- read-env (defn- read-env
[prefix] [prefix]
(let [env (unchecked-get process "env") (let [env (unchecked-get process "env")

View file

@ -54,6 +54,14 @@
:browser :browser
:webworker)) :webworker))
(def available-flags
#{:registration
:audit-log
:demo-users
:user-feedback
:demo-warning
:login-with-ldap})
(def default-flags (def default-flags
#{:registration :demo-users}) #{:registration :demo-users})