Skip to content

Commit 2f57da9

Browse files
authored
Merge pull request #523 from writer/dev
chore: Merge for release
2 parents b35cee4 + 1026de3 commit 2f57da9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+3517
-1264
lines changed

.github/workflows/ci-macos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: Use Node.js
3232
uses: actions/setup-node@v4
3333
with:
34-
node-version: "18.x"
34+
node-version: "20.x"
3535
cache: npm
3636

3737
- name: install python3 environment

.github/workflows/ci-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: Use Node.js
3232
uses: actions/setup-node@v4
3333
with:
34-
node-version: "18.x"
34+
node-version: "20.x"
3535
cache: npm
3636

3737
- name: install python3 environment

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: Use Node.js
3232
uses: actions/setup-node@v4
3333
with:
34-
node-version: "18.x"
34+
node-version: "20.x"
3535
cache: npm
3636

3737
- name: install python3 environment

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Use Node.js
2626
uses: actions/setup-node@v4
2727
with:
28-
node-version: "18.x"
28+
node-version: "20.x"
2929
cache: npm
3030

3131
- name: install python3 environment

alfred/ci.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
def ci(front, back, e2e, docs):
1616
no_flags = (not front and not back and not e2e and not docs)
1717

18+
if front or no_flags:
19+
alfred.invoke_command("npm.lint")
20+
alfred.invoke_command("npm.build")
1821
if back or no_flags:
1922
alfred.invoke_command("ci.mypy")
2023
alfred.invoke_command("ci.ruff")
2124
alfred.invoke_command("ci.pytest")
22-
if front or no_flags:
23-
alfred.invoke_command("npm.lint")
24-
alfred.invoke_command("npm.build")
2525
if docs or no_flags:
2626
alfred.invoke_command("npm.docs.test")
2727
if e2e:
@@ -32,8 +32,12 @@ def ci_mypy():
3232
alfred.run("mypy ./src/writer --exclude app_templates/*")
3333

3434
@alfred.command("ci.ruff", help="linting with ruff")
35-
def ci_ruff():
36-
alfred.run("ruff check")
35+
@alfred.option('--fix', '-f', help="fix linting errors", is_flag=True, default=False)
36+
def ci_ruff(fix):
37+
if fix:
38+
alfred.run("ruff check --fix")
39+
else:
40+
alfred.run("ruff check")
3741

3842
@alfred.command("ci.pytest", help="run pytest on ./tests")
3943
def ci_test():

docs/components/component_page.mdx.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ A function, in this example `handle_event`, should be implemented in your code t
7171

7272
## Reference
7373

74-
* <a href="https://github.com/streamsync-cloud/streamsync/blob/dev/src/ui/{{fileRef}}" target="_blank" >Explore this component's source code on GitHub</a>
74+
* <a href="https://github.com/writer/writer-framework/blob/dev/src/ui/{{fileRef}}" target="_blank" >Explore this component's source code on GitHub</a>

docs/framework/authentication.mdx

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
title: "Authentication"
33
---
44

5-
The Writer Framework authentication module allows you to restrict access to your application.
6-
7-
Framework will be able to authenticate a user through an identity provider such as Google, Microsoft, Facebook, Github, Auth0, etc.
5+
The Writer Framework authentication module allows you to restrict access to your application. Framework will be able to authenticate a user through an identity provider such as Google, Microsoft, Facebook, Github, Auth0, etc.
86

97
<Warning>
108
Authentication is done before accessing the application. It is not possible to
@@ -13,19 +11,13 @@ Framework will be able to authenticate a user through an identity provider such
1311

1412
## Use Basic Auth
1513

16-
Basic Auth is a simple authentication method that uses a username and password. Authentication configuration is done in [the `server_setup.py` module](custom-server.md).
17-
18-
::: warning Password authentication is not safe for critical application
19-
Basic Auth authentication is not secure for critical applications.
14+
Basic Auth is a simple authentication method that uses a username and password. Authentication configuration is done in the [server_setup.py module](/framework/custom-server).
2015

21-
A user can intercept the plaintext password if https encryption fails.
22-
It may also try to force password using brute force attacks.
23-
24-
For added security, it's recommended to use identity provider (Google, Microsoft, Facebook, Github, Auth0, etc.).
25-
:::
16+
<Warning>
17+
Password authentication and Basic Auth are not sufficiently secure for critical applications. If HTTPS encryption fails, a user could potentially intercept passwords in plaintext. Additionally, these methods are vulnerable to brute force attacks that attempt to crack passwords. To enhance security, it is advisable to implement authentication through trusted identity providers such as Google, Microsoft, Facebook, GitHub, or Auth0.
18+
</Warning>
2619

27-
*server_setup.py*
28-
```python
20+
```python server_setup.py
2921
import os
3022
import writer.serve
3123
import writer.auth
@@ -41,12 +33,12 @@ writer.serve.register_auth(auth)
4133
### Brute force protection
4234

4335
A simple brute force protection is implemented by default. If a user fails to log in, the IP of this user is blocked.
44-
Writer framework will ban the IP from either the X-Forwarded-For header or the X-Real-IP header or the client IP address.
36+
Writer framework will ban the IP from either the `X-Forwarded-For` header or the `X-Real-IP` header or the client IP address.
4537

