Skip to content

Commit 2c00f16

Browse files
authored
Merge pull request #74 from kovan/update-docs-deps-new-fix-links
Update docs to deps-new, fix broken links and wrap-csrf refs
2 parents 63154b5 + 390905c commit 2c00f16

6 files changed

Lines changed: 19 additions & 19 deletions

File tree

resources/md/clojurescript.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ Above, the `input-field` component consists of a `label` component we defined ea
172172

173173
Notice that even though `label` is a function we're not calling it, but instead we're putting it in a vector. The reason for this is that we're specifying the component hierarchy. The components will be run by Reagent when they need to be rendered.
174174

175-
This is behavior makes it trivial to implement the [React Flux](http://facebook.github.io/react/docs/flux-overview.html) pattern.
175+
This is behavior makes it trivial to implement the [React Flux](https://facebookarchive.github.io/flux/docs/in-depth-overview) pattern.
176176

177177
```
178178
Views--->(actions) --> Dispatcher-->(callback)--> Stores---+
@@ -371,11 +371,12 @@ your application. It will intercept any request to the server that isn't a `HEAD
371371
```clojure
372372
(defn home-routes [base-path]
373373
[base-path
374-
{:middleware [middleware/wrap-csrf
375-
middleware/wrap-formats]}
374+
{:middleware [middleware/wrap-formats]}
376375
["/" {:get home-page}]])
377376
```
378377

378+
Note that CSRF protection is configured via `:anti-forgery` in the site defaults configuration in `system.edn`, and is applied globally by `ring-defaults` rather than as a per-route middleware.
379+
379380
We would now need to pass the CSRF token along with the request. One way to do this is to pass the token in the `x-csrf-token` header in the request with the value of the token.
380381

381382
To do that we'll first need to set the token as a hidden field on the page:

resources/md/guestbook.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,21 @@ chmod +x posix-install.sh
4040
sudo ./posix-install.sh
4141
```
4242

43-
For both macOS and Linux, you will need [`clj-new`](https://github.com/seancorfield/clj-new) installed as follows:
43+
For both macOS and Linux, you will also need [neil](https://github.com/babashka/neil) to generate new projects:
4444

4545
```
46-
clojure -Ttools install com.github.seancorfield/clj-new '{:git/tag "v1.2.404"}' :as clj-new
46+
brew install babashka/brew/neil
4747
```
4848

49-
For information on customization options, for example on how to change your install location, see [the official docs here](https://clojure.org/guides/getting_started#_clojure_installer_and_cli_tools).
49+
Alternatively, you can use [deps-new](https://github.com/seancorfield/deps-new) directly. For information on customization options, for example on how to change your install location, see [the official docs here](https://clojure.org/guides/getting_started#_clojure_installer_and_cli_tools).
5050

5151
### Creating a new application
5252

5353
Once you have the Clojure CLI installed, you can run the following commands in your terminal to
5454
initialize your application:
5555

5656
```
57-
clojure -Tclj-new create :template io.github.kit-clj :name kit/guestbook
57+
neil new io.github.kit-clj/kit kit/guestbook
5858
cd guestbook
5959
```
6060

resources/md/profiles.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
## Profiles
22

3-
Profiles are clj-new template arguments. They are helpful when you are starting a new project and know ahead of time what functionality you will need. In such cases, you can use profiles to set up a new Kit project without having to manually add libraries and wire them together.
3+
Profiles are template arguments used when generating a new project. They are helpful when you are starting a new project and know ahead of time what functionality you will need. In such cases, you can use profiles to set up a new Kit project without having to manually add libraries and wire them together.
44

5-
Unlike [modules](/docs/modules.html), profiles are tied to clj-new, the project generation tool. You can only use them when creating a project.
5+
Unlike [modules](/docs/modules.html), profiles are tied to the project generation tool. You can only use them when creating a project.
66

7-
Running `clojure -Tclj-new create :template io.github.kit-clj :name yourname/app` will create an application using the default profile template.
7+
Running `neil new io.github.kit-clj/kit yourname/app` will create an application using the default profile template.
88
However, if you would like to attach further functionality to your template you can append profile hints for the extended functionality.
99

1010
Default libs included with no profile specified:
@@ -28,13 +28,13 @@ Additional profiles:
2828
To add a profile, pass it as an argument after your application name, e.g.:
2929

3030
```
31-
clojure -Tclj-new create :template io.github.kit-clj :name yourname/app :args '[+selmer]'
31+
neil new io.github.kit-clj/kit yourname/app --selmer
3232
```
3333

3434
You can also mix multiple profiles when creating the application, e.g.:
3535

3636
```
37-
clojure -Tclj-new create :template io.github.kit-clj :name yourname/app :args '[+selmer +xtdb]'
37+
neil new io.github.kit-clj/kit yourname/app --selmer --xtdb
3838
```
3939

4040
### Libraries

resources/md/routes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ In the guestbook application example we saw the following route defined:
6161
```
6262

6363
This route serves the home page when it receives a `GET` request and extracts the name and the message form parameters when it receives a `POST` request.
64-
Note that `POST` requests must contain a CSRF token by default. This is handled by the `middleware/wrap-csrf` declaration below:
64+
Note that `POST` requests must contain a CSRF token when anti-forgery protection is enabled in your site defaults configuration.
6565

6666
```clojure
6767
(defn home-routes [base-path]
@@ -70,7 +70,7 @@ Note that `POST` requests must contain a CSRF token by default. This is handled
7070
:post save-message!}]])
7171
```
7272

73-
Please refer [here](/docs/security.html#cross_site_request_forgery_protection) for more details on managing CSRF middleware.
73+
CSRF protection is provided by [ring-defaults](https://github.com/ring-clojure/ring-defaults) via the `:anti-forgery` key in your site defaults configuration in `system.edn`. When enabled, `ring.middleware.anti-forgery/wrap-anti-forgery` is applied automatically. In HTML forms, use the `{% csrf-field %}` Selmer tag to include the token.
7474

7575
### Return values
7676

resources/md/sessions.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ Below we have a simple example of interaction with the session.
3737

3838
(def app-routes
3939
[""
40-
{:middleware [middleware/wrap-csrf
41-
middleware/wrap-formats]}
40+
{:middleware [middleware/wrap-formats]}
4241
["/login/:id" {:get (fn [{:keys [path-params] :as req}]
4342
(set-user! (:id path-params) req))}]
4443
["/remove" {:get remove-user!}]

resources/templates/home.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ <h3>Introductory Kit Course</h3>
7575
</div>
7676

7777
<div class="column-wrapper" id="easy-start">
78-
<p>Using <a href="https://clojure.org/guides/getting_started">Clojure tools</a>, getting started is as easy as:</p>
78+
<p>Using <a href="https://github.com/babashka/neil">neil</a> and <a href="https://clojure.org/guides/getting_started">Clojure tools</a>, getting started is as easy as:</p>
7979
<pre class="bash hljs">
80-
<span class="prompt">$ </span><span class="cmd">clojure -Ttools install com.github.seancorfield/clj-new '{:git/tag "v1.2.404"}' :as clj-new</span>
81-
<span class="prompt">$ </span><span class="cmd">clojure -Tclj-new create :template io.github.kit-clj :name yourname/guestbook</span>
80+
<span class="prompt">$ </span><span class="cmd">brew install clojure/tools/clojure babashka/brew/neil</span>
81+
<span class="prompt">$ </span><span class="cmd">neil new io.github.kit-clj/kit yourname/guestbook</span>
8282
</pre>
8383
<h4><a href="https://github.com/kit-clj/playground/">Quickstart with Github Codespaces</a></h4>
8484
</div>

0 commit comments

Comments
 (0)