Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Axolotl presage #985

Merged
merged 214 commits into from
Jan 31, 2024
Merged

Axolotl presage #985

merged 214 commits into from
Jan 31, 2024

Conversation

nanu-c
Copy link
Collaborator

@nanu-c nanu-c commented Jan 21, 2023

This pr replaces the go backend, crayfish, textsecure and crayfish with presage, libsignal-service-rs and libsignal.

The new backend is written in rust instead of go in order to the upstream library from signal and share efforts with whisperfish from sailfishos, flare as gtk app, and gurk-rs a terminal client. The work in progress only supports linking as secondary device for now and after a successful linking axolotl has to be restarted.

There are 2 features for now:

  • tauri, tauri is a replacment for electron
  • ut, this is the system integration for ubuntu touch

Development

  • install rust
  • install npm
  • get dependencies for axolotl web cd axolotl-web && npm i
  • for tauri:
    • cargo run --features tauri
    • or cargo tauri dev --features tauri (this commands enables hot reloading of everything)
  • for ubuntu touch
    • cargo run --features ut
    • or: clickable build --libs axolotlweb && clickable desktop
  • native development without tauri or ut
    • run axolotl as deamon cargo run -- -d
    • run axolotl-web cd axolotl-web && npm run dev

A lot of things have to be done

In libsignal-service-rs (means broken in all projects)

  • contact discovery

In presage

  • save only necessary messages to store
  • group handling
  • add contact on incoming message from unknown sender

Axolotl

  • sending messages
  • sending attachments
  • contact editing
  • profile pictures
  • group pictures
  • importing contacts
  • register with a phone number
  • update message/chat-list on incoming messages
  • notifications
  • fix the ci
  • generate a new linking qr code without restart
  • redirect to main page when the previous page was the device link page

Axolotl packaging

  • ubuntu touch click
  • flatpak
  • deb package
  • snap

We can also add testing

  • unit test for axolotl-web
  • test for the rust backend
  • add cypress e2e tests

@Flaburgan
Copy link
Collaborator

Wow! This is huge, and a very big step in the good direction! Thank you for all the hard work!

Copy link
Collaborator

@Blackoverflow Blackoverflow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I couldn't help myself to start reviewing.

I will review further, when you request it.