4638
When a user fails to log in, they wait 1 second before they can try again. This time can be modified by
47-
modifying the value of delay_after_failure.
39+
modifying the value of `delay_after_failure`.
4840

49-
<img src="./images/auth_too_many_request.png" style="width: 100%; margin: auto">
41+
![429](/framework/images/429.png)
5042

5143
## Use OIDC provider
5244

@@ -55,9 +47,7 @@ Here is an example configuration for Google.
5547

5648
![Authentication OIDC Principle](/framework/images/auth.png)
5749

58-
**server_setup.py**
59-
60-
```python
50+
```python server_setup.py
6151
import os
6252
import writer.serve
6353
import writer.auth
@@ -88,9 +78,7 @@ The Writer Framework provides pre-configured OIDC providers. You can use them di
8878

8979
You have to register your application into [Google Cloud Console](https://console.cloud.google.com/).
9080

91-
_server_setup.py_
92-
93-
```python
81+
```python server_setup.py
9482
import os
9583
import writer.serve
9684
import writer.auth
@@ -108,9 +96,7 @@ writer.serve.register_auth(oidc)
10896

10997
You have to register your application into [Github](https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/registering-a-github-app#registering-a-github-app)
11098

111-
_server_setup.py_
112-
113-
```python
99+
```python server_setup.py
114100
import os
115101
import writer.serve
116102
import writer.auth
@@ -128,9 +114,8 @@ writer.serve.register_auth(oidc)
128114

129115
You have to register your application into [Auth0](https://auth0.com/).
130116

131-
_server_setup.py_
132117

133-
```python
118+
```python server_setup.py
134119
import os
135120
import writer.serve
136121
import writer.auth
@@ -147,13 +132,14 @@ writer.serve.register_auth(oidc)
147132

148133
### Authentication workflow
149134

150-
<img src="./framework/images/authentication_oidc.png" />
135+
<img src="/framework/images/authentication_oidc.png" />
151136

152137
## User information in event handler
153138

154139
When the `user_info` route is configured, user information will be accessible
155140
in the event handler through the `session` argument.
156141

142+
157143
```python
158144
def on_page_load(state, session):
159145
email = session['userinfo'].get('email', None)
@@ -189,8 +175,6 @@ The default authentication error page look like this:
189175

190176
<img src="/framework/images/auth_unauthorized_default.png" />
191177

192-
_streamsync.auth.Unauthorized_
193-
194178
| Parameter | Description |
195179
| ----------- | ---------------------- |
196180
| status_code | HTTP status code |

docs/framework/backend-driven-ui.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ with ui.find(container):
9898

9999
### Component methods
100100

101-
UI manager contains methods linked to each front-end component. For example, in previous code snippets we provide a `ui.Text` method, which is used for creating [Text components](https://www.streamsync.cloud/component-list.html#text).
101+
UI manager contains methods linked to each front-end component. For example, in previous code snippets we provide a `ui.Text` method, which is used for creating [Text components](https://dev.writer.com/components/text).
102102

103103
This method expects `content: dict` as first argument, which enables you to set the field properties of the component, through corresponding keys:
104104
```python
@@ -147,7 +147,7 @@ In addition to `content`, a set of fields which is specific to the component typ
147147
</Note>
148148
- **`position: int`**: Determines the display order of the component in relation to its siblings.
149149
Position `0` means that the component is the first child of its parent.
150-
Position `-2` is used for components – such as [sidebars](https://www.streamsync.cloud/component-list.html#sidebar) – that have a specific reserved position not related to their siblings.
150+
Position `-2` is used for components – such as [sidebars](https://dev.writer.com/components/sidebar) – that have a specific reserved position not related to their siblings.
151151
```python
152152
ui.Text(
153153
{"text": "Hello Parent, I'm your first child!"},
@@ -170,7 +170,7 @@ In addition to `content`, a set of fields which is specific to the component typ
170170

171171
ui.Text({"text": "My visibility depends on the @{my_var}!"}, visible="my_var")
172172
```
173-
- **`handlers: dict[str, callable]`**: Attaches [event handlers](https://www.streamsync.cloud/event-handlers.html) to the component. Each dictionary key represents an event, and its value is the corresponding handler.:
173+
- **`handlers: dict[str, callable]`**: Attaches [event handlers](https://dev.writer.com/framework/event-handlersl) to the component. Each dictionary key represents an event, and its value is the corresponding handler.:
174174
```python
175175
def increment(state):
176176
state["counter"] += 1
@@ -190,7 +190,7 @@ In addition to `content`, a set of fields which is specific to the component typ
190190
# Both approaches yield the same outcome.
191191
```
192192
*A component can be linked to multiple event handlers.*
193-
- **`binding: dict[str, str]`**: Links the component to a state variable via [binding](https://www.streamsync.cloud/builder-basics.html#binding). The dictionary key is the bindable event, and the value is the state variable's name:
193+
- **`binding: dict[str, str]`**: Links the component to a state variable via [binding](https://dev.writer.com/framework/builder-basics#binding). The dictionary key is the bindable event, and the value is the state variable's name:
194194
```python
195195
initial_state = wf.init_state({
196196
"header_text": "Default Text"
@@ -269,4 +269,4 @@ with ui.refresh_with(id="cmc-column-1"):
269269
{"text": 'To Hello World, or not to Hello World?'},
270270
id="hello-world-new"
271271
)
272-
```
272+
```

0 commit comments

Comments
 (0)