From ba471ae0f9dca426a9560bcbe9df72e2b1a54717 Mon Sep 17 00:00:00 2001 From: ilevd Date: Thu, 8 Nov 2018 15:50:35 +0700 Subject: [PATCH 01/16] Fix skype notifications --- project.clj | 1 + src/reference/notification/skype.clj | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/project.clj b/project.clj index 5c43c42..fd89f6c 100644 --- a/project.clj +++ b/project.clj @@ -15,6 +15,7 @@ [ring/ring-json "0.4.0"] [ring/ring-core "1.7.1"] [enlive "1.1.6"] + [org.apache.commons/commons-lang3 "3.8.1"] ;; logging [com.taoensso/timbre "4.10.0"] ;; databases diff --git a/src/reference/notification/skype.clj b/src/reference/notification/skype.clj index ec8b21e..ca8be4f 100644 --- a/src/reference/notification/skype.clj +++ b/src/reference/notification/skype.clj @@ -4,7 +4,8 @@ [cheshire.core :as json] [reference.util.utils :as utils] [clojure.string :as string] - [reference.config.core :as c])) + [reference.config.core :as c]) + (:import (org.apache.commons.lang3 StringEscapeUtils))) ;; ===================================================================================================================== @@ -65,7 +66,7 @@ ;; ===================================================================================================================== (defn start-version-building [notifier {author :author commit-message :message version :name commit :commit} queue-index] (let [msg (str "[API " (c/prefix) "] #" queue-index " " (b version) - " \"" commit-message "\" @" author " (" (subs commit 0 7) ") - " + " \"" (StringEscapeUtils/escapeHtml4 commit-message) "\" @" author " (" (subs commit 0 7) ") - " (-> "start" (font "#4183C4")) "\n")] (send-message (config notifier) msg) (send-release-message (config notifier) version msg))) @@ -74,7 +75,7 @@ (defn complete-version-building [notifier {author :author commit-message :message version :name commit :commit} queue-index dts-enabled] (let [msg (str "[API " (c/prefix) "] #" queue-index " " (b version) - " \"" commit-message "\" @" author " (" (subs commit 0 7) ") - " + " \"" (StringEscapeUtils/escapeHtml4 commit-message) "\" @" author " (" (subs commit 0 7) ") - " (-> "complete" (font "#36a64f")) (when-not dts-enabled " (d.ts generation OFF)") "\n")] @@ -85,7 +86,7 @@ (defn complete-version-building-error [notifier {author :author commit-message :message version :name commit :commit} queue-index e {:keys [index-ts-result graphics-ts-result]}] (let [msg (str "[API " (c/prefix) "] #" queue-index " " (b version) - " \"" commit-message "\" @" author " (" (subs commit 0 7) ") - " + " \"" (StringEscapeUtils/escapeHtml4 commit-message) "\" @" author " (" (subs commit 0 7) ") - " (-> "failed" (font "#d00000")) "\n" (when e From dd52711ddf8ad2071a5adba8efc0ec15ab54ed36 Mon Sep 17 00:00:00 2001 From: Sergey Baranov Date: Thu, 13 Mar 2025 08:55:10 +0000 Subject: [PATCH 02/16] Remove slack and skype notifications, add discord.clj for further usage --- src/reference/components/notifier.clj | 29 +++-- src/reference/config/spec.clj | 24 +--- src/reference/notification/discord.clj | 173 +++++++++++++++++++++++++ 3 files changed, 192 insertions(+), 34 deletions(-) create mode 100644 src/reference/notification/discord.clj diff --git a/src/reference/components/notifier.clj b/src/reference/components/notifier.clj index 9fe50ef..66f33d1 100644 --- a/src/reference/components/notifier.clj +++ b/src/reference/components/notifier.clj @@ -1,8 +1,9 @@ (ns reference.components.notifier (:require [com.stuartsierra.component :as component] [cheshire.core :refer [generate-string]] - [reference.notification.skype :as skype] - [reference.notification.slack :as slack])) + ;; ToDo: add notifications + ) +) (defrecord Notifier [config] @@ -16,33 +17,35 @@ (defn start-building [notifier branches removed-branches queue-index] - (slack/start-building notifier branches removed-branches queue-index)) + ;; ToDo: add notifications +) (defn complete-building [notifier branches removed-branches queue-index] - (slack/complete-building notifier branches removed-branches queue-index)) + ;; ToDo: add notifications +) (defn complete-building-with-errors [notifier branches queue-index & [e]] - (slack/complete-building-with-errors notifier branches queue-index e) - ;(skype/complete-building-with-errors notifier branches queue-index e) + ;; ToDo: add notifications ) (defn start-version-building [notifier branch queue-index] - (slack/start-version-building notifier (:name branch) queue-index) - (skype/start-version-building notifier branch queue-index)) + ;; ToDo: add notifications +) (defn complete-version-building [notifier branch queue-index dts-enabled] - (slack/complete-version-building notifier (:name branch) queue-index) - (skype/complete-version-building notifier branch queue-index dts-enabled)) + ;; ToDo: add notifications +) (defn complete-version-building-error [notifier branch queue-index e ts-error] - (slack/complete-version-building-error notifier (:name branch) queue-index e ts-error) - (skype/complete-version-building-error notifier branch queue-index e ts-error)) + ;; ToDo: add notifications +) (defn notify-404 [notifier path] - (slack/notify-404 notifier path)) + ;; ToDo: add notifications +) diff --git a/src/reference/config/spec.clj b/src/reference/config/spec.clj index 8553f5a..50ad4f9 100644 --- a/src/reference/config/spec.clj +++ b/src/reference/config/spec.clj @@ -10,26 +10,8 @@ :config.redis.spec/db])) (s/def :config/redis (s/keys :req-un [:config.redis/spec])) - -(s/def :config.notifications.slack/channel string?) -(s/def :config.notifications.slack/token string?) -(s/def :config.notifications.slack/username string?) -(s/def :config.notifications/slack (s/keys :req-un [:config.notifications.slack/channel - :config.notifications.slack/token - :config.notifications.slack/username])) - - -(s/def :config.notifications.skype/id string?) -(s/def :config.notifications.skype/chat-id string?) -(s/def :config.notifications.skype/release-chat-id string?) -(s/def :config.notifications.skype/key string?) -(s/def :config.notifications/skype (s/keys :req-un [:config.notifications.skype/id - :config.notifications.skype/chat-id - :config.notifications.skype/key - :config.notifications.skype/release-chat-id])) - -(s/def :config/notifications (s/keys :req-un [:config.notifications/skype - :config.notifications/slack])) +;; ToDo: add notifications +(s/def :config/notifications (s/keys :req-un [])) (s/def :config.jdbc/subprotocol string?) @@ -86,4 +68,4 @@ :config/generator :config/jdbc :config/notifications - :config/redis])) \ No newline at end of file + :config/redis])) diff --git a/src/reference/notification/discord.clj b/src/reference/notification/discord.clj new file mode 100644 index 0000000..1695165 --- /dev/null +++ b/src/reference/notification/discord.clj @@ -0,0 +1,173 @@ +(ns reference.notification.discord + (:require [org.httpkit.client :as http] + [cheshire.core :refer [generate-string]] + [reference.util.utils :as utils] + [clojure.string :as string] + [reference.config.core :as c] + [taoensso.timbre :as timbre])) + +;; ===================================================================================================================== +;; Config and Helpers +;; ===================================================================================================================== +(defn webhook-url [notifier] (-> notifier :config :discord :webhook-url)) +(defn username [notifier] (-> notifier :config :discord :username)) + +;; Text formatting +(defn b [text] (str "**" text "**")) +(defn code-block [text] (str "```\n" text "\n```")) + +;; Base notification function +(defn- send-webhook [url data] + (try + @(http/post url + {:body (generate-string data) + :headers {"Content-Type" "application/json"}}) + (catch Exception e + (timbre/error "Discord webhook error:" (.getMessage e))))) + +(defn- notify [notifier embeds] + (let [payload {:username (username notifier) + :embeds embeds}] + (send-webhook (webhook-url notifier) payload))) + +;; ===================================================================================================================== +;; Slack Analog Functions +;; ===================================================================================================================== + +(defn start-building [notifier branches removed-branches queue-index] + (let [embed {:color 4437377 ; Blue + :title (str "#" queue-index " api `" (c/prefix) "` - start") + :fields (cond-> [] + (seq branches) + (conj {:name "Branches" + :value (string/join ", " branches) + :inline true}) + (seq removed-branches) + (conj {:name "Removed branches" + :value (string/join ", " removed-branches) + :inline true}))}] + (notify notifier [embed]))) + +(defn complete-building [notifier branches removed-branches queue-index] + (let [embed {:color 3066993 ; Green + :title (str "#" queue-index " api `" (c/prefix) "` - complete") + :fields (cond-> [] + (seq branches) + (conj {:name "Branches" + :value (string/join ", " branches) + :inline true}) + (seq removed-branches) + (conj {:name "Removed branches" + :value (string/join ", " removed-branches) + :inline true}))}] + (notify notifier [embed]))) + +(defn complete-building-with-errors [notifier branches queue-index e] + (let [embed {:color 15158332 ; Red + :title (str "#" queue-index " api `" (c/prefix) "` - complete with errors") + :description (when e (code-block (utils/format-exception e))) + :fields (when (seq branches) + [{:name "Branches" + :value (string/join ", " branches) + :inline true}])}] + (notify notifier [embed]))) + +(defn start-version-building [notifier version queue-index] + (let [embed {:color 4437377 ; Blue + :description (str "#" queue-index " api `" (c/prefix) "` - " (b version) " start")}] + (notify notifier [embed]))) + +(defn complete-version-building [notifier version queue-index] + (let [embed {:color 3066993 ; Green + :description (str "#" queue-index " api `" (c/prefix) "` - " (b version) " complete")}] + (notify notifier [embed]))) + +(defn complete-version-building-error [notifier version queue-index e {:keys [index-ts-result graphics-ts-result]}] + (let [embed {:color 15158332 ; Red + :description (str "#" queue-index " api `" (c/prefix) "` - " (b version) " failed" + (when e (str "\n" (code-block (utils/format-exception e)))) + (when (not= 0 (:exit index-ts-result)) + (str "\n[index.d.ts](" (:url index-ts-result) ") errors" + (when (:count index-ts-result) + (str " - " (b (:count index-ts-result)) " tests failed")) + ":\n" + (code-block (:out index-ts-result)))) + (when (not= 0 (:exit graphics-ts-result)) + (str "\n[graphics.d.ts](" (:url graphics-ts-result) ") errors" + (when (:count graphics-ts-result) + (str " - " (b (:count graphics-ts-result)) " tests failed")) + ":\n" + (code-block (:out graphics-ts-result)))))}] + (notify notifier [embed]))) + +(defn notify-404 [notifier path] + (let [embed {:color 15158332 ; Red + :description (str (c/domain) " 404: " path)}] + (notify notifier [embed]))) + +;; ===================================================================================================================== +;; Unique Skype Functions +;; ===================================================================================================================== + +(defn- config [notifier] (-> notifier :config :discord)) + +;; Additional formatting for Skype-style messages +(defn i [text] (str "*" text "*")) +(defn u [text] (str "__" text "__")) + +(defn send-release-message [conf version message] + (when (and (:release-webhook-url conf) + (utils/released-version? version) + (= (c/prefix) "prod")) + (let [payload {:username (username conf) + :content message}] + (send-webhook (:release-webhook-url conf) payload)))) + +;; Extended version building functions with commit info +(defn start-version-building-with-commit + [notifier {:keys [author message name commit] :as version-info} queue-index] + (let [msg (str "[API " (c/prefix) "] #" queue-index " " (b name) + " \"" message "\" @" author " (" (subs commit 0 7) ") - start") + embed {:color 4437377 + :description msg}] + (notify notifier [embed]) + (send-release-message (config notifier) name msg))) + +(defn complete-version-building-with-commit + [notifier {:keys [author message name commit] :as version-info} queue-index dts-enabled] + (let [msg (str "[API " (c/prefix) "] #" queue-index " " (b name) + " \"" message "\" @" author " (" (subs commit 0 7) ") - complete" + (when-not dts-enabled " (d.ts generation OFF)")) + embed {:color 3066993 + :description msg}] + (notify notifier [embed]) + (send-release-message (config notifier) name msg))) + +(defn complete-version-building-error-with-commit + [notifier {:keys [author message name commit] :as version-info} queue-index e {:keys [index-ts-result graphics-ts-result]}] + (let [msg (str "[API " (c/prefix) "] #" queue-index " " (b name) + " \"" message "\" @" author " (" (subs commit 0 7) ") - failed" + (when e (str "\n" (code-block (utils/format-exception e)))) + (when (not= 0 (:exit index-ts-result)) + (str "\n[index.d.ts](" (:url index-ts-result) ") errors" + (when (:count index-ts-result) + (str " - " (b (:count index-ts-result)) " tests failed")) + ":\n" + (code-block (:out index-ts-result)))) + (when (not= 0 (:exit graphics-ts-result)) + (str "\n[graphics.d.ts](" (:url graphics-ts-result) ") errors" + (when (:count graphics-ts-result) + (str " - " (b (:count graphics-ts-result)) " tests failed")) + ":\n" + (code-block (:out graphics-ts-result))))) + embed {:color 15158332 + :description msg}] + (notify notifier [embed]) + (send-release-message (config notifier) name msg))) +``` + +Configuration required: +```clojure +{:discord {:webhook-url "https://discord.com/api/webhooks/your-webhook-url" + :release-webhook-url "https://discord.com/api/webhooks/your-release-webhook-url" + :username "API Bot"}} From dfbfb5315e93dcb973f7edae5b74967b9b58d0a2 Mon Sep 17 00:00:00 2001 From: Sergey Baranov Date: Thu, 13 Mar 2025 09:08:25 +0000 Subject: [PATCH 03/16] Remove slack from travis config --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3d2674c..b6c0e1f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,6 +26,5 @@ after_success: - scp target/reference-3.0.0-standalone.jar root@68.183.148.118:/apps/$APP/reference-3.0.0-standalone.jar - ssh root@104.236.66.244 "supervisorctl restart $APP" - ssh root@68.183.148.118 "supervisorctl restart $APP" -notifications: - slack: - secure: eewE3FcToXLQj/qkqvqD4pKYKNcH9w0Q81+K66ieGSzIh31yJlbnjIMRLrA3vvXWzzVjmVcz3rKFU1HztZTYT6s632fbHUOI7OxRwCIXplAhjMqMIuMsu7JPbQfpeQ5YBG6sz5oyDVPOVbRy4irauOx5HDEAr2YikR/878qW7Lo= +# ToDo: Implement notifications +# notifications: From e786534b3a522ba6ad47575b4691cd3031b07eb9 Mon Sep 17 00:00:00 2001 From: Sergey Baranov Date: Thu, 27 Mar 2025 14:59:43 +0000 Subject: [PATCH 04/16] Rename Twitter link to X link, update icon --- src/reference/web/views/main/main_page.clj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/reference/web/views/main/main_page.clj b/src/reference/web/views/main/main_page.clj index a4185ac..4ca739d 100644 --- a/src/reference/web/views/main/main_page.clj +++ b/src/reference/web/views/main/main_page.clj @@ -71,8 +71,8 @@ :href "https://www.facebook.com/AnyCharts"} [:span.soc-network-icon.fb [:i.sn-mini-icon.ac.ac-facebook]]] [:a.soc-network {:target "_blank" - :href "https://twitter.com/AnyChart"} - [:span.soc-network-icon.tw [:i.sn-mini-icon.ac.ac-twitter]]] + :href "https://x.com/AnyChart"} + [:span.soc-network-icon.tw [:i.sn-mini-icon.ac.ac-twitter-x]]] [:a.soc-network {:target "_blank" :href "https://www.linkedin.com/company/386660"} [:span.soc-network-icon.in [:i.sn-mini-icon.ac.ac-linkedin]]] From 29805ce9fbeceeb0bcfe96612ebaedefc0fd75c6 Mon Sep 17 00:00:00 2001 From: Sergey Baranov Date: Thu, 27 Mar 2025 16:50:58 +0000 Subject: [PATCH 05/16] Update AnyChart font URL and add Medium social link --- src/reference/web/views/common.clj | 4 ++-- src/reference/web/views/main/main_page.clj | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/reference/web/views/common.clj b/src/reference/web/views/common.clj index d290410..c1fb8af 100644 --- a/src/reference/web/views/common.clj +++ b/src/reference/web/views/common.clj @@ -4,7 +4,7 @@ (defn styles [commit] (list - [:link {:rel "stylesheet" :type "text/css" :href "https://cdn.anychart.com/fonts/2.0.0/anychart.css",}] + [:link {:rel "stylesheet" :type "text/css" :href "https://cdn.anychart.com/releases/latest/fonts/css/anychart-font.min.css",}] [:link {:rel "stylesheet" :type "text/css" :href "/lib/bootstrap/css/bootstrap.min.css"}] [:link {:rel "stylesheet" :type "text/css" :href "/lib/bootstrap-select.min.css"}] [:link {:rel "stylesheet" :type "text/css" :href "/lib/jquery-custom-content-scroller/jquery.mCustomScrollbar.min.css"}] @@ -102,4 +102,4 @@ [:span.hidden-super-small "Still have questions?" [:br] [:a {:href "http://anychart.com/support/"} - " Contact support"]]]) \ No newline at end of file + " Contact support"]]]) diff --git a/src/reference/web/views/main/main_page.clj b/src/reference/web/views/main/main_page.clj index 4ca739d..2d6bbd5 100644 --- a/src/reference/web/views/main/main_page.clj +++ b/src/reference/web/views/main/main_page.clj @@ -76,6 +76,9 @@ [:a.soc-network {:target "_blank" :href "https://www.linkedin.com/company/386660"} [:span.soc-network-icon.in [:i.sn-mini-icon.ac.ac-linkedin]]] + [:a.soc-network {:target "_blank" + :href "https://anychart.medium.com/"} + [:span.soc-network-icon.mm [:i.sn-mini-icon.ac.ac-medium]]] [:p (str " © " (t/year (t/now)) " AnyChart.Com All rights reserved.")]]] From 4f1d53598b7b7ba4ef1967498274874ceb6eb1ca Mon Sep 17 00:00:00 2001 From: Sergey Baranov Date: Thu, 27 Mar 2025 17:18:51 +0000 Subject: [PATCH 06/16] Remove unnecessary blank line in spec.clj --- src/reference/config/spec.clj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/reference/config/spec.clj b/src/reference/config/spec.clj index 50ad4f9..f6f27ce 100644 --- a/src/reference/config/spec.clj +++ b/src/reference/config/spec.clj @@ -13,7 +13,6 @@ ;; ToDo: add notifications (s/def :config/notifications (s/keys :req-un [])) - (s/def :config.jdbc/subprotocol string?) (s/def :config.jdbc/password string?) (s/def :config.jdbc/classname string?) From 984968d54cd5c56b017256a12855105b2fac8767 Mon Sep 17 00:00:00 2001 From: Sergey Baranov Date: Thu, 27 Mar 2025 18:20:09 +0000 Subject: [PATCH 07/16] Refactor social network icons in footer Use a grid layout for better responsiveness and visual appearance. Update styles for improved icon presentation and hover effects. --- src-scss/elements/_footer.scss | 102 +++++++++++++-------- src/reference/web/views/main/main_page.clj | 26 +++--- 2 files changed, 77 insertions(+), 51 deletions(-) diff --git a/src-scss/elements/_footer.scss b/src-scss/elements/_footer.scss index 97d97a3..487faf5 100644 --- a/src-scss/elements/_footer.scss +++ b/src-scss/elements/_footer.scss @@ -11,53 +11,77 @@ font-size: 12px; padding: 10px 0; - a.soc-network { - display: inline-block; - .soc-network-icon { - font-size: 20px; + .social-icons { + display: grid; + place-content: center; + grid-template-columns: repeat(auto-fit, minmax(30px, 1fr)); + + a.soc-network { display: inline-block; - margin-right: 10px; - vertical-align: middle; - width: 30px; - height: 30px; - line-height: 30px; - text-align: center; - border-radius: 50%; - color: #929292; - border: 2px solid #929292; - position: relative; - .sn-mini-icon { - font-size: 20px !important; - position: absolute; - top: 3px; - left: 3px; + .soc-network-icon { + display: grid; + width: 30px; + height: 30px; + border-radius: 50%; + color: #929292; + border: 2px solid #929292; + + .sn-mini-icon { + font-size: 14px; + position: relative; + } + + .fb { + .sn-mini-icon { + top: -1px; + } + } + + .tw { + .sn-mini-icon { + top: -1px; + } + } + + .in { + .sn-mini-icon { + top: -1px; + } + } + + .md { + .sn-mini-icon { + font-size: 10px; + } + } } - } - &:hover { - text-decoration: none; - color: #fff; - } - &:focus .soc-network-icon.fb, &:hover .soc-network-icon.fb { - background: #3a5bad; - border-color: #3a5bad; - color: #fff; - } - &:focus .soc-network-icon.tw, &:hover .soc-network-icon.tw { - background: #1dcbea; - border-color: #1dcbea; - color: #fff; - } - &:focus .soc-network-icon.in, &:hover .soc-network-icon.in { - background: #1182c9; - border-color: #1182c9; - color: #fff; + &:hover { + text-decoration: none; + color: #fff; + } + &:focus .soc-network-icon.fb, &:hover .soc-network-icon.fb { + background: #3a5bad; + border-color: #3a5bad; + color: #fff; + } + &:focus .soc-network-icon.tw, &:hover .soc-network-icon.tw { + background: #1dcbea; + border-color: #1dcbea; + color: #fff; + } + &:focus .soc-network-icon.in, &:hover .soc-network-icon.in { + background: #1182c9; + border-color: #1182c9; + color: #fff; + } } } + p { padding: 5px 0 15px 0; color: #929292; } } -} \ No newline at end of file +} diff --git a/src/reference/web/views/main/main_page.clj b/src/reference/web/views/main/main_page.clj index 2d6bbd5..3790685 100644 --- a/src/reference/web/views/main/main_page.clj +++ b/src/reference/web/views/main/main_page.clj @@ -67,18 +67,20 @@ [:div#footer [:div#footer-inner - [:a.soc-network {:target "_blank" - :href "https://www.facebook.com/AnyCharts"} - [:span.soc-network-icon.fb [:i.sn-mini-icon.ac.ac-facebook]]] - [:a.soc-network {:target "_blank" - :href "https://x.com/AnyChart"} - [:span.soc-network-icon.tw [:i.sn-mini-icon.ac.ac-twitter-x]]] - [:a.soc-network {:target "_blank" - :href "https://www.linkedin.com/company/386660"} - [:span.soc-network-icon.in [:i.sn-mini-icon.ac.ac-linkedin]]] - [:a.soc-network {:target "_blank" - :href "https://anychart.medium.com/"} - [:span.soc-network-icon.mm [:i.sn-mini-icon.ac.ac-medium]]] + [:div.social-icons + [:a.soc-network {:target "_blank" + :href "https://www.facebook.com/AnyCharts"} + [:span.soc-network-icon.fb [:i.sn-mini-icon.ac.ac-facebook]]] + [:a.soc-network {:target "_blank" + :href "https://x.com/AnyChart"} + [:span.soc-network-icon.tw [:i.sn-mini-icon.ac.ac-twitter-x]]] + [:a.soc-network {:target "_blank" + :href "https://www.linkedin.com/company/386660"} + [:span.soc-network-icon.in [:i.sn-mini-icon.ac.ac-linkedin]]] + [:a.soc-network {:target "_blank" + :href "https://anychart.medium.com/"} + [:span.soc-network-icon.md [:i.sn-mini-icon.ac.ac-medium]]] + ] [:p (str " © " (t/year (t/now)) " AnyChart.Com All rights reserved.")]]] From 01752930b7b477f6c7ad620d82850057cb9fc095 Mon Sep 17 00:00:00 2001 From: Sergey Baranov Date: Thu, 27 Mar 2025 18:25:24 +0000 Subject: [PATCH 08/16] Center the social network icons inside their containers --- src-scss/elements/_footer.scss | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src-scss/elements/_footer.scss b/src-scss/elements/_footer.scss index 487faf5..e273ba8 100644 --- a/src-scss/elements/_footer.scss +++ b/src-scss/elements/_footer.scss @@ -20,6 +20,7 @@ display: inline-block; .soc-network-icon { display: grid; + place-content: center; width: 30px; height: 30px; border-radius: 50%; @@ -31,25 +32,25 @@ position: relative; } - .fb { + &.fb { .sn-mini-icon { top: -1px; } } - .tw { + &.tw { .sn-mini-icon { top: -1px; } } - .in { + &.in { .sn-mini-icon { top: -1px; } } - .md { + &.md { .sn-mini-icon { font-size: 10px; } From 26f5982144314d73dd312e9b4ef5154212bc82a3 Mon Sep 17 00:00:00 2001 From: Sergey Baranov Date: Thu, 27 Mar 2025 18:31:20 +0000 Subject: [PATCH 09/16] Remove unnecessary style rule for Twitter icon in footer --- src-scss/elements/_footer.scss | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src-scss/elements/_footer.scss b/src-scss/elements/_footer.scss index e273ba8..19ecf21 100644 --- a/src-scss/elements/_footer.scss +++ b/src-scss/elements/_footer.scss @@ -38,12 +38,6 @@ } } - &.tw { - .sn-mini-icon { - top: -1px; - } - } - &.in { .sn-mini-icon { top: -1px; From 083701c1cdd05ed6ab9ca407c71a582227033f82 Mon Sep 17 00:00:00 2001 From: Sergey Baranov Date: Thu, 27 Mar 2025 18:39:44 +0000 Subject: [PATCH 10/16] Fix: Style social icons on hover and focus states --- src-scss/elements/_footer.scss | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src-scss/elements/_footer.scss b/src-scss/elements/_footer.scss index 19ecf21..4a8928d 100644 --- a/src-scss/elements/_footer.scss +++ b/src-scss/elements/_footer.scss @@ -70,6 +70,11 @@ border-color: #1182c9; color: #fff; } + &:focus .soc-network-icon.md, &:hover .soc-network-icon.md { + background: #191919; + border-color: #191919; + color: #fff; + } } } From 1970d7055ef74dee9c3ab6312b7833b1f9fe3868 Mon Sep 17 00:00:00 2001 From: Sergey Baranov Date: Fri, 28 Mar 2025 07:42:25 +0000 Subject: [PATCH 11/16] Style the footer and add .clj-kondo to gitignore The footer now contains social media links and a copyright notice. `.clj-kondo` is added to gitignore to prevent it from being committed. --- .gitignore | 3 +- src-scss/elements/_footer.scss | 153 +++++++++++++++++---------------- 2 files changed, 81 insertions(+), 75 deletions(-) diff --git a/.gitignore b/.gitignore index fd67c9e..50a683b 100644 --- a/.gitignore +++ b/.gitignore @@ -34,4 +34,5 @@ id_rsa_prod id_rsa .travis/id_rsa package-lock.json -resources/public/css/style.css \ No newline at end of file +resources/public/css/style.css +.clj-kondo diff --git a/src-scss/elements/_footer.scss b/src-scss/elements/_footer.scss index 4a8928d..e8e593b 100644 --- a/src-scss/elements/_footer.scss +++ b/src-scss/elements/_footer.scss @@ -1,87 +1,92 @@ #footer { - height: 70px; - background: #f6f6f6; - bottom: 0; - width: 100%; - position: absolute; - overflow: hidden; - #footer-inner { - border-top: 1px solid #dddddd; - margin: 0 25px; - font-size: 12px; - padding: 10px 0; + height: 70px; + background: #f6f6f6; + bottom: 0; + width: 100%; + position: absolute; + overflow: hidden; + #footer-inner { + border-top: 1px solid #dddddd; + margin: 0 25px; + font-size: 12px; + padding: 10px 0; + text-align: center; - .social-icons { - display: grid; - place-content: center; - grid-template-columns: repeat(auto-fit, minmax(30px, 1fr)); + .social-icons { + display: grid; + place-content: center; + grid-template-columns: repeat(auto-fit, 30px); + justify-content: space-evenly; - a.soc-network { - display: inline-block; - .soc-network-icon { - display: grid; - place-content: center; - width: 30px; - height: 30px; - border-radius: 50%; - color: #929292; - border: 2px solid #929292; + a.soc-network { + display: inline-block; + .soc-network-icon { + display: grid; + place-content: center; + width: 30px; + height: 30px; + border-radius: 50%; + color: #929292; + border: 2px solid #929292; - .sn-mini-icon { - font-size: 14px; - position: relative; - } + .sn-mini-icon { + font-size: 14px; + position: relative; + } - &.fb { - .sn-mini-icon { - top: -1px; - } - } + &.fb { + .sn-mini-icon { + top: -1px; + } + } - &.in { - .sn-mini-icon { - top: -1px; - } - } + &.in { + .sn-mini-icon { + top: -1px; + } + } + + &.md { + .sn-mini-icon { + font-size: 10px; + } + } + } - &.md { - .sn-mini-icon { - font-size: 10px; + &:hover { + text-decoration: none; + color: #fff; + } + &:focus .soc-network-icon.fb, + &:hover .soc-network-icon.fb { + background: #3a5bad; + border-color: #3a5bad; + color: #fff; + } + &:focus .soc-network-icon.tw, + &:hover .soc-network-icon.tw { + background: #1dcbea; + border-color: #1dcbea; + color: #fff; + } + &:focus .soc-network-icon.in, + &:hover .soc-network-icon.in { + background: #1182c9; + border-color: #1182c9; + color: #fff; + } + &:focus .soc-network-icon.md, + &:hover .soc-network-icon.md { + background: #191919; + border-color: #191919; + color: #fff; + } } - } } - &:hover { - text-decoration: none; - color: #fff; - } - &:focus .soc-network-icon.fb, &:hover .soc-network-icon.fb { - background: #3a5bad; - border-color: #3a5bad; - color: #fff; - } - &:focus .soc-network-icon.tw, &:hover .soc-network-icon.tw { - background: #1dcbea; - border-color: #1dcbea; - color: #fff; + p { + padding: 5px 0 15px 0; + color: #929292; } - &:focus .soc-network-icon.in, &:hover .soc-network-icon.in { - background: #1182c9; - border-color: #1182c9; - color: #fff; - } - &:focus .soc-network-icon.md, &:hover .soc-network-icon.md { - background: #191919; - border-color: #191919; - color: #fff; - } - } - } - - - p { - padding: 5px 0 15px 0; - color: #929292; } - } } From 3c7772d627d43e710ca5285e35e55ad5767dc107 Mon Sep 17 00:00:00 2001 From: Sergey Baranov Date: Fri, 9 Oct 2026 19:22:52 +0400 Subject: [PATCH 12/16] fix: show numbered release tags (9.x.x) in version list (#2) released-version? only matched ^v\d+$, so release tags such as 9.0.0 were filtered out of the build and the version dropdown. Accept legacy v7/v8 branches plus N.N.N tags from major 9 up; v9+ and older 8.x.x tags stay hidden. Co-authored-by: Claude Sonnet 5.5 --- src/reference/util/utils.clj | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/reference/util/utils.clj b/src/reference/util/utils.clj index 42eb312..cdb8e08 100644 --- a/src/reference/util/utils.clj +++ b/src/reference/util/utils.clj @@ -27,10 +27,11 @@ (sort-versions identity versions))) -(defn released-version? [version-key] - (or - ;; (re-matches #"^\d+\.\d+\.\d+$" version-key) - (re-matches #"^v\d+$" version-key))) +(defn released-version? + "Legacy v7/v8 branches, plus release tags 9.x.x and up (never v9+). + Older 8.x.x tags exist in the content repos and must stay hidden." + [version-key] + (boolean (re-matches #"^(?:v[78]|(?:9|[1-9]\d+)\.\d+\.\d+)$" version-key))) (defn name->url [name] From 39333b87c01ebffc46ac64d35946c082ffc3e5d1 Mon Sep 17 00:00:00 2001 From: Sergey Baranov Date: Fri, 9 Oct 2026 19:56:45 +0400 Subject: [PATCH 13/16] test: cover released-version? for v7/v8 and 9.x.x tags (#4) Co-authored-by: Claude Sonnet 5.5 --- test/reference/util/utils_test.clj | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 test/reference/util/utils_test.clj diff --git a/test/reference/util/utils_test.clj b/test/reference/util/utils_test.clj new file mode 100644 index 0000000..ad86825 --- /dev/null +++ b/test/reference/util/utils_test.clj @@ -0,0 +1,11 @@ +(ns reference.util.utils-test + (:require [clojure.test :refer [deftest is testing]] + [reference.util.utils :as utils])) + +(deftest released-version?-test + (testing "legacy branches and numbered release tags are versions" + (doseq [k ["v7" "v8" "9.0.0" "9.1.2" "10.0.0"]] + (is (true? (utils/released-version? k)) k))) + (testing "v9+, old 8.x.x tags, work branches and partial versions are not" + (doseq [k ["v9" "v10" "8.9.0" "master" "develop" "staging" "RC-8.13.0" "9.0" "9.0.0-rc1"]] + (is (false? (utils/released-version? k)) k)))) From 5c1c5f440ecb3133cdf8c4f258053722d2588797 Mon Sep 17 00:00:00 2001 From: Sergey Baranov Date: Fri, 9 Oct 2026 19:56:50 +0400 Subject: [PATCH 14/16] ci: deploy with GitHub Actions instead of Travis (#3) Travis is gone, so merges to staging/master no longer deployed. Build the uberjar, scp it to api-bible-docs and worker, restart the supervisor program, as .travis.yml did. Needs repo secret DEPLOY_SSH_KEY. Co-authored-by: Claude Sonnet 5.5 --- .github/known_hosts | 2 + .github/workflows/deploy.yml | 73 ++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 .github/known_hosts create mode 100644 .github/workflows/deploy.yml diff --git a/.github/known_hosts b/.github/known_hosts new file mode 100644 index 0000000..b3332c3 --- /dev/null +++ b/.github/known_hosts @@ -0,0 +1,2 @@ +68.183.148.118 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDrtZ80jQmfkMKC1SAmsMrkBsACczPKX92XRhPcHKu7OADjS9J9sj0avbyywH/ViVPh/oQKoAkjRcqlWKge8uYuKM1+usZ4vCSWj1911pp0/tHydvdajtijOVVTs1IyWYb0AmJeauFsvaMrANI6QWul3XE7wpUcegXEIloC4se03UbhFnGwqWkpZgM+07f0bGPljiuO6YZdFUlCg0hVibfo58xEfdNKWClrMr/BFMWZzYz7FBcmyYirwRQ7xx44i6jevb4Ocpg7BsPEiaLVrwItANBONmilQhxh7q/7OolCwOX9x5J0C6oaYsGviejw3MNf9/der4Erjf5pTOP/zY6H +104.236.66.244 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCrINr29cQcqeVqpaBk36cQBv0tdCZ8SM7RIyW1uUHhxwRRd8RWbjGatLQhXELJGlSMLhrUf1KzfzCmXj/4L/l03TffeSDuGWJpxusTI93knKN+mWT69+IudkvIymQnCjaVio/MDOhwRLfkxE0nFGLdj8MbRJA35w/P6qbzIvwjKkHgw6VkbBS1c/4jEjsshIk+Z4P1GPiSw8lwscB8EjpZbOnhOWDYHaZUEpujdGbeIIKK31T/HSgFznEjZGuJmgLXnIf5+2h+WXrjeMljVVe613PNHrydBaR/7JxmWZIltoXyzL7ZDR9wZUQ47DumyMm07BtpQ+LZRCbeAvK+Smrt diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..c90e2ba --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,73 @@ +name: Deploy + +# Replaces Travis CI. Builds the uberjar, copies it to both engine hosts +# (api-bible-docs web + worker generator) and restarts the supervisor program. +# Requires repo secret DEPLOY_SSH_KEY: private key whose public half is in +# servers-conf SSH_KEYS/authorized_keys_api_bible_docs_root and the worker's. + +on: + push: + branches: [master, staging] + workflow_dispatch: + +concurrency: + group: deploy-${{ github.ref_name }} + cancel-in-progress: false + +permissions: + contents: read + +env: + HOSTS: "104.236.66.244 68.183.148.118" + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Resolve target app + run: | + case "${GITHUB_REF_NAME}" in + master) echo "APP=reference-prod" >> "$GITHUB_ENV" ;; + staging) echo "APP=reference-stg" >> "$GITHUB_ENV" ;; + *) echo "No deploy target for ${GITHUB_REF_NAME}"; exit 1 ;; + esac + + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: "8" + + - uses: DeLaGuardo/setup-clojure@13.2 + with: + lein: 2.9.8 + + - uses: actions/cache@v4 + with: + path: ~/.m2 + key: m2-${{ hashFiles('project.clj') }} + restore-keys: m2- + + - name: Build uberjar + run: | + lein sass4clj once + lein uberjar + + - name: Install SSH key + env: + DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }} + run: | + test -n "$DEPLOY_SSH_KEY" || { echo "DEPLOY_SSH_KEY secret is not set"; exit 1; } + install -d -m 700 ~/.ssh + printf '%s\n' "$DEPLOY_SSH_KEY" > ~/.ssh/id_deploy + chmod 600 ~/.ssh/id_deploy + cp .github/known_hosts ~/.ssh/known_hosts + + - name: Copy jar and restart + run: | + SSH_OPTS="-i $HOME/.ssh/id_deploy -o IdentitiesOnly=yes -o BatchMode=yes -o StrictHostKeyChecking=yes" + for host in $HOSTS; do + scp $SSH_OPTS "target/reference-3.0.0-standalone.jar" "root@${host}:/apps/${APP}/reference-3.0.0-standalone.jar.new" + ssh $SSH_OPTS "root@${host}" "mv /apps/${APP}/reference-3.0.0-standalone.jar.new /apps/${APP}/reference-3.0.0-standalone.jar && supervisorctl restart ${APP} && supervisorctl status ${APP}" + done From c3ca807a3a092224fc1e5d54f97ad1aa88513088 Mon Sep 17 00:00:00 2001 From: Sergey Baranov Date: Fri, 9 Oct 2026 21:09:25 +0400 Subject: [PATCH 15/16] ci: use the org ANYCHART_BOT_KEY secret for deploy (#5) Co-authored-by: Claude Sonnet 5.5 --- .github/workflows/deploy.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c90e2ba..bd876b0 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -2,8 +2,8 @@ name: Deploy # Replaces Travis CI. Builds the uberjar, copies it to both engine hosts # (api-bible-docs web + worker generator) and restarts the supervisor program. -# Requires repo secret DEPLOY_SSH_KEY: private key whose public half is in -# servers-conf SSH_KEYS/authorized_keys_api_bible_docs_root and the worker's. +# Requires org secret ANYCHART_BOT_KEY: the anychart-bot private key, authorized +# as root on both hosts (servers-conf SSH_KEYS). on: push: @@ -56,11 +56,11 @@ jobs: - name: Install SSH key env: - DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }} + ANYCHART_BOT_KEY: ${{ secrets.ANYCHART_BOT_KEY }} run: | - test -n "$DEPLOY_SSH_KEY" || { echo "DEPLOY_SSH_KEY secret is not set"; exit 1; } + test -n "$ANYCHART_BOT_KEY" || { echo "ANYCHART_BOT_KEY secret is not set"; exit 1; } install -d -m 700 ~/.ssh - printf '%s\n' "$DEPLOY_SSH_KEY" > ~/.ssh/id_deploy + printf '%s\n' "$ANYCHART_BOT_KEY" > ~/.ssh/id_deploy chmod 600 ~/.ssh/id_deploy cp .github/known_hosts ~/.ssh/known_hosts From 6d40ef90f08e84a2e02faf74a5c5dbf33f399aef Mon Sep 17 00:00:00 2001 From: Sergey Baranov Date: Fri, 9 Oct 2026 21:13:11 +0400 Subject: [PATCH 16/16] ci: refresh pinned host keys for api-bible-docs and worker (#6) The Travis-era keys no longer match, so strict host checking refused the connection. Keys taken from the live hosts and cross-checked against the fingerprints already trusted in a maintainer's known_hosts. Co-authored-by: Claude Sonnet 5.5 --- .github/known_hosts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/known_hosts b/.github/known_hosts index b3332c3..e7b86a0 100644 --- a/.github/known_hosts +++ b/.github/known_hosts @@ -1,2 +1,4 @@ -68.183.148.118 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDrtZ80jQmfkMKC1SAmsMrkBsACczPKX92XRhPcHKu7OADjS9J9sj0avbyywH/ViVPh/oQKoAkjRcqlWKge8uYuKM1+usZ4vCSWj1911pp0/tHydvdajtijOVVTs1IyWYb0AmJeauFsvaMrANI6QWul3XE7wpUcegXEIloC4se03UbhFnGwqWkpZgM+07f0bGPljiuO6YZdFUlCg0hVibfo58xEfdNKWClrMr/BFMWZzYz7FBcmyYirwRQ7xx44i6jevb4Ocpg7BsPEiaLVrwItANBONmilQhxh7q/7OolCwOX9x5J0C6oaYsGviejw3MNf9/der4Erjf5pTOP/zY6H +104.236.66.244 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBNiDodt9vD6R4Tkj6MjXpwWb1sYr6JMo/b8Aek4cHaPtHuyVWWVIXmF8e7H0oQCzJ4sixTePkjkf6xK31zz+1Y= 104.236.66.244 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCrINr29cQcqeVqpaBk36cQBv0tdCZ8SM7RIyW1uUHhxwRRd8RWbjGatLQhXELJGlSMLhrUf1KzfzCmXj/4L/l03TffeSDuGWJpxusTI93knKN+mWT69+IudkvIymQnCjaVio/MDOhwRLfkxE0nFGLdj8MbRJA35w/P6qbzIvwjKkHgw6VkbBS1c/4jEjsshIk+Z4P1GPiSw8lwscB8EjpZbOnhOWDYHaZUEpujdGbeIIKK31T/HSgFznEjZGuJmgLXnIf5+2h+WXrjeMljVVe613PNHrydBaR/7JxmWZIltoXyzL7ZDR9wZUQ47DumyMm07BtpQ+LZRCbeAvK+Smrt +68.183.148.118 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDCq8NG9rifxGhkfA2/E4zXluAzMneDy4iSCOoaQkOXL8IugY4gmsIN0XGM40F1/p5CxfLPVLGU6ssT4vblFaCnnbUF6c522NZhIfDKpulJaFHesdmtinyHGkPBSgOWibm0ay2dsMfWOEPc95u0/CA1oeJ/OdNh4bq4jWFbbEndQ9nIBs9wOJxBXrGMHB3GFQhuEG/vU5iqVAlp3CNdpEY4IjGLlfO63pPxEQRc6MDQ7ILr1DuolOly4me4Inh63pb13ARduWHvqqzc7jf2yhnusworUaRIbZJhYKVcoZyJ0DHglh+Y5yIv2tRVEIyL5edY8YPMAb9mxAILr9dpfUFP +68.183.148.118 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNnXWiDC1zD8BL+LkIZfSHeZ87CPLJjHaPRltqDMlHJZXb9icnWH9yAwPu4J58CcxTTQpKVkG96q5PmvM/T1qgA=