From eda7529f12432f3ddbd02560e8583d01e5a3eaeb Mon Sep 17 00:00:00 2001 From: ilevd Date: Wed, 31 Oct 2018 09:34:13 +0700 Subject: [PATCH 01/27] Update dependencies --- project.clj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/project.clj b/project.clj index 171afe4..7616b1a 100644 --- a/project.clj +++ b/project.clj @@ -3,11 +3,11 @@ [version-clj "0.1.2"] ;; general [com.stuartsierra/component "0.3.2"] - [clj-time "0.15.0"] + [clj-time "0.15.1"] [com.climate/claypoole "1.1.4"] [toml "0.1.3"] ;; templates - [selmer "1.12.2"] + [selmer "1.12.3"] [hiccup "1.0.5"] ;; html [enlive "1.1.6"] @@ -20,7 +20,7 @@ [http-kit "2.3.0"] [compojure "1.6.1"] [ring/ring-json "0.4.0"] - [ring/ring-core "1.7.0"] + [ring/ring-core "1.7.1"] [com.rpl/specter "1.1.1"] ;; logging [com.taoensso/timbre "4.10.0"] @@ -33,7 +33,7 @@ [clojure.jdbc/clojure.jdbc-c3p0 "0.3.3"] [honeysql "0.9.4"] ;; markdown - [markdown-clj "1.0.4"] + [markdown-clj "1.0.5"] ;; filesystem [me.raynes/fs "1.4.6"] [cpath-clj "0.1.2"] From d1fe0a25b5c4403862e399d929abc2d4b973decb Mon Sep 17 00:00:00 2001 From: ilevd Date: Wed, 31 Oct 2018 10:35:49 +0700 Subject: [PATCH 02/27] Update version sorting --- src/wiki/data/versions.clj | 20 ++++++++++---------- src/wiki/generator/core.clj | 14 +++----------- src/wiki/util/utils.clj | 15 ++++++++++++++- 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/src/wiki/data/versions.clj b/src/wiki/data/versions.clj index 756bd86..741b53c 100644 --- a/src/wiki/data/versions.clj +++ b/src/wiki/data/versions.clj @@ -1,6 +1,5 @@ (ns wiki.data.versions (:require [wiki.components.jdbc :refer [query one insert! exec]] - [version-clj.core :refer [version-compare]] [honeysql.helpers :refer :all :as honey] [clojure.java.jdbc :as clj-jdbc] [cheshire.core :refer [generate-string parse-string]] @@ -69,17 +68,18 @@ (defn versions [jdbc] - (sort (comp - version-compare) - (map :key (query jdbc (-> (select :key) - (from :versions) - (where [:= :hidden false])))))) + (->> (query jdbc (-> (select :key) + (from :versions) + (where [:= :hidden false]))) + (map :key) + utils/sort-versions)) (defn versions-full-info [jdbc] - (sort (comp - #(version-compare (:key %1) (:key %2))) - (query jdbc (-> (select :id :key) - (from :versions) - (where [:= :hidden false]))))) + (->> (query jdbc (-> (select :id :key) + (from :versions) + (where [:= :hidden false]))) + (utils/sort-versions :key))) (defn outdated-versions-ids [jdbc actual-ids] @@ -140,7 +140,7 @@ (join :pages [:= :versions.id :pages.version_id]) (where [:and [:or [:= :pages.url url] [:= :pages.url short-url]] [:= :versions.hidden false]])) :v] [:= :versions.id :v.id]))) - sorted-versions (sort (comp - #(version-compare (:key %1) (:key %2))) versions) + sorted-versions (utils/sort-versions :key versions) url-versions (map #(assoc % :url (str "/" (:key %) (when (:url %) (str "/" (utils/escape-url (:url %)))))) diff --git a/src/wiki/generator/core.clj b/src/wiki/generator/core.clj index f1181f8..21c6d02 100644 --- a/src/wiki/generator/core.clj +++ b/src/wiki/generator/core.clj @@ -19,23 +19,15 @@ [me.raynes.fs :as fs] [com.climate.claypoole :as cp] [taoensso.timbre :as timbre :refer [info error]] - [version-clj.core :as version-clj] [clojure.java.shell :refer [sh]] [clojure.string :as string])) -(defn last-version? [jdbc branch-name] - (let [last-version (vdata/default jdbc)] - (and (utils/released-version? branch-name) - (or - (= 0 (version-clj/version-compare branch-name last-version)) - (= 1 (version-clj/version-compare branch-name last-version)))))) - - (defn last-version [jdbc branches] (let [versions (vdata/versions jdbc)] - (first (sort (comp - version-clj/version-compare) - (concat versions branches))))) + (-> (concat versions branches) + utils/sort-versions + first))) (defn complete-config [jdbc version version-config branch-path] diff --git a/src/wiki/util/utils.clj b/src/wiki/util/utils.clj index 54f8ebc..e796f4a 100644 --- a/src/wiki/util/utils.clj +++ b/src/wiki/util/utils.clj @@ -1,5 +1,6 @@ (ns wiki.util.utils - (:require [clojure.string :as string]) + (:require [clojure.string :as string] + [version-clj.core :refer [version-compare]]) (:import (org.jsoup Jsoup))) @@ -31,6 +32,18 @@ string/lower-case)) +(defn sort-versions + ([key versions] + (let [replace-fn (fn [version] + ;; v8 -> 8.999.999 + (string/replace version #"v(\d+)" "$1.999.999")) + compare-fn (fn [v1 v2] + (version-compare (replace-fn v2) (replace-fn v1)))] + (sort-by key compare-fn versions))) + ([versions] + (sort-versions identity versions))) + + (defn released-version? [version-key] (or ;; (re-matches #"^\d+\.\d+\.\d+$" version-key) From fc227559751a31b2e8c3a2af43f00747257a262d Mon Sep 17 00:00:00 2001 From: ilevd Date: Wed, 31 Oct 2018 12:16:15 +0700 Subject: [PATCH 03/27] Fix versions sorting --- src/wiki/util/utils.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wiki/util/utils.clj b/src/wiki/util/utils.clj index e796f4a..835a8d1 100644 --- a/src/wiki/util/utils.clj +++ b/src/wiki/util/utils.clj @@ -36,7 +36,7 @@ ([key versions] (let [replace-fn (fn [version] ;; v8 -> 8.999.999 - (string/replace version #"v(\d+)" "$1.999.999")) + (string/replace version #"^v(\d+)" "$1.999.999")) compare-fn (fn [v1 v2] (version-compare (replace-fn v2) (replace-fn v1)))] (sort-by key compare-fn versions))) From 524f77d2755af3ec7d34e09b362c2105e6c2d02e Mon Sep 17 00:00:00 2001 From: ilevd Date: Wed, 31 Oct 2018 15:07:43 +0700 Subject: [PATCH 04/27] Update link-checker version --- project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.clj b/project.clj index 7616b1a..e8b7b2b 100644 --- a/project.clj +++ b/project.clj @@ -13,7 +13,7 @@ [enlive "1.1.6"] [org.apache.commons/commons-lang3 "3.8.1"] [com.anychart/playground-samples-parser "0.2.6"] - [com.anychart/link-checker "0.2.10"] + [com.anychart/link-checker "0.3.0"] [org.jsoup/jsoup "1.11.3"] [garden "1.3.6"] ;; web From 94fa30e8d6634155797dd61722050f67dc01bb3d Mon Sep 17 00:00:00 2001 From: ilevd Date: Wed, 31 Oct 2018 16:16:14 +0700 Subject: [PATCH 05/27] JS: fix admin script --- resources/public/admin/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/public/admin/main.js b/resources/public/admin/main.js index a26e0e8..c5bdb89 100644 --- a/resources/public/admin/main.js +++ b/resources/public/admin/main.js @@ -56,7 +56,7 @@ init = (e) => { type: "POST", url: `/_rebuild_`, data: { version: selectedVersion(), - linkChecker: true + linkchecker: true }, success: rebuildSuccessFn, error: errorFn }); From d8afd08d964bafc6503a5d488d0114803ef481aa Mon Sep 17 00:00:00 2001 From: ilevd Date: Wed, 31 Oct 2018 16:37:45 +0700 Subject: [PATCH 06/27] Update link-checker version --- project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.clj b/project.clj index e8b7b2b..77d817d 100644 --- a/project.clj +++ b/project.clj @@ -13,7 +13,7 @@ [enlive "1.1.6"] [org.apache.commons/commons-lang3 "3.8.1"] [com.anychart/playground-samples-parser "0.2.6"] - [com.anychart/link-checker "0.3.0"] + [com.anychart/link-checker "0.3.1"] [org.jsoup/jsoup "1.11.3"] [garden "1.3.6"] ;; web From f991bf0f217736335da57f31e97e9481973893e9 Mon Sep 17 00:00:00 2001 From: ilevd Date: Thu, 8 Nov 2018 14:43:24 +0700 Subject: [PATCH 07/27] Skype notificatons logging test --- src/wiki/notification/skype.clj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/wiki/notification/skype.clj b/src/wiki/notification/skype.clj index 24961cf..c768adc 100644 --- a/src/wiki/notification/skype.clj +++ b/src/wiki/notification/skype.clj @@ -87,6 +87,9 @@ (defn start-version-building [notifier {author :author commit-message :message version :name commit :commit} queue-index] + (prn "start-version-building") + (prn notifier) + (prn author commit-message version commit queue-index) (let [msg (str "[Docs " (c/prefix) "] #" queue-index " " (b version) " \"" commit-message "\" @" author " (" (subs commit 0 7) ") - " (-> "start" (font "#4183C4")) "\n")] From 56ef655b25a5f692375571d692972140bb4d59de Mon Sep 17 00:00:00 2001 From: ilevd Date: Thu, 8 Nov 2018 15:13:28 +0700 Subject: [PATCH 08/27] Skype logging test --- src/wiki/notification/skype.clj | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/wiki/notification/skype.clj b/src/wiki/notification/skype.clj index c768adc..1ae4703 100644 --- a/src/wiki/notification/skype.clj +++ b/src/wiki/notification/skype.clj @@ -23,6 +23,8 @@ (defn send-msg [chat-id access-token message] + (println "send-msg") + (println chat-id access-token message) (let [url (str "https://apis.skype.com/v2/conversations/" chat-id "/activities") data {:message {:content message}} headers {"Authorization" (str "Bearer " access-token)} @@ -33,6 +35,8 @@ (defn send-message [{:keys [id key chat-id]} message] (try (let [access-token (get-access-token id key)] + (println "send-message") + (println access-token) (send-msg chat-id access-token message)) (catch Exception e (timbre/error "Skype send message error: " message)))) @@ -88,7 +92,7 @@ (defn start-version-building [notifier {author :author commit-message :message version :name commit :commit} queue-index] (prn "start-version-building") - (prn notifier) + (prn (config notifier)) (prn author commit-message version commit queue-index) (let [msg (str "[Docs " (c/prefix) "] #" queue-index " " (b version) " \"" commit-message "\" @" author " (" (subs commit 0 7) ") - " From 695ef0feaccd4d229a9f0bed46570930c53674da Mon Sep 17 00:00:00 2001 From: ilevd Date: Thu, 8 Nov 2018 15:31:59 +0700 Subject: [PATCH 09/27] Fix skype notification --- src/wiki/notification/skype.clj | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/wiki/notification/skype.clj b/src/wiki/notification/skype.clj index 1ae4703..10a2e65 100644 --- a/src/wiki/notification/skype.clj +++ b/src/wiki/notification/skype.clj @@ -4,7 +4,8 @@ [cheshire.core :as json] [clojure.string :as s] [wiki.util.utils :as utils] - [wiki.config.core :as c])) + [wiki.config.core :as c]) + (:import (org.apache.commons.lang3 StringEscapeUtils))) (defn- config [notifier] (-> notifier :config :skype)) @@ -95,7 +96,7 @@ (prn (config notifier)) (prn author commit-message version commit queue-index) (let [msg (str "[Docs " (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))) @@ -104,7 +105,7 @@ (defn complete-version-building [notifier {author :author commit-message :message version :name commit :commit} queue-index report] (let [msg (str "[Docs " (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 (:check-broken-links-disabled report) " (link-checker OFF)") "\n")] @@ -115,7 +116,7 @@ (defn complete-version-building-with-warnings [notifier {author :author commit-message :message version :name commit :commit} queue-index report message] (let [msg (str "[Docs " (c/prefix) "] #" queue-index " " (b version) - " \"" commit-message "\" @" author " (" (subs commit 0 7) ") - " + " \"" (StringEscapeUtils/escapeHtml4 commit-message) "\" @" author " (" (subs commit 0 7) ") - " (-> "complete with warnings" (font "#ff9800")) (when (:check-broken-links-disabled report) " (link-checker OFF)") "\n" @@ -126,7 +127,7 @@ (defn build-failed [notifier {author :author commit-message :message version :name commit :commit} queue-index & [e]] (let [msg (str "[Docs " (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") b) "\n" (when e (-> (utils/format-exception e) (font "#777777" 11) i)))] From d17255b1cdfede08eca83f0e2e9b27b14de35441 Mon Sep 17 00:00:00 2001 From: ilevd Date: Thu, 8 Nov 2018 15:41:24 +0700 Subject: [PATCH 10/27] Delete skype test logging --- src/wiki/notification/skype.clj | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/wiki/notification/skype.clj b/src/wiki/notification/skype.clj index 10a2e65..a02baa5 100644 --- a/src/wiki/notification/skype.clj +++ b/src/wiki/notification/skype.clj @@ -24,8 +24,6 @@ (defn send-msg [chat-id access-token message] - (println "send-msg") - (println chat-id access-token message) (let [url (str "https://apis.skype.com/v2/conversations/" chat-id "/activities") data {:message {:content message}} headers {"Authorization" (str "Bearer " access-token)} @@ -36,8 +34,6 @@ (defn send-message [{:keys [id key chat-id]} message] (try (let [access-token (get-access-token id key)] - (println "send-message") - (println access-token) (send-msg chat-id access-token message)) (catch Exception e (timbre/error "Skype send message error: " message)))) @@ -92,9 +88,6 @@ (defn start-version-building [notifier {author :author commit-message :message version :name commit :commit} queue-index] - (prn "start-version-building") - (prn (config notifier)) - (prn author commit-message version commit queue-index) (let [msg (str "[Docs " (c/prefix) "] #" queue-index " " (b version) " \"" (StringEscapeUtils/escapeHtml4 commit-message) "\" @" author " (" (subs commit 0 7) ") - " (-> "start" (font "#4183C4")) "\n")] From 22397576395b9a2d3928d30331b3ff75fef07343 Mon Sep 17 00:00:00 2001 From: Sergey Baranov Date: Wed, 12 Mar 2025 12:48:11 +0000 Subject: [PATCH 11/27] remove skype and slack notifications --- src/wiki/components/notifier.clj | 46 +++++---- src/wiki/config/spec.clj | 24 +---- src/wiki/notification/discord.clj | 162 ++++++++++++++++++++++++++++++ src/wiki/notification/skype.clj | 128 ----------------------- src/wiki/notification/slack.clj | 126 ----------------------- 5 files changed, 191 insertions(+), 295 deletions(-) create mode 100644 src/wiki/notification/discord.clj delete mode 100644 src/wiki/notification/skype.clj delete mode 100644 src/wiki/notification/slack.clj diff --git a/src/wiki/components/notifier.clj b/src/wiki/components/notifier.clj index ab72081..6416633 100644 --- a/src/wiki/components/notifier.clj +++ b/src/wiki/components/notifier.clj @@ -2,8 +2,7 @@ (:require [com.stuartsierra.component :as component] [cheshire.core :refer [generate-string]] [org.httpkit.client :as http] - [wiki.notification.slack :as slack] - [wiki.notification.skype :as skype] + ;; [wiki.notification.discord :as discord] [clojure.string :as string])) @@ -18,25 +17,23 @@ (defn start-building [notifier branches removed-branches queue-index] - (slack/start-building notifier branches removed-branches queue-index) - ;(skype/start-building notifier branches removed-branches queue-index) + ;; (discord/start-building notifier branches removed-branches queue-index) ) (defn complete-building [notifier branches removed-branches queue-index] - (slack/complete-building notifier branches removed-branches queue-index) - ;(skype/complete-building notifier branches removed-branches queue-index) + ;; (discord/complete-building notifier branches removed-branches queue-index) ) (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)) + ;; (discord/complete-building-with-errors notifier branches queue-index e) + ) (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)) + ;; (discord/start-version-building notifier branch queue-index) + ) (defn complete-version-building [notifier {version :name :as branch} queue-index @@ -62,29 +59,36 @@ (when (pos? conflicts-with-develop) (str "Conflicts with develop: " conflicts-with-develop)) (when (pos? broken-links-error) (str "404 errors: " broken-links-error))] msg (string/join "\n" (filter some? msg-coll))] - (slack/complete-version-building notifier version queue-index) - (if (= 0 direct-links canonical-links env-links http-links - sample-not-available sample-parsing-error image-format-error conflicts-with-develop toc-error broken-links-error) - (skype/complete-version-building notifier branch queue-index report) - (skype/complete-version-building-with-warnings notifier branch queue-index report msg)))) + ;; (discord/complete-version-building notifier branch queue-index report) + ;; (if (= 0 direct-links canonical-links env-links http-links + ;; sample-not-available sample-parsing-error image-format-error conflicts-with-develop toc-error broken-links-error) + ;; ;; (discord/complete-version-building notifier branch queue-index report) + ;; ;; (discord/complete-version-building-with-warnings notifier branch queue-index report msg) + ;; ) + ) + ) (defn build-failed [notifier branch queue-index & [e]] - (slack/build-failed notifier (:name branch) queue-index e) - (skype/build-failed notifier branch queue-index e)) + ;; (discord/build-failed notifier branch queue-index e) +) (defn sample-parsing-error [notifier version page-url] - (slack/sample-parsing-error notifier version page-url)) + ;; (discord/sample-parsing-error notifier version page-url) +) (defn image-format-error [notifier version page-url] - (slack/image-format-error notifier version page-url)) + ;; (discord/image-format-error notifier version page-url) +) (defn sample-not-available [notifier version page-url] - (slack/sample-not-available notifier version page-url)) + ;; (discord/sample-not-available notifier version page-url) +) (defn notify-404 [notifier path] - (slack/notify-404 notifier path)) + ;; (discord/notify-404 notifier path) +) diff --git a/src/wiki/config/spec.clj b/src/wiki/config/spec.clj index d8b051f..ee01841 100644 --- a/src/wiki/config/spec.clj +++ b/src/wiki/config/spec.clj @@ -10,26 +10,10 @@ :config.redis.spec/db])) (s/def :config/redis (s/keys :req-un [:config.redis/spec])) +(s/def :config.notifications.discord/webhook-url string?) +(s/def :config.notifications/discord (s/keys :req-un [:config.notifications.discord/webhook-url])) -(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] - :opt-un [:config.notifications.skype/release-chat-id])) - -(s/def :config/notifications (s/keys :req-un [:config.notifications/skype - :config.notifications/slack])) +(s/def :config/notifications (s/keys :req-un [:config.notifications/discord])) (s/def :config.indexer/queue string?) (s/def :config/indexer (s/keys :req-un [:config.indexer/queue])) @@ -125,4 +109,4 @@ :config/offline-generator :config/indexer :config/notifications - :config/redis])) \ No newline at end of file + :config/redis])) diff --git a/src/wiki/notification/discord.clj b/src/wiki/notification/discord.clj new file mode 100644 index 0000000..cf0109c --- /dev/null +++ b/src/wiki/notification/discord.clj @@ -0,0 +1,162 @@ +(ns wiki.notification.discord + (:require [org.httpkit.client :as http] + [taoensso.timbre :as timbre] + [cheshire.core :as json] + [clojure.string :as s] + [wiki.util.utils :as utils] + [wiki.config.core :as c]) + (:import (org.apache.commons.lang3 StringEscapeUtils))) + +(defn- config [notifier] (-> notifier :config :discord)) + +(def colors + {:blue 4437377 ; #4183C4 + :green 3586383 ; #36a64f + :red 13631488 ; #d00000 + :orange 16750848 ; #ff9800 + :gray 7829367}) ; #777777 + +(defn send-message [{:keys [webhook-url]} payload] + (try + @(http/post webhook-url + {:body (json/generate-string payload) + :headers {"Content-Type" "application/json"}}) + (catch Exception e + (timbre/error "Discord send message error: " payload)))) + +(defn send-release-message [conf version payload] + (when (and (utils/released-version? version) + (= (c/prefix) "prod")) + (send-message conf (assoc payload :is_release true)))) + +(defn start-building [notifier branches removed-branches queue-index] + (let [fields (cond-> [] + (seq branches) + (conj {:name "Branches" + :value (s/join ", " branches)}) + (seq removed-branches) + (conj {:name "Removed branches" + :value (s/join ", " removed-branches)})) + payload {:type "build" + :embed {:title (str "[Docs " (c/prefix) "] #" queue-index " - Start") + :color (:blue colors) + :fields fields}}] + (send-message (config notifier) payload))) + +(defn complete-building [notifier branches removed-branches queue-index] + (let [fields (cond-> [] + (seq branches) + (conj {:name "Branches" + :value (s/join ", " branches)}) + (seq removed-branches) + (conj {:name "Removed branches" + :value (s/join ", " removed-branches)})) + payload {:type "build" + :embed {:title (str "[Docs " (c/prefix) "] #" queue-index " - Complete") + :color (:green colors) + :fields fields}}] + (send-message (config notifier) payload))) + +(defn complete-building-with-errors [notifier branches queue-index e] + (let [fields (cond-> [] + (seq branches) + (conj {:name "Branches" + :value (s/join ", " branches)}) + e + (conj {:name "Error" + :value (utils/format-exception e)})) + payload {:type "build" + :embed {:title (str "[Docs " (c/prefix) "] #" queue-index " - Error during processing!") + :color (:red colors) + :fields fields}}] + (send-message (config notifier) payload))) + +(defn start-version-building [notifier {author :author commit-message :message version :name commit :commit} queue-index] + (let [payload {:type "version" + :embed {:title (str "[Docs " (c/prefix) "] #" queue-index) + :description (str "**Version:** " version "\n" + "**Message:** " (StringEscapeUtils/escapeHtml4 commit-message) "\n" + "**Author:** @" author "\n" + "**Commit:** " (subs commit 0 7) "\n" + "**Status:** Start") + :color (:blue colors)}}] + (send-message (config notifier) payload) + (send-release-message (config notifier) version payload))) + +(defn complete-version-building [notifier {author :author commit-message :message version :name commit :commit} + queue-index report] + (let [payload {:type "version" + :embed {:title (str "[Docs " (c/prefix) "] #" queue-index) + :description (str "**Version:** " version "\n" + "**Message:** " (StringEscapeUtils/escapeHtml4 commit-message) "\n" + "**Author:** @" author "\n" + "**Commit:** " (subs commit 0 7) "\n" + "**Status:** Complete" + (when (:check-broken-links-disabled report) " (link-checker OFF)")) + :color (:green colors)}}] + (send-message (config notifier) payload) + (send-release-message (config notifier) version payload))) + +(defn complete-version-building-with-warnings [notifier {author :author commit-message :message version :name commit :commit} + queue-index report message] + (let [payload {:type "version" + :embed {:title (str "[Docs " (c/prefix) "] #" queue-index) + :description (str "**Version:** " version "\n" + "**Message:** " (StringEscapeUtils/escapeHtml4 commit-message) "\n" + "**Author:** @" author "\n" + "**Commit:** " (subs commit 0 7) "\n" + "**Status:** Complete with warnings" + (when (:check-broken-links-disabled report) " (link-checker OFF)")) + :fields [{:name "Warnings" + :value message} + {:name "Report" + :value (str (c/domain) version "/report")}] + :color (:orange colors)}}] + (send-message (config notifier) payload) + (send-release-message (config notifier) version payload))) + +(defn build-failed [notifier {author :author commit-message :message version :name commit :commit} queue-index & [e]] + (let [payload {:type "version" + :embed {:title (str "[Docs " (c/prefix) "] #" queue-index) + :description (str "**Version:** " version "\n" + "**Message:** " (StringEscapeUtils/escapeHtml4 commit-message) "\n" + "**Author:** @" author "\n" + "**Commit:** " (subs commit 0 7) "\n" + "**Status:** Failed") + :fields (when e + [{:name "Error" + :value (utils/format-exception e)}]) + :color (:red colors)}}] + (send-message (config notifier) payload) + (send-release-message (config notifier) version payload))) + +(defn sample-parsing-error [notifier version page-url] + (let [webhook-url (-> notifier :config :discord :webhook-url) + attachment {:embeds [{:color 16776960 ; "warning" color in decimal (yellow) + :description (str (c/domain) version "/" page-url " sample parsing error!") + :footer {:text "Sample Parsing Error"}}]}] + (http/post webhook-url + {:body (json/generate-string attachment) + :headers {"Content-Type" "application/json"}}))) + +(defn image-format-error [notifier version page-url] + (send-message notifier + {:color (:warning colors) + :description (str (c/domain) version "/" page-url " image format error!") + :footer {:text "Image Format Error"}})) + +(defn sample-not-available [notifier version page-url] + (send-message notifier + {:color (:warning colors) + :description (str (c/domain) version "/" page-url " sample not available!") + :footer {:text "Sample Not Available"}})) + +(defn notify-404 [notifier path] + (let [error-webhook-url (-> notifier :config :discord :error-webhook-url)] ; Separate webhook for errors + (http/post error-webhook-url + {:body (json/generate-string + {:embeds [{:color (:danger colors) + :description (str (c/domain) " 404: " path) + :footer {:text "404 Error"} + }]}) + :headers {"Content-Type" "application/json"}}))) diff --git a/src/wiki/notification/skype.clj b/src/wiki/notification/skype.clj deleted file mode 100644 index a02baa5..0000000 --- a/src/wiki/notification/skype.clj +++ /dev/null @@ -1,128 +0,0 @@ -(ns wiki.notification.skype - (:require [org.httpkit.client :as http] - [taoensso.timbre :as timbre] - [cheshire.core :as json] - [clojure.string :as s] - [wiki.util.utils :as utils] - [wiki.config.core :as c]) - (:import (org.apache.commons.lang3 StringEscapeUtils))) - - -(defn- config [notifier] (-> notifier :config :skype)) - - -(defn get-access-token [id key] - (let [url "https://login.microsoftonline.com/common/oauth2/v2.0/token" - data {"client_id" id - "scope" "https://api.botframework.com/.default" - "grant_type" "client_credentials" - "client_secret" key} - resp @(http/post url {:form-params data}) - body (json/parse-string (:body resp) true) - access-token (:access_token body)] - access-token)) - - -(defn send-msg [chat-id access-token message] - (let [url (str "https://apis.skype.com/v2/conversations/" chat-id "/activities") - data {:message {:content message}} - headers {"Authorization" (str "Bearer " access-token)} - resp @(http/post url {:body (json/generate-string data) - :headers headers})])) - - -(defn send-message [{:keys [id key chat-id]} message] - (try - (let [access-token (get-access-token id key)] - (send-msg chat-id access-token message)) - (catch Exception e - (timbre/error "Skype send message error: " message)))) - - -(defn send-release-message [conf version message] - (when (and (:release-chat-id conf) - (utils/released-version? version) - (= (c/prefix) "prod")) - (send-message (assoc conf :chat-id (:release-chat-id conf)) message))) - - -(defn font [text & [color size]] - (str "" - text "")) -(defn b [text] (str "" text "")) -(defn u [text] (str "" text "")) -(defn i [text] (str "" text "")) - - -(defn start-building [notifier branches removed-branches queue-index] - (let [msg (str "[Docs " (c/prefix) "] #" queue-index " - " (-> "start" (font "#4183C4") b) "\n" - (when (seq branches) - (str (b "Branches: ") (s/join ", " branches))) - (when (and (seq branches) - (seq removed-branches)) "\n") - (when (seq removed-branches) - (str (b "Removed branches: ") (s/join ", " removed-branches))))] - (send-message (config notifier) msg))) - - -(defn complete-building [notifier branches removed-branches queue-index] - (let [msg (str "[Docs " (c/prefix) "] #" queue-index " - " (-> "complete" (font "#36a64f") b) "\n" - (when (seq branches) - (str (b "Branches: ") (s/join ", " branches))) - (when (and (seq branches) - (seq removed-branches)) "\n") - (when (seq removed-branches) - (str (b "Removed branches: ") (s/join ", " removed-branches))))] - (send-message (config notifier) msg))) - - -(defn complete-building-with-errors [notifier branches queue-index e] - (let [msg (str "[Docs " (c/prefix) "] #" queue-index " - " (-> "error during processing!" (font "#d00000") b) "\n" - (when (seq branches) - (str (b "Branches: ") (s/join ", " branches))) - (when e - (-> (utils/format-exception e) (font "#777777" 11) i)))] - (send-message (config notifier) msg))) - - -(defn start-version-building [notifier {author :author commit-message :message version :name commit :commit} queue-index] - (let [msg (str "[Docs " (c/prefix) "] #" queue-index " " (b version) - " \"" (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))) - - -(defn complete-version-building [notifier {author :author commit-message :message version :name commit :commit} - queue-index report] - (let [msg (str "[Docs " (c/prefix) "] #" queue-index " " (b version) - " \"" (StringEscapeUtils/escapeHtml4 commit-message) "\" @" author " (" (subs commit 0 7) ") - " - (-> "complete" (font "#36a64f")) - (when (:check-broken-links-disabled report) " (link-checker OFF)") - "\n")] - (send-message (config notifier) msg) - (send-release-message (config notifier) version msg))) - - -(defn complete-version-building-with-warnings [notifier {author :author commit-message :message version :name commit :commit} - queue-index report message] - (let [msg (str "[Docs " (c/prefix) "] #" queue-index " " (b version) - " \"" (StringEscapeUtils/escapeHtml4 commit-message) "\" @" author " (" (subs commit 0 7) ") - " - (-> "complete with warnings" (font "#ff9800")) - (when (:check-broken-links-disabled report) " (link-checker OFF)") - "\n" - message "\nSee full report")] - (send-message (config notifier) msg) - (send-release-message (config notifier) version msg))) - - -(defn build-failed [notifier {author :author commit-message :message version :name commit :commit} queue-index & [e]] - (let [msg (str "[Docs " (c/prefix) "] #" queue-index " " (b version) - " \"" (StringEscapeUtils/escapeHtml4 commit-message) "\" @" author " (" (subs commit 0 7) ") - " - (-> "failed" (font "#d00000") b) "\n" - (when e - (-> (utils/format-exception e) (font "#777777" 11) i)))] - (send-message (config notifier) msg) - (send-release-message (config notifier) version msg))) diff --git a/src/wiki/notification/slack.clj b/src/wiki/notification/slack.clj deleted file mode 100644 index 2dc2bf5..0000000 --- a/src/wiki/notification/slack.clj +++ /dev/null @@ -1,126 +0,0 @@ -(ns wiki.notification.slack - (:require [cheshire.core :refer [generate-string]] - [org.httpkit.client :as http] - [wiki.util.utils :as utils] - [wiki.config.core :as c] - [clojure.string :as string])) - - -(defn- channel [notifier] (-> notifier :config :slack :channel)) -(defn- username [notifier] (-> notifier :config :slack :username)) -(defn- token [notifier] (-> notifier :config :slack :token)) - - -(defn- notify-attach-delay [notifier attachment] - (send (:messages notifier) conj attachment)) - - -(defn- notify-attach [notifier attachments] - (send (:messages notifier) - (fn [messages attachments] - (http/post (str "https://anychart-team.slack.com/services/hooks/incoming-webhook?token=" (token notifier)) - {:form-params - {:payload (generate-string - {:attachments (concat messages attachments) - :mrkdwn true - :channel (channel notifier) - :username (username notifier)})}}) - []) - attachments)) - - -(defn start-building [notifier branches removed-branches queue-index] - (let [attachments [{:color "#4183C4" - :text (str "#" queue-index " docs `" (c/prefix) "` - start") - :mrkdwn_in ["text", "pretext"] - :fields (if (seq branches) - [{:title "Branches" - :value (string/join ", " branches) - :short true}] - [])}] - removed-fields (when (seq removed-branches) - [{:title "Removed branches" - :value (string/join ", " removed-branches) - :short true}])] - (notify-attach notifier (update-in attachments [0 :fields] concat removed-fields)))) - - -(defn complete-building [notifier branches removed-branches queue-index] - (let [attachments [{:color "#36a64f" - :text (str "#" queue-index " docs `" (c/prefix) "` - complete") - :mrkdwn_in ["text", "pretext"] - :fields (if (seq branches) - [{:title "Branches" - :value (string/join ", " branches) - :short true}] - [])}] - removed-fields (when (seq removed-branches) - [{:title "Removed branches" - :value (string/join ", " removed-branches) - :short true}])] - (notify-attach notifier (update-in attachments [0 :fields] concat removed-fields)))) - - -(defn complete-building-with-errors [notifier branches queue-index & [e]] - (let [attachments [{:color "danger" - :text (str "#" queue-index " docs `" (c/prefix) "` - complete with errors" - (when e (str "\n```" (utils/format-exception e) "```"))) - :mrkdwn_in ["text", "pretext"] - :fields (if (seq branches) - [{:title "Branches" - :value (string/join ", " branches) - :short true}] - [])}]] - (notify-attach notifier attachments))) - - -(defn start-version-building [notifier version queue-index] - (let [attachments [{:color "#4183C4" - :text (str "#" queue-index " docs `" (c/prefix) "` - *" version "* start") - :mrkdwn_in ["text"]}]] - (notify-attach notifier attachments))) - - -(defn complete-version-building [notifier version queue-index] - (let [attachments [{:color "#36a64f" - :text (str "#" queue-index " docs `" (c/prefix) "` - *" version "* complete") - :mrkdwn_in ["text"]}]] - (notify-attach notifier attachments))) - - -(defn build-failed [notifier version queue-index & [e]] - (let [attachments [{:color "danger" - :text (str "#" queue-index " docs `" (c/prefix) "` - *" version "* failed" - (when e (str "\n```" (utils/format-exception e) "```"))) - :mrkdwn_in ["text"]}]] - (notify-attach notifier attachments))) - - -(defn sample-parsing-error [notifier version page-url] - (let [attachment {:color "warning" - :text (str (c/domain) version "/" page-url " sample parsing error!") - :mrkdwn_in ["text"]}] - (notify-attach-delay notifier attachment))) - - -(defn image-format-error [notifier version page-url] - (let [attachment {:color "warning" - :text (str (c/domain) version "/" page-url " image format error!") - :mrkdwn_in ["text"]}] - (notify-attach-delay notifier attachment))) - - -(defn sample-not-available [notifier version page-url] - (let [attachment {:color "warning" - :text (str (c/domain) version "/" page-url " sample not available!") - :mrkdwn_in ["text"]}] - (notify-attach-delay notifier attachment))) - - -(defn notify-404 [notifier path] - (http/post (str "https://anychart-team.slack.com/services/hooks/incoming-webhook?token=" (token notifier)) - {:form-params - {:payload (generate-string - {:text (str (c/domain) " 404: " path) - :channel "#docs-404-errors" - :username (username notifier)})}})) From 293ea3ab665c5514a0104cdd13c7264c762966da Mon Sep 17 00:00:00 2001 From: Sergey Baranov Date: Wed, 12 Mar 2025 12:54:29 +0000 Subject: [PATCH 12/27] fix jdk version in travis --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 4444e58..e962e8a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,6 @@ language: clojure +jdk: + - openjdk8 script: lein uberjar sudo: false branches: From 58928f0986f8bc69ddcdfbc8bac5d32032d6bb8b Mon Sep 17 00:00:00 2001 From: Sergey Baranov Date: Wed, 12 Mar 2025 13:09:12 +0000 Subject: [PATCH 13/27] replace slack with discord in travis --- .travis.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e962e8a..6f97c76 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,6 +31,12 @@ after_success: - scp target/uberjar/wiki-2.0-standalone.jar root@104.131.17.78:/apps/$APP/docs-2.0-standalone.jar - ssh root@104.236.66.244 "supervisorctl restart $APP" - ssh root@104.131.17.78 "supervisorctl restart $APP" + notifications: - slack: - secure: GlKpceHLcrwqZ/k3hhYyAkZEE/g6Hrv/I7XwEebXt3sCExalhHP8kDDtQdEJuDlo7juz7c8yN14PCb7QBOJoYs64YR1JhYz4BNGpp4BTdEs3W22rzGJEpmrJNIL2M4YeC5st0F8tmDTcgfL/lt2yiIjyZEXrxmkg0r1HW3OP8F8= + webhooks: + urls: + - ${webhook_url} + on_start: always + on_success: always + on_failure: always + on_error: always From 9fb28b9b95395f769d8945318e6fa8d6f200344b Mon Sep 17 00:00:00 2001 From: Sergey Baranov Date: Fri, 14 Mar 2025 09:05:32 +0000 Subject: [PATCH 14/27] Fix webhook URL syntax in Travis config --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6f97c76..e1d6ecb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,7 +35,7 @@ after_success: notifications: webhooks: urls: - - ${webhook_url} + - $webhook_url on_start: always on_success: always on_failure: always From 29b169ce91ff14d545ad957acc4e47b69c45fb68 Mon Sep 17 00:00:00 2001 From: Sergey Baranov Date: Fri, 14 Mar 2025 09:41:51 +0000 Subject: [PATCH 15/27] Update worker server IP address --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e1d6ecb..5d580dd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,9 +28,9 @@ after_success: - chmod 400 ~/.ssh/id_rsa.pub - ssh-add ~/.ssh/id_rsa - scp target/uberjar/wiki-2.0-standalone.jar root@104.236.66.244:/apps/$APP/docs-2.0-standalone.jar -- scp target/uberjar/wiki-2.0-standalone.jar root@104.131.17.78:/apps/$APP/docs-2.0-standalone.jar +- scp target/uberjar/wiki-2.0-standalone.jar root@68.183.148.118:/apps/$APP/docs-2.0-standalone.jar - ssh root@104.236.66.244 "supervisorctl restart $APP" -- ssh root@104.131.17.78 "supervisorctl restart $APP" +- ssh root@68.183.148.118 "supervisorctl restart $APP" notifications: webhooks: From 636d7f36beede640784de0f179542bfbd61cd408 Mon Sep 17 00:00:00 2001 From: Sergey Baranov Date: Fri, 14 Mar 2025 20:02:28 +0000 Subject: [PATCH 16/27] Add known hosts for Travis CI deployment --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 5d580dd..f22e8d9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,10 @@ branches: - master - staging - bible +known_hosts: + - github.com + - 104.236.66.244 + - 68.183.148.118 cache: directories: - "$HOME/.m2" From 164a87da44fcef00d465a656637f9d38d87f02da Mon Sep 17 00:00:00 2001 From: Sergey Baranov Date: Fri, 14 Mar 2025 20:06:15 +0000 Subject: [PATCH 17/27] Remove unused known_hosts in deploy script --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f22e8d9..a97d4ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,9 +25,7 @@ after_success: - if [ "$TRAVIS_BRANCH" == "staging" ]; then export APP="docs-stg"; fi - if [ "$TRAVIS_BRANCH" == "bible" ]; then export APP="bible-stg"; fi - echo "Deploying to $SERVER" -- mv .travis/known_hosts ~/.ssh/known_hosts - mv .travis/id_rsa.pub ~/.ssh/id_rsa.pub -- chmod 400 ~/.ssh/known_hosts - chmod 400 ~/.ssh/id_rsa - chmod 400 ~/.ssh/id_rsa.pub - ssh-add ~/.ssh/id_rsa From 95771c80c372921552e1e458c335f7a05ba09b38 Mon Sep 17 00:00:00 2001 From: Sergey Baranov Date: Fri, 14 Mar 2025 20:10:26 +0000 Subject: [PATCH 18/27] Update ssh_known_hosts format in Travis config --- .travis.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index a97d4ae..3aea333 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,10 +8,11 @@ branches: - master - staging - bible -known_hosts: - - github.com - - 104.236.66.244 - - 68.183.148.118 +addons: + ssh_known_hosts: + - github.com + - 104.236.66.244 + - 68.183.148.118 cache: directories: - "$HOME/.m2" From 5cf90b3dd35938fb5406851910898da9f7d4f01e Mon Sep 17 00:00:00 2001 From: Sergey Baranov Date: Fri, 28 Mar 2025 04:56:15 +0000 Subject: [PATCH 19/27] Update links to AnyChart font and Twitter to X --- src/templates/404.selmer | 2 +- src/templates/local-page.selmer | 10 +++++----- src/templates/page.selmer | 12 ++++++------ src/templates/search.selmer | 12 ++++++------ src/wiki/views/common.clj | 4 ++-- src/wiki/views/main/main_page.clj | 4 ++-- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/templates/404.selmer b/src/templates/404.selmer index 850260f..f0fac09 100644 --- a/src/templates/404.selmer +++ b/src/templates/404.selmer @@ -5,7 +5,7 @@ - + - + @@ -120,8 +120,8 @@ - - + + @@ -149,8 +149,8 @@ - - + + diff --git a/src/templates/search.selmer b/src/templates/search.selmer index 31cb01c..dd99907 100644 --- a/src/templates/search.selmer +++ b/src/templates/search.selmer @@ -15,7 +15,7 @@ - + @@ -34,7 +34,7 @@ - + @@ -114,8 +114,8 @@ - - + + @@ -143,8 +143,8 @@ - - + + diff --git a/src/wiki/views/common.clj b/src/wiki/views/common.clj index 5be240e..3bbf50c 100644 --- a/src/wiki/views/common.clj +++ b/src/wiki/views/common.clj @@ -20,7 +20,7 @@ [:link {:rel "stylesheet" :type "text/css" :href (str "/main.css?v=" commit)}] ;[:link {:rel "stylesheet" :type "text/css" :href (:anychart-css-url data)}] ; http://cdn.anychart.com/fonts/2.7.5/demo.html - [:link {:rel "stylesheet" :type "text/css" :href "https://cdn.anychart.com/fonts/2.7.2/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 "https://fonts.googleapis.com/css?family=Open+Sans:400,600"}] ;[:link {:rel "stylesheet" :type "text/css" :href "/lib/jquery-custom-content-scroller/jquery.mCustomScrollbar.min.css"}] [:link {:rel "apple-touch-icon" :sizes "57x57" :href "/icons/57.png"}] @@ -118,4 +118,4 @@ [:a {:title "AnyChart Support" :rel "nofollow" :href "https://www.anychart.com/support/"} - "Contact support"]]]]) \ No newline at end of file + "Contact support"]]]]) diff --git a/src/wiki/views/main/main_page.clj b/src/wiki/views/main/main_page.clj index bee03d5..11065c6 100644 --- a/src/wiki/views/main/main_page.clj +++ b/src/wiki/views/main/main_page.clj @@ -119,8 +119,8 @@ {:title "AnyChart Twitter" :target "_blank" :rel "nofollow" - :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 {:title "AnyChart LinkedIn" :target "_blank" From 7a51839b65f17882b6da36c796e8be76b16e4a7e Mon Sep 17 00:00:00 2001 From: Sergey Baranov Date: Fri, 28 Mar 2025 07:13:25 +0000 Subject: [PATCH 20/27] Feat: Add Medium link to footer Added a link to AnyChart's Medium blog to the footer social icons. Also adjusted the grid columns for the social icons for equal spacing. --- client-new/Gruntfile.js | 95 ++++++++++++++++++------------ client-new/src/less/styles.less | 65 +++++++++++--------- client-new/styles-less.css | 36 ++++++----- resources/public/local_main.min.js | 4 +- resources/public/main.css | 2 +- resources/public/main.min.js | 2 +- src/wiki/views/main/main_page.clj | 46 +++++++++------ 7 files changed, 145 insertions(+), 105 deletions(-) diff --git a/client-new/Gruntfile.js b/client-new/Gruntfile.js index 4be3dd3..a6ee822 100644 --- a/client-new/Gruntfile.js +++ b/client-new/Gruntfile.js @@ -1,63 +1,84 @@ -module.exports = function(grunt) { - grunt.loadNpmTasks('grunt-contrib-less'); - grunt.loadNpmTasks('grunt-contrib-uglify'); - grunt.loadNpmTasks('grunt-contrib-cssmin'); - grunt.loadNpmTasks('grunt-contrib-copy'); +module.exports = function (grunt) { + grunt.loadNpmTasks("grunt-contrib-less"); + grunt.loadNpmTasks("grunt-contrib-uglify"); + grunt.loadNpmTasks("grunt-contrib-cssmin"); + grunt.loadNpmTasks("grunt-contrib-copy"); grunt.initConfig({ - pkg: grunt.file.readJSON('package.json'), + pkg: grunt.file.readJSON("package.json"), less: { production: { options: { paths: ["bower_components/bootstrap/less", "src/less"], - cleancss: true + cleancss: true, }, files: { - "styles-less.css": "src/less/styles.less" - } - } + "styles-less.css": "src/less/styles.less", + }, + }, }, cssmin: { target: { files: { - "../resources/public/main.css": - ["styles-less.css", - "src/prettify-tomorrow.css"] - } - } + "../resources/public/main.css": [ + "styles-less.css", + "src/prettify-tomorrow.css", + ], + }, + }, }, uglify: { build: { - files: [{ - src: ['bower_components/jquery/dist/jquery.min.js', - //'bower_components/jquery-custom-content-scroller/jquery.mCustomScrollbar.min.js', - 'bower_components/bootstrap/dist/js/bootstrap.min.js', - 'bower_components/google-code-prettify/bin/prettify.min.js', - 'js/*.js'], - dest: '../resources/public/main.min.js' - }, { - src: ['bower_components/jquery/dist/jquery.min.js', - 'bower_components/bootstrap/dist/js/bootstrap.min.js', - 'bower_components/google-code-prettify/bin/prettify.min.js', - 'local_js/*.js'], - dest: '../resources/public/local_main.min.js' - }] - } + files: [ + { + src: [ + "bower_components/jquery/dist/jquery.min.js", + //'bower_components/jquery-custom-content-scroller/jquery.mCustomScrollbar.min.js', + "bower_components/bootstrap/dist/js/bootstrap.min.js", + "bower_components/google-code-prettify/bin/prettify.min.js", + "js/*.js", + ], + dest: "../resources/public/main.min.js", + }, + { + src: [ + "bower_components/jquery/dist/jquery.min.js", + "bower_components/bootstrap/dist/js/bootstrap.min.js", + "bower_components/google-code-prettify/bin/prettify.min.js", + "local_js/*.js", + ], + dest: "../resources/public/local_main.min.js", + }, + ], + }, }, copy: { main: { files: [ - {expand: true, flatten: true, src: ["./media/i/*"], dest: '../resources/public/i/'}, { expand: true, flatten: true, - src: ["./media/fonts/*", "./bower_components/font-awesome/fonts/*"], - dest: '../resources/public/fonts' + src: ["./media/i/*"], + dest: "../resources/public/i/", + }, + { + expand: true, + flatten: true, + src: [ + "./media/fonts/*", + "./bower_components/font-awesome/fonts/*", + ], + dest: "../resources/public/fonts", }, - ] - } - } + ], + }, + }, }); - grunt.registerTask('default', ['less', 'cssmin', 'copy', 'uglify', 'uglify_local']) + grunt.registerTask("default", [ + "less", + "cssmin", + "copy", + "uglify" /* , 'uglify_local' */, + ]); }; diff --git a/client-new/src/less/styles.less b/client-new/src/less/styles.less index 1750cf3..25306e7 100644 --- a/client-new/src/less/styles.less +++ b/client-new/src/less/styles.less @@ -1104,37 +1104,44 @@ div.container-fluid .row { .footer-inner { margin: 0; padding: 14px 0 0; - a.soc-network { - display: inline-block; - &:hover, &:focus { - text-decoration: none; - color: #fff; - .soc-network-icon { - border-color: #85caff; - color: #85caff; - } - } - .soc-network-icon { + + .social-icons { + display: grid; + place-content: center; + grid-template-columns: repeat(auto-fit, minmax(28px, 1fr)); + a.soc-network { display: inline-block; - margin-right: 7px; - vertical-align: middle; - width: 28px; - height: 28px; - text-align: center; - border-radius: 50%; - color: #c3c3c3; - border: 1px solid #c3c3c3; - &.fb { - font-size: 16px; - line-height: 25px; - } - &.tw { - font-size: 17px; - line-height: 26px; + + &:hover, &:focus { + text-decoration: none; + color: #fff; + .soc-network-icon { + border-color: #85caff; + color: #85caff; + } } - &.in { - font-size: 15px; - line-height: 24px; + .soc-network-icon { + display: grid; + place-content: center; + width: 28px; + height: 28px; + border-radius: 50%; + color: #c3c3c3; + border: 1px solid #c3c3c3; + &.fb { + font-size: 16px; + } + &.tw { + font-size: 17px; + } + &.in { + font-size: 15px; + + .sn-mini-icon { + position: relative; + top: -1px; + } + } } } } diff --git a/client-new/styles-less.css b/client-new/styles-less.css index ce19418..9996260 100644 --- a/client-new/styles-less.css +++ b/client-new/styles-less.css @@ -7386,41 +7386,45 @@ div.container-fluid .row { margin: 0; padding: 14px 0 0; } -.footer .footer-inner a.soc-network { +.footer .footer-inner .social-icons { + display: grid; + place-content: center; + grid-template-columns: repeat(auto-fit, minmax(28px, 1fr)); +} +.footer .footer-inner .social-icons a.soc-network { display: inline-block; } -.footer .footer-inner a.soc-network:hover, -.footer .footer-inner a.soc-network:focus { +.footer .footer-inner .social-icons a.soc-network:hover, +.footer .footer-inner .social-icons a.soc-network:focus { text-decoration: none; color: #fff; } -.footer .footer-inner a.soc-network:hover .soc-network-icon, -.footer .footer-inner a.soc-network:focus .soc-network-icon { +.footer .footer-inner .social-icons a.soc-network:hover .soc-network-icon, +.footer .footer-inner .social-icons a.soc-network:focus .soc-network-icon { border-color: #85caff; color: #85caff; } -.footer .footer-inner a.soc-network .soc-network-icon { - display: inline-block; - margin-right: 7px; - vertical-align: middle; +.footer .footer-inner .social-icons a.soc-network .soc-network-icon { + display: grid; + place-content: center; width: 28px; height: 28px; - text-align: center; border-radius: 50%; color: #c3c3c3; border: 1px solid #c3c3c3; } -.footer .footer-inner a.soc-network .soc-network-icon.fb { +.footer .footer-inner .social-icons a.soc-network .soc-network-icon.fb { font-size: 16px; - line-height: 25px; } -.footer .footer-inner a.soc-network .soc-network-icon.tw { +.footer .footer-inner .social-icons a.soc-network .soc-network-icon.tw { font-size: 17px; - line-height: 26px; } -.footer .footer-inner a.soc-network .soc-network-icon.in { +.footer .footer-inner .social-icons a.soc-network .soc-network-icon.in { font-size: 15px; - line-height: 24px; +} +.footer .footer-inner .social-icons a.soc-network .soc-network-icon.in .sn-mini-icon { + position: relative; + top: -1px; } .footer .footer-inner p { padding: 14px 0 7px 0; diff --git a/resources/public/local_main.min.js b/resources/public/local_main.min.js index 37af970..6bf8048 100644 --- a/resources/public/local_main.min.js +++ b/resources/public/local_main.min.js @@ -1,5 +1,5 @@ function fixHeaders(){$($("#page-content > .row > .col-lg-17 > h1").get(0)).detach().prependTo("#page-content")}function supports_html5_storage(){try{return"localStorage"in window&&null!==window.localStorage}catch(a){return!1}}function getOpenFolders(){var a=window.storage.getItem("anychart_docs_local");return null!=a?JSON.parse(a):null}function saveOpenFolders(a){window.storage.setItem("anychart_docs_local",JSON.stringify(a))}function expandCurrentMenu(a,b){$menu.find(".active").removeClass("active"),b=b.split("/");for(var c=[],d=b.length-1;d>=0&&b[d]!=version;d--)c.push(b[d]);c=c.reverse();for(var e,f,g="",d=0;dul");h.length&&!h.is(":visible")&&(h.toggle(),e.find("i").removeClass("ac-folder").addClass("ac-folder-open"),addFolder(e.attr("href").substr(a.length)))}e.addClass("active")}function addFolder(a){-1==open_folders.indexOf(a)&&(open_folders.push(a),saveOpenFolders(open_folders))}function removeFolder(a){var b=open_folders.indexOf(a);b>-1?(open_folders.splice(b,1),removeFolder(a)):saveOpenFolders(open_folders)}function addListeners(a){$menu.find("a>i.ac-folder").each(function(){var b=$(this),c=b.parent(),d=c.parent().find(">ul"),e=c.attr("href").substr(a.length);c.click(function(){return d.is(":visible")?addFolder(e):removeFolder(e),!1})})}function openFolders(a,b){for(var c=0;cul");e.length&&!e.is(":visible")&&(e.toggle(),$el.find("i").removeClass("ac-folder").addClass("ac-folder-open"))}}function initFolders(){open_folders=getOpenFolders(),null===open_folders&&(open_folders=[])}function highlightCode(){$("#page-content pre").addClass("prettyprint"),prettyPrint()}function loadPage(a){if(page==a)return!0;if(page=a,-1!=a.indexOf("search?q=")){var b=a.substr(a.indexOf("search?q=")+"search?q=".length);return console.log(b),searchFor(b),!1}return expandMenu(location.pathname),$("#bar").hide(),$("#shadow").hide(),!1}function fixLinks(){$("#page-content a").each(function(){var a=$(this);if(a.attr("href")&&a.attr("href").match(/^[a-zA-Z]/gi)){if(0==a.attr("href").indexOf("#"))return;if(0==a.attr("href").indexOf("http://"))return;if(0==a.attr("href").indexOf("https://"))return}})}function initSearch(){$("#page-content button").click(function(){history.back()}),fixLinks()}function searchFor(a){a&&($("#page-content").html("Searching..."),$menu.find(".active").removeClass("active"),window.history.pushState(null,null,"/"+version+"/search?q="+a),$.post("/"+version+"/search-data",{q:a},function(b){$("#page-content").html('

Search results for '+a+"

"),b.length?$(b).each(function(){$("#page-content .col-lg-17").append('

'+this.title+"

"+this.sn+"

")}):$("#page-content").append("Nothing found"),initSearch()}))}function fixToc(){var a=0,b=$("#page-content .row .col-lg-17 > *");for("a"==b.get(a).tagName.toLowerCase()&&a++;"br"==b.get(a).tagName.toLowerCase();)a++;for("h1"==b.get(a).tagName.toLowerCase()&&a++;"br"==b.get(a).tagName.toLowerCase();)a++;for("div"==b.get(a).tagName.toLowerCase()&&a++;"br"==b.get(a).tagName.toLowerCase();)a++;var c=$(b.get(a));$("#table-of-content-large").html(""),"ul"==c.prop("tagName").toLowerCase()&&(c.addClass("table_of_content"),c.find("li").addClass("main"),$("#table-of-content-large").append(c.clone()))}if(!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){function c(a){var b="length"in a&&a.length,c=_.type(a);return"function"===c||_.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}function d(a,b,c){if(_.isFunction(b))return _.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return _.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(ha.test(b))return _.filter(b,a,c);b=_.filter(b,a)}return _.grep(a,function(a){return U.call(b,a)>=0!==c})}function e(a,b){for(;(a=a[b])&&1!==a.nodeType;);return a}function f(a){var b=oa[a]={};return _.each(a.match(na)||[],function(a,c){b[c]=!0}),b}function g(){Z.removeEventListener("DOMContentLoaded",g,!1),a.removeEventListener("load",g,!1),_.ready()}function h(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=_.expando+h.uid++}function i(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(ua,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:ta.test(c)?_.parseJSON(c):c}catch(e){}sa.set(a,b,c)}else c=void 0;return c}function j(){return!0}function k(){return!1}function l(){try{return Z.activeElement}catch(a){}}function m(a,b){return _.nodeName(a,"table")&&_.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function n(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function o(a){var b=Ka.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function p(a,b){for(var c=0,d=a.length;d>c;c++)ra.set(a[c],"globalEval",!b||ra.get(b[c],"globalEval"))}function q(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(ra.hasData(a)&&(f=ra.access(a),g=ra.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)_.event.add(b,e,j[e][c])}sa.hasData(a)&&(h=sa.access(a),i=_.extend({},h),sa.set(b,i))}}function r(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&_.nodeName(a,b)?_.merge([a],c):c}function s(a,b){var c=b.nodeName.toLowerCase();"input"===c&&ya.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}function t(b,c){var d,e=_(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:_.css(e[0],"display");return e.detach(),f}function u(a){var b=Z,c=Oa[a];return c||(c=t(a,b),"none"!==c&&c||(Na=(Na||_("