Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,5 @@ binary `NOTICE`/`LICENSE` files (`audit_jar_licenses.py`,
| `pylsp/` | Dockerized Python language server used by the UDF editor. |
| `y-websocket-server/` | Dockerized Yjs websocket server backing collaborative editing. |
| `forum/` | Flarum-based community forum setup (install scripts and seed SQL). |
| `config.php`, `.htaccess` | Flarum runtime config and Apache rewrite rules for the forum. |
| `config.php`, `extend.php`, `.htaccess` | Flarum runtime config, extenders, and Apache rewrite rules for the forum. |
| `litellm-config.yaml` | LiteLLM proxy configuration for AI features. |
27 changes: 27 additions & 0 deletions bin/extend.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

use Flarum\Extend;

// The Texera dashboard signs users up to the forum through Flarum's API
// (FlarumService.register). Flarum exempts only its login route from CSRF
// checks, so exempt the sign-up route too. Whether anyone may sign up is still
// decided by the forum's allow_sign_up setting.
return [
(new Extend\Csrf())->exemptRoute('users.create'),
];
7 changes: 2 additions & 5 deletions bin/forum/flarum.sql

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions bin/forum/macos-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ composer create-project flarum/flarum /opt/homebrew/var/www/flarum
composer require --working-dir=/opt/homebrew/var/www/flarum michaelbelgium/flarum-discussion-views
composer require --working-dir=/opt/homebrew/var/www/flarum fof/byobu:"*"
cp config.php /opt/homebrew/var/www/flarum/config.php
cp extend.php /opt/homebrew/var/www/flarum/extend.php
cp .htaccess /opt/homebrew/var/www/flarum/public/.htaccess

# Database Configuration
Expand Down
1 change: 1 addition & 0 deletions bin/forum/ubuntu-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ composer create-project flarum/flarum /opt/flarum
composer require --working-dir=/opt/flarum michaelbelgium/flarum-discussion-views
composer require --working-dir=/opt/flarum fof/byobu:"*"
sudo cp bin/config.php /opt/flarum/config.php
sudo cp bin/extend.php /opt/flarum/extend.php
sudo cp bin/.htaccess /opt/flarum/public/.htaccess
sudo chown -R www-data:www-data /opt/flarum
sudo mysql -u root -p < sql/flarum.sql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe("FlarumService", () => {
email: "alice@example.com",
password: "secret-token",
});
expect(req.request.headers.get("Authorization")).toContain("Token ");
expect(req.request.headers.has("Authorization")).toBe(false);
req.flush({});
});

Expand Down
12 changes: 4 additions & 8 deletions frontend/src/app/dashboard/service/user/flarum/flarum.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,11 @@ export class FlarumService {

register() {
const user = this.userService.getCurrentUser();
return this.http.post(
"forum/api/users",
{
data: {
attributes: { username: user!.email.split("@")[0] + user!.uid, email: user!.email, password: user!.googleId },
},
return this.http.post("forum/api/users", {
data: {
attributes: { username: user!.email.split("@")[0] + user!.uid, email: user!.email, password: user!.googleId },
},
{ headers: { Authorization: "Token hdebsyxiigyklxgsqivyswwiisohzlnezzzzzzzz;userId=1" } }
);
});
}

auth() {
Expand Down
Loading