1
0
mirror of git://jb55.com/damus synced 2024-09-29 00:10:43 +00:00
Go to file
Daniel D’Aquino 26d2627a1c Cache videos
This commit implements a simple but functional video cache.

It works by providing a method called `maybe_cached_url`, where a video
URL can be passed in, and this method will either return the URL of a
cached version of this video if available, or the original URL if not. It also
downloads new video URLs on the background into the cache folder for use
next time.

Functional testing
-------------------

PASS

Device: iPhone 15 simulator
iOS: 17.4
Damus: Approximately this commit
Setup:
- Debug connection
- Expiry time locally changed to 5 minutes

Steps:
1. Basic functionality
  1. Go to a profile with lots of videos
  2. Scroll down
  3. Filter logs to only logs that start with "Loading video with URL"
  4. Check that most videos are being loaded from external URLs. PASS
  5. Now restart the app and go to that same profile
  6. Scroll down and watch logs. Videos should now be loaded with an internal file URL. PASS
2. Automatic cache refresh after expiry
  1. Go to the video-heavy profile, make note of the external URL.
  2. Go to a different screen and then come back to that video. Make sure the file was loaded from cache. PASS
  3. Now go to a different screen and wait 5 minutes.
  4. Come back to the same video. It should be loaded from the external URL. PASS
3. "Clear cache" button functionality
  1. Go to the video-heavy profile, make note of the external URL.
  2. Go to a different screen and then come back to that video. Make sure the file was loaded from cache. PASS
  3. Now quit the app (to ensure file is not in use when trying to delete it)
  4. Clear cache in settings
  5. Go back to the same video. It should now be loaded from the external URL. PASS

Performance testing
-----------------------

Device: iPhone 13 mini
iOS: 17.3.1
Damus: This commit
Baseline: 87de88861adb3b41d73998452e7c876ab5ee06bf
Setup:
- Debug connection
- Expiry time locally changed to 5 minutes
- Running on Profile mode, with XCode Instruments

Steps:
1. Start recording network activity with XCode Instruments
2. Go to a video-heavy profile (e.g. Julian Figueroa)
3. Scroll down to a specific video (Make sure to scroll through at least 5 videos)
4. Stop recording and measure the "Bytes In" from "Network connections"
5. Repeat this for all test configurations

Results:
- Baseline (No caching support): 26.74 MiB
- This commit (First run, cleared cache): 40.52 MiB
- This commit (Second run, cache filled with videos): 8.13 MiB

Automated test coverage
------------------------

PASS

Device: iPhone 15 simulator
iOS: 17.4
Damus: This commit
Coverage:
- Ran new automated tests multiple times. PASS 3/3 times
- Ran all other automated tests. PASS

Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Link: 20240411004129.84436-3-daniel@daquino.me
Signed-off-by: William Casarin <jb55@jb55.com>
2024-04-17 15:06:12 -07:00
.github/ISSUE_TEMPLATE Update issue templates 2024-03-25 10:12:13 -05:00
damus Cache videos 2024-04-17 15:06:12 -07:00
damus-c nip19: add kind to naddr & nevent 2024-01-16 16:55:24 -08:00
damus.xcodeproj Cache videos 2024-04-17 15:06:12 -07:00
DamusNotificationService mute: integrate new MutelistManager 2024-02-26 11:30:03 -08:00
damusTests Cache videos 2024-04-17 15:06:12 -07:00
damusUITests initial commit 2022-04-02 16:57:42 -07:00
devtools script: fetch popular users 2023-05-24 18:26:18 -07:00
docs docs: specify that we are referring to Damus not the kernel 2024-03-25 10:34:00 +01:00
flatbuffers add swift flatbuffers 2023-08-26 20:46:42 -07:00
nostrdb note: add is_quote_repost helper 2024-03-17 08:54:35 +00:00
nostrscript Fix relay URL trailing slash issues 2024-03-25 09:24:17 +01:00
.envrc v1.6 changelog 2023-07-04 12:21:12 -07:00
.gitignore config: show git hash in version info 2023-08-01 09:29:09 -07:00
.mailmap add transifex mailmap 2023-12-13 11:02:15 -08:00
.rgignore add .rgignore 2023-04-02 09:07:20 -07:00
CHANGELOG.md Update changelog 2024-02-28 23:56:13 -08:00
LICENSE add license 2022-04-16 15:11:03 -07:00
Makefile make: add tags target 2023-08-06 13:50:20 -07:00
Package.swift Replace Starscream with URLSessionWebSocketTask 2023-04-24 18:11:07 -07:00
Purple.storekit Damus Purple initial Proof-of-Concept support 2023-12-24 09:30:26 -08:00
README.md Update README.md 2024-03-13 10:06:01 -05:00
shell.nix todo: add local todo helper 2023-08-06 13:50:20 -07:00
ss.png screenshots 2022-06-21 08:32:56 -07:00
TODO todo: add local todo helper 2023-08-06 13:50:20 -07:00
transifex.yml Fix localization issues, and export and import translations 2023-03-16 23:00:52 -04:00

Run Test Suite

damus

A twitter-like nostr client for iPhone, iPad and MacOS.

How is Damus better than twitter?

There are no toxic algorithms.
You can send or receive zaps (satoshis) without asking for permission.
There is no central database. Therefore, Damus is censorship resistant.
There are no ads.
You don't have to reveal sensitive personal information to sign up.
No email is required.
No phone number is required.
Damus is free and open source software.
There is no Big Tech moat. Therefore, seamless interoperability with thousands or millions of other nostr apps is possible, and is how Damus and nostr win.

If there are no ads, how is Damus funded?

Damus offers a paid subscription 🟣 purple 🟣 https://damus.io/purple/.
Initial benefits include a unique subscriber number, subscriber badge, and auto-translate powered by DeepL.

