Skip to content

Commit

Permalink
misc: Rename flusio to Flus
Browse files Browse the repository at this point in the history
  • Loading branch information
marienfressinaud committed Apr 19, 2024
1 parent 952c80c commit 3cfe5ba
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 19 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
This is the repository of the website [flus.fr](https://flus.fr).

If you’re looking for the code of [app.flus.fr](https://app.flus.fr), it’s in a
different repository: [flusio/flusio](https://github.com/flusio/flusio).
different repository: [flusio/Flus](https://github.com/flusio/Flus).

flus.fr is the entrance of my paid service based on flusio. It is intended to
flus.fr is the entrance of my paid service based on Flus. It is intended to
French people, thus the website is only translated in French.

flus.fr is licensed under [AGPL 3](https://github.com/flusio/flus.fr/blob/main/LICENSE.txt).
Expand Down
10 changes: 5 additions & 5 deletions src/controllers/api/Accounts.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public function show(Request $request): Response
* @request_header string PHP_AUTH_USER
* @request_param string account_id
* @request_param string service
* The name of the service making the request ('flusio' or 'freshrss').
* If the variable is invalid, it defaults to 'flusio'.
* The name of the service making the request ('flus' or 'freshrss').
* If the variable is invalid, it defaults to 'flus'.
*
* @response 401
* if the auth header is invalid
Expand All @@ -80,15 +80,15 @@ public function loginUrl(Request $request): Response
}

$account_id = $request->param('account_id', '');
$service = $request->param('service', 'flusio');
$service = strtolower($request->param('service', 'flus'));

$account = models\Account::find($account_id);
if (!$account) {
return Response::notFound();
}

if ($service !== 'flusio' && $service !== 'freshrss') {
$service = 'flusio';
if ($service !== 'flus' && $service !== 'freshrss') {
$service = 'flus';
}

$token = new models\Token(10, 'minutes');
Expand Down
66 changes: 66 additions & 0 deletions src/migrations/Migration202404190001RenameFlusioServiceToFlus.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php

namespace Website\migrations;

class Migration202404190001RenameFlusioServiceToFlus
{
public function migrate(): bool
{
$database = \Minz\Database::get();

$database->beginTransaction();

$database->exec(<<<'SQL'
UPDATE accounts
SET preferred_service = 'flus'
WHERE preferred_service = 'flusio';
ALTER TABLE accounts
RENAME COLUMN preferred_service
TO old_preferred_service;
ALTER TABLE accounts
ADD COLUMN preferred_service TEXT NOT NULL DEFAULT 'flus';
UPDATE accounts
SET preferred_service = old_preferred_service;
ALTER TABLE accounts
DROP COLUMN old_preferred_service;
SQL);

$database->commit();

return true;
}

public function rollback(): bool
{
$database = \Minz\Database::get();

$database->beginTransaction();

$database->exec(<<<'SQL'
UPDATE accounts
SET preferred_service = 'flusio'
WHERE preferred_service = 'flus';
ALTER TABLE accounts
RENAME COLUMN preferred_service
TO old_preferred_service;
ALTER TABLE accounts
ADD COLUMN preferred_service TEXT NOT NULL DEFAULT 'flusio';
UPDATE accounts
SET preferred_service = old_preferred_service;
ALTER TABLE accounts
DROP COLUMN old_preferred_service;
SQL);

$database->commit();

return true;
}
}
6 changes: 3 additions & 3 deletions src/models/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Account
#[Database\Column]
public ?\DateTimeImmutable $last_sync_at = null;

#[Validable\Inclusion(in: ['flusio', 'freshrss'], message: 'Saisissez un service valide.')]
#[Validable\Inclusion(in: ['flus', 'freshrss'], message: 'Saisissez un service valide.')]
#[Database\Column]
public string $preferred_service;

Expand Down Expand Up @@ -104,7 +104,7 @@ public function __construct(string $email)
$this->id = \Minz\Random::hex(32);
$this->email = \Minz\Email::sanitize($email);
$this->expired_at = \Minz\Time::fromNow(1, 'month');
$this->preferred_service = 'flusio';
$this->preferred_service = 'flus';
$this->preferred_tariff = 'stability';
$this->reminder = true;
$this->entity_type = 'natural';
Expand Down Expand Up @@ -253,7 +253,7 @@ public function hasExpired(): bool
* Return whether the account is sync or not.
*
* If the account is not sync, it probably means the user deleted its
* account on the connected services (i.e. flusio and/or FreshRSS).
* account on the connected services (i.e. Flus and/or FreshRSS).
*/
public function isSync(): bool
{
Expand Down
2 changes: 1 addition & 1 deletion src/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ CREATE TABLE accounts (
access_token TEXT,
last_sync_at TEXT,

preferred_service TEXT NOT NULL DEFAULT 'flusio',
preferred_service TEXT NOT NULL DEFAULT 'flus',
preferred_tariff TEXT NOT NULL DEFAULT 'stability',
reminder BOOLEAN NOT NULL DEFAULT false,

Expand Down
2 changes: 1 addition & 1 deletion src/views/home/index.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
</p>

<p>
<a href="https://github.com/flusio/flusio">
<a href="https://github.com/flusio/Flus">
→ Explorez le code source
</a>
</p>
Expand Down
2 changes: 1 addition & 1 deletion src/views/home/legal.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
</p>

<p>
Pour ce service, le document faisant foi <a href="https://github.com/flusio/flusio/blob/main/GDPR.txt">se trouve sur GitHub</a>.
Pour ce service, le document faisant foi <a href="https://github.com/flusio/Flus/blob/main/GDPR.txt">se trouve sur GitHub</a>.
</p>

<h4>Concernant flus.io</h4>
Expand Down
4 changes: 1 addition & 3 deletions src/views/home/project.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
<p>
Ce logiciel, tel qu’il était conçu, ne me permettait pas de faire ce
que j’avais en tête. J’ai donc débuté la conception d’un nouvel outil
sur des bases différentes : <a href="https://github.com/flusio/flusio">flusio</a>.
Le service nommé Flus —&nbsp;ou parfois Flus 2&nbsp;—, présenté sur ce
site, repose sur ce logiciel.
sur des bases différentes : <a href="https://github.com/flusio/Flus">Flus</a>.
</p>

<p>
Expand Down
4 changes: 2 additions & 2 deletions tests/controllers/AccountsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public function testLoginFailsIfAccessTokenIsNotSet(): void

public function testLogoutRedirectsToShow(): void
{
$service = $this->fake('randomElement', ['flusio', 'freshrss']);
$service = $this->fake('randomElement', ['flus', 'freshrss']);
$this->loginUser([
'preferred_service' => $service,
]);
Expand All @@ -230,7 +230,7 @@ public function testLogoutRedirectsToShow(): void
'csrf' => \Minz\Csrf::generate(),
]);

if ($service === 'flusio') {
if ($service === 'flus') {
$expected_location = 'https://app.flus.fr';
} else {
$expected_location = 'https://flus.io';
Expand Down
2 changes: 1 addition & 1 deletion tests/factories/AccountFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static function values(): array
},

'preferred_service' => function () use ($faker) {
return $faker->randomElement(['flusio', 'freshrss']);
return $faker->randomElement(['flus', 'freshrss']);
},

'email' => function () use ($faker) {
Expand Down

0 comments on commit 3cfe5ba

Please sign in to comment.