axolotl-web/package.json Show resolved Hide resolved
@@ -23,26 +23,26 @@
<div v-for="chat in chatList" :key="chat.id" class="row">
<!-- chat entry -->
<div
:id="chat.ID"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes like these happen, because there is no defined model for objects send to the frontend.
I want to suggest, that it may help to decouple the object models for communication with the frontend (DTO's) from the backend logic. This would introduce a mapping between backend objects and DTO's, but I think its worth it. What's your take on that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have an example for how this could be done? The changes here are happening because in rust a variable shouldn't start with an uppercase letter.

alt="Avatar image"
@error="onImageError($event)"
/>
{{ chat.ID[0] }}
{{ `${chat.title[0]}${chat.title[1]?chat.title[1]:""}` }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to introduce a function for this logic. I'm not a fan of logic within the template.

@@ -43,11 +43,11 @@
alt="Avatar image"
@error="onImageError($event)"
/>
{{ c.Name[0] ? c.Name[0] + c.Name[1] : c.Name[0] }}
{{ c.name[0] ? c.name[0] + c.name[1] : c.name[0] }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line still contains a bug. Correct would be:
{{ c.name[1] ? c.name[0] + c.name[1] : c.name[0] }}

Also: I would like to introduce a function for this logic. I'm not a fan of logic within the template.

@@ -76,12 +76,12 @@
alt="Avatar image"
@error="onImageError($event)"
/>
{{ c.Name[0] ? c.Name[0] + c.Name[1] : c.Name[0] }}
{{ c.name[0] ? c.name[0] + c.name[1] : c.name[0] }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm even less happy about copied (wrong) logic within the template.

Comment on lines +272 to +283
/*
.avatar{
border-radius: 50px;
background-color: #2090ea;
width: 50px;
height: 50px;
justify-content: center;
align-items: center;
display: flex;
color: #FFF;
margin:20px;
} */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove it or use it.

"
class="avatar"
>
<div :key="message.ID" :class="{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

message.ID vs chat.id can we make this consistent?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message has no field ID anymore, this is still a clean up in progress

Comment on lines 2 to 23
<div :key="message.ID" :class="{
'col-12': true,
'message-container': true,
outgoing: message.is_outgoing,
sent: message.IsSent && message.is_outgoing,
read: message.IsRead && message.is_outgoing,
delivered: message.Receipt && message.is_outgoing,
incoming: !message.is_outgoing,
status:
(message.Flags > 0 &&
message.Flags !== 11 &&
message.Flags !== 13 &&
message.Flags !== 14) ||
message.StatusMessage ||
(message.Attachment &&
message.Attachment.includes('null') &&
message.Message === ''),
hidden: message.Flags === 18,
error: message.timestamp === 0 || message.SendingError,
'group-message':
isGroup && (message.Flags === 0 || message.Flags === 12 || message.Flags === 13),
}">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a lot of logic here for setting the right css classes. Is there a cleaner way to make this?
And can we move the logic into funktions, if its more than one logic operation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for here, the Flags field doesn't exist anymore but we have to add something like this again.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And i agree to move it into functions

Comment on lines 26 to 27
isGroup &&
(message.Flags === 0 || message.Flags === 12 || message.Flags === 13)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic is copied within 5 lines of code.

@@ -93,7 +93,7 @@
@long-press="paste"
/>
</div>
<div v-if="messageInput !== ''" class="messageInput-btn-container">
<div v-if="messageInput !== '' || true" class="messageInput-btn-container">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this, as soon as its not needed anymore

@nanu-c
Copy link
Collaborator Author

nanu-c commented Jan 26, 2023

@Blackoverflow thank you for your review!

@dvn0
Copy link

dvn0 commented Nov 12, 2023

Actually the ci always builds it at the moment. Don't know which checkout you have -> https://github.com/nanu-c/axolotl/actions/runs/6836277934/job/18591020900?pr=985#step:9:799

Yes, I noticed that it was working in CI and I've copied the steps there as closely as possible. I've tried several checkouts of this branch. Last commit I tried was d30193b

@dvn0
Copy link

dvn0 commented Nov 12, 2023

I figured it out. I was not copying the axolotl-web/dist/ dir to the correct path. Apologies for the noise!

jonnius and others added 2 commits November 16, 2023 08:07
WIP: Avoid npm nodejs version conflict in Clickable images
@nanu-c
Copy link
Collaborator Author

nanu-c commented Nov 18, 2023

I figured it out. I was not copying the axolotl-web/dist/ dir to the correct path. Apologies for the noise!

No problem! It's still a lot to do.

@TriVoxel
Copy link

TriVoxel commented Dec 6, 2023

Hey guys, glad to see you chippin' away at this! Progress is looking good. I'm stoked! Keep at it, you got something awesome here, I can tell!!

@torfmaster
Copy link

Hi dear axolotl team,

first of all thank you for creating axolotl and (more importantly) maintaining it. I have been using it for almost two years now (dispite the frequent changes on the Signal server side).

I have a uncommon proposal, but let me explain:

My impression is that axolotl has become (at least for me) a "single point of failure" for the whole idea of using an operating system on a mobile phone which is neither Android nor iOS. That is: Axolotl is the only available Signal client for free and open source operating systems. However, there is currently no version that is compatible with the Signal servers so the only option is to use Signal Desktop on a Laptop.
My proposal is: merge this PR as soon as it produces usable artifacts and make the remaining tasks (and the remaining artifacts) issues to be solved independently. This makes progress more visible (I actually only accidentally stumbled over this PR) and also implements some "divide and conquer" strategy for the remaining to dos.

I could myself offer the following during my Christmas Holidays (on this branch or on "main")

  • testing on Ubuntu Touch
  • some knowledge about Rust (including cross-compilation, warp)
  • experience in web development (though mostly react+typescript)

Let me know if (and how) I can support!

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any idea why the registration is broken ? I know thhat the server return 422 and I don't mind debugging, but if anyone has knowledge that saves time, it will be appreciated. thanks

@nanu-c nanu-c merged commit 99d28e3 into main Jan 31, 2024
10 of 13 checks passed
@nanu-c nanu-c deleted the axolotl_presage branch August 6, 2024 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.