Damus has also graciously received donations or grants from hundreds of Damus users, Opensats, and the Human Rights Foundation.

Spec Compliance

damus implements the following Nostr Implementation Possibilities

Getting Started on Damus

Damus iOS

  1. Get the Damus app on the iOS App Store: https://apps.apple.com/ca/app/damus/id1628663131

⚙️ Settings (gear icon, top right)

  • Relays: You can add more relays to send your notes to by tapping the "+".
  • Public Key (pubkey): Your public, personal address and how people can find and tag you
  • Secret Key: Your private key unique to you. Never share your private key publicly and share with other clients at your own risk!
    • Save your keys somewhere safe
  • Log out

🏠 Personal Feed (home icon, bottom navigation)

  • Feed from everyone you follow
  • Can post notes by tapping the blue + button

Notes (under 🏠 Personal Feed)

  • Sending a Note is easy and it goes to both your 🏠 Personal and 🔍 Global Feeds
  • To tag a user you must grab their pubkey:
    1. Search their username in the search bar at the top of the 🔍 Global Feed and click their profile
    2. Tap the 🔑 icon which will copy their pubkey to your clipboard
    3. Go back to your 🏠 Personal Feed and tap the blue + button to compose your Note
    4. Add @ directly followed by the pubkey (e.g., @npub1xtscya34g58tk0z605fvr788k263gsu6cy9x0mhnm87echrgufzsevkk5s)
  • You can also tap the ellipsis menu of a Note (three dots in top right of note) to grab their User ID aka pubkey or Note ID to link directly to a Note.
  • Currently you can't delete your Notes in the iOS app
  • Share images by pasting the image url which you can grab from nostr.build, imgbb, imgur, etc. (i.e., https://i.ibb.co/2SHZbwm/alpha60.jpg). Currently images only load for people you follow in the 🏠 Personal Feed. Images are not automatically loaded in 🔍 Global Feed
  • Engaging with Notes
    • 💬 Replying to a Note: Tap the chat icon underneath the note. This will show up in the users notifications and in your 🏠 Personal and 🔍 Global Feeds
    • ♺ Reposts: Tap the repost icon which will show up in your 🏠 Personal and 🔍 Global Feeds
    • ♡ Likes: Tap the heart icon. Users will not get a notification, and cannot see who liked their note (currently, web clients can see your pfp only)

💬 Encrypted DMs (chat app, bottom navigation)

  • Tap the chat icon and you'll notice there's nothing to see at first. Go to a user profile and tap the 💬 chat icon next to the follow button to begin a DM

🔍 Global Feed (magnify glass, bottom navigation)

  • View the Global Feed from all the relays you've added in ⚙️ Settings. Currently you can only search hashtags and user names and pubkeys

🔔 Notifications

  • All your notifications except 💬 DMs

👤 Change Your Profile (PFP) and Bio

  1. Go to your Profile Page on Damus app
  2. Tap on Edit button at the top
  3. You will see text fields to update your information and bio
  4. For PFP, insert a URL containing your image (support video: https://cdn.jb55.com/vid/pfp-editor.mp4)
  5. Save

Request Sats

Paste an invoice from your favorite LN wallet. (Sats or Satoshis are the smallest denomination of bitcoin)

Alby (browser extension)

  • Get the Alby browser extension and create your Alby address [yourname]@getalby.com or connect your existing Lightning wallet
  • Convert your Damus secret key from nsec to hex at https://damus.io/key then go to Settings in Alby and under the Nostr section at the bottom of the page add your private hex key. You can also generate new address in the extension
  • Click the Alby extension > click Receive > enter the amount of Sats > click Get Invoice > click Copy > then paste into Damus
  • Note: On Damus Web it will appear as a string of characters but on Damus iOS it will appear as a clickable image

Zeus (mobile app)

  • Download Zeus app (iOS, Google, APK)
  • Tap Get Started button > tap Connect a node > click on + sign (top right) > select Indhub > press Scan Lndhub QR > (from the Alby browser extension… click your account on the top left > click Manage Accounts > click 3-dot menu to right of your account and click Export Account to get a QR code then go back to Zeus app) > scan the QR Code and tap Save Node Config button
  • To create an invoice tap Lightning > tap Receive > type in amount > tap Create Invoice > tap Copy Invoice > paste into a new Damus note

Contributing

Contributors welcome! Start by examining known issues: https://github.com/damus-io/damus/issues.

Mailing lists

We have a few mailing lists that anyone can join to get involved in damus development:

  • dev - development discussions
  • patches - code submission and review
  • product - product discussions
  • design - design discussions

Contributing

See docs/CONTRIBUTING.md

Privacy

Your internet protocol (IP) address is exposed to the relays you connect to, and third party media hosters (e.g. nostr.build, imgur.com, giphy.com, youtube.com etc.) that render on Damus. If you want to improve your privacy, consider utilizing a service that masks your IP address (e.g. a VPN) from trackers online.

The relay also learns which public keys you are requesting, meaning your public key will be tied to your IP address.

It is public information which other profiles (npubs) you are exchanging DMs with. The content of the DMs is encrypted.

Translations

Translators welcome! Join the Transifex project.

All user-facing strings must have a comment in order to provide context to translators. If a SwiftUI component has a comment parameter, use that. Otherwise, wrap your string with NSLocalizedString with the comment field populated.

Awards

Damus lead dev and founder Will awards developers with satoshis! There may be nostr badges awarded for contributors in the future... :)

First contributors:

  1. @randymcmillan
  2. @jcarucci27

git log bot

npub1fjtdwclt9lspjy8huu3qklr7eklp5uq90u6yh8mec290pqxraccqlufnas