Skip to content

Commit

Permalink
Remove repo listing route
Browse files Browse the repository at this point in the history
This is no longer used since we pre-compute the indexes and write them
to s3 on deploy.
  • Loading branch information
tobias committed Jul 3, 2023
1 parent 2bcad37 commit d2a1ee7
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 159 deletions.
8 changes: 4 additions & 4 deletions src/clojars/repo_indexing.clj
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
size
"\n")))

(defn generate-index
(defn- generate-index
^String
[path entries]
(safe-hiccup/html5
Expand Down Expand Up @@ -96,7 +96,7 @@

(def ^:private index-file-name "index.html")

(defn get-path-entries
(defn- get-path-entries
[repo-bucket path]
(->> (s3/list-entries repo-bucket path)
;; filter out index files
Expand All @@ -105,7 +105,7 @@
(str/ends-with? Key index-file-name))))
(sort-entries)))

(defn normalize-path
(defn- normalize-path
[path]
(let [path (cond
(str/blank? path) nil
Expand All @@ -117,7 +117,7 @@
(str path "/")
path)))

(defn handler
(defn- handler
[{:keys [error-reporter repo-bucket]} type {:as _data :keys [path]}]
(when (= :repo-path-needs-index type)
(let [path (normalize-path path)]
Expand Down
14 changes: 0 additions & 14 deletions src/clojars/routes/repo_listing.clj

This file was deleted.

5 changes: 1 addition & 4 deletions src/clojars/system.clj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
[clojars.stats :refer [artifact-stats]]
[clojars.storage :as storage]
[clojars.web :as web]
[clojars.web.repo-listing :as repo-listing]
[com.stuartsierra.component :as component]
[duct.component.endpoint :refer [endpoint-component]]
[duct.component.handler :refer [handler-component]]
Expand Down Expand Up @@ -93,16 +92,14 @@
:notifications (notifications/notification-component)
:repo-bucket (s3/s3-client (get-in config [:s3 :repo-bucket]))
:repo-indexer (repo-indexing/repo-indexing-component)
:repo-lister (repo-listing/repo-lister (:cache-path config))
:storage (storage-component (:repo config) (:cdn-token config) (:cdn-url config))))
(component/system-using
{:app [:clojars-app]
:clojars-app [:db :github :gitlab :error-reporter :event-emitter :http-client
:mailer :repo-lister :stats :search :storage]
:mailer :stats :search :storage]
:event-emitter [:error-reporter]
:http [:app]
:notifications [:db :mailer]
:repo-indexer [:error-reporter :repo-bucket]
:repo-lister [:repo-bucket]
:event-receiver [:error-reporter]
:storage [:error-reporter :repo-bucket]}))))
4 changes: 1 addition & 3 deletions src/clojars/web.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
[clojars.routes.artifact :as artifact]
[clojars.routes.group :as group]
[clojars.routes.repo :as repo]
[clojars.routes.repo-listing :as repo-listing]
[clojars.routes.session :as session]
[clojars.routes.token :as token]
[clojars.routes.token-breach :as token-breach]
Expand Down Expand Up @@ -48,7 +47,7 @@
:status 400})))))

(defn- main-routes
[{:as _system :keys [db event-emitter mailer repo-lister search stats]}]
[{:as _system :keys [db event-emitter mailer search stats]}]
(let [db (:spec db)]
(routes
(GET "/" _
Expand Down Expand Up @@ -77,7 +76,6 @@
#(html-doc "DMCA" {:account %}
(raw (slurp (io/resource "dmca.html"))))))
session/routes
(repo-listing/routes repo-lister)
(group/routes db event-emitter)
(artifact/routes db stats)
;; user routes must go after artifact routes
Expand Down
94 changes: 0 additions & 94 deletions src/clojars/web/repo_listing.clj

This file was deleted.

40 changes: 0 additions & 40 deletions test/clojars/unit/web/repo_listing_test.clj

This file was deleted.

0 comments on commit d2a1ee7

Please sign in to comment.