Compare commits

...

5 commits

Author SHA1 Message Date
Natsu Kagami 5f876ffc25
Force display instance
Because I don't like this decision from Phanpy
2023-07-16 15:00:41 +02:00
Natsu Kagami eebd0d9d03
Automatically put people into DTTHDon login 2023-07-16 14:41:30 +02:00
Natsu Kagami be27b9d1e0
Add some DTTH notice 2023-07-16 14:36:08 +02:00
Natsu Kagami 6bcd4877bd
Add some build flags 2023-07-16 14:32:57 +02:00
Natsu Kagami a036c9a326
Get flakes to work 2023-07-16 14:26:31 +02:00
9 changed files with 126 additions and 8 deletions

4
.gitignore vendored
View file

@ -25,3 +25,7 @@ dist-ssr
# Custom
.env.dev
# Nix
.direnv
result

View file

@ -43,7 +43,7 @@ Everything is designed and engineered following my taste and vision. This is a p
- **Status actions (reply, boost, favourite, bookmark, etc) are hidden by default**.<br>They only appear in individual status page. This is to reduce clutter and distraction. It may result in lower engagement, but we're not chasing numbers here.
- **Boost is represented with the rocket icon**.<br>The green double arrow icon (retweet for Twitter) doesn't look right for the term "boost". Green rocket looks weird, so I use purple.
- **Short usernames (`@username`) are displayed in timelines, instead of the full account username (`@username@instance`)**.<br>Despite the [guideline](https://docs.joinmastodon.org/api/guidelines/#username) mentioned that "Decentralization must be transparent to the user", I don't think we should shove it to the face every single time. There are also some [screen-reader-related accessibility concerns](https://twitter.com/lifeofablindgrl/status/1595864647554502656) with the full username, though this web app is unfortunately not accessible yet.
- ~~**Short usernames (`@username`) are displayed in timelines, instead of the full account username (`@username@instance`)**.<br>Despite the [guideline](https://docs.joinmastodon.org/api/guidelines/#username) mentioned that "Decentralization must be transparent to the user", I don't think we should shove it to the face every single time. There are also some [screen-reader-related accessibility concerns](https://twitter.com/lifeofablindgrl/status/1595864647554502656) with the full username, though this web app is unfortunately not accessible yet.~~ DTTHDon fork displays the full username by default.
- **No autoplay for video/GIF/whatever in timeline**.<br>The timeline is already a huge mess with lots of people, brands, news and media trying to grab your attention. Let's not make it worse. (Current exception now would be animated emojis.)
- **Hash-based URLs**.<br>This web app is not meant to be a full-fledged replacement to Mastodon's existing front-end. There's no SEO, database, serverless or any long-running servers. I could be wrong one day.

61
flake.lock Normal file
View file

@ -0,0 +1,61 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1689068808,
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1689413807,
"narHash": "sha256-exuzOvOhGAEKWQKwDuZAL4N8a1I837hH5eocaTcIbLc=",
"owner": "nixOS",
"repo": "nixpkgs",
"rev": "46ed466081b9cad1125b11f11a2af5cc40b942c7",
"type": "github"
},
"original": {
"owner": "nixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

38
flake.nix Normal file
View file

@ -0,0 +1,38 @@
{
inputs.nixpkgs.url = github:nixOS/nixpkgs/nixpkgs-unstable;
inputs.flake-utils.url = github:numtide/flake-utils;
outputs = { self, nixpkgs, flake-utils, ... }: flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
lib = pkgs.lib;
in
{
packages.default = pkgs.buildNpmPackage {
pname = "dtth-phanpy";
version = "0.1.0";
buildInputs = with pkgs; [ git ];
src = lib.cleanSource ./.;
npmDepsHash = "sha256-1c6ZyWIfV4rBnZA7mSNH7ikCbJvbTRS3SacIjBW3yhc=";
# DTTH-specific env variables
VITE_CLIENT_NAME = "DTTH Phanpy";
VITE_CLIENT_ID = "ch.dtth.phanpy";
VITE_WEBSITE = "https://social.dtth.ch";
installPhase = ''
runHook preInstall
mkdir -p $out/lib
cp -r dist $out/lib/phanpy
runHook postInstall
'';
};
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [ nodejs ];
};
});
}

View file

@ -15,6 +15,9 @@ a.name-text.short:is(:hover, :focus) i {
font-style: normal;
opacity: 0.75;
}
.name-text i.instance {
opacity: 0.35;
}
.name-text .avatar {
vertical-align: middle;

View file

@ -60,12 +60,13 @@ function NameText({
<b>
<EmojiText text={displayName} emojis={emojis} />
</b>
{!showAcct && username && (
{!showAcct && username ? (
<>
{' '}
<i>@{username}</i>
</>
)}
) : ' '}
<i class="instance">{acct2}</i>
</>
) : short ? (
<i>@{username}</i>

View file

@ -15,7 +15,7 @@ function Login() {
const cachedInstanceURL = store.local.get('instanceURL');
const [uiState, setUIState] = useState('default');
const [instanceText, setInstanceText] = useState(
cachedInstanceURL?.toLowerCase() || '',
cachedInstanceURL?.toLowerCase() || 'gts.dtth.ch',
);
const [instancesList, setInstancesList] = useState([]);
@ -25,6 +25,9 @@ function Login() {
const res = await fetch(instancesListURL);
const data = await res.json();
setInstancesList(data);
// Automatically just login to DTTHDon
submitInstance("gts.dtth.ch")
} catch (e) {
// Silently fail
console.error(e);

View file

@ -38,7 +38,7 @@ function Welcome() {
</b>
</big>
</p>
<p class="desc">A minimalistic opinionated Mastodon web client.</p>
<p class="desc">A minimalistic opinionated DTTHDon web client.</p>
</div>
<div id="why-container">
<div class="sections">
@ -99,8 +99,13 @@ function Welcome() {
</div>
<hr />
<p>
<p>
<a href="https://git.dtth.ch/nki/phanpy" target="_blank">
DTTHDon Fork
</a>
</p>
<a href="https://github.com/cheeaun/phanpy" target="_blank">
Built
Original built
</a>{' '}
by{' '}
<a

View file

@ -16,7 +16,10 @@ const {
} = loadEnv('production', process.cwd());
const now = new Date();
const commitHash = execSync('git rev-parse --short HEAD').toString().trim();
const commitHash = (() => {
try { return execSync('git rev-parse --short HEAD').toString().trim(); }
catch (e) { return "unknown"; }
})();
const rollbarCode = fs.readFileSync(
resolve(__dirname, './rollbar.js'),