Skip to content

Commit

Permalink
readme and link cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
trinidz committed Nov 19, 2024
1 parent 539dd7c commit bf19f06
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 57 deletions.
57 changes: 28 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,66 +31,65 @@ cd rssnotes
mkdir db
mkdir qrcodes
```
3. Create a file called `logfile.log`.

4. Create a file called `docker-compose.yml`.

5. Copy and paste the contents from the [sample.docker-compose.yml](https://github.com/trinidz/rssnotes/blob/main/sample.docker-compose.yml) file into your `docker-compose.yml` file. Save and exit the file.

6. Create a file called `.env`.
3. Create four files: `docker-compose.yml`, `.env`, `seedrelays.json` and `logfile.log`.
```bash
touch docker-compose.yml
touch .env
touch seedrelays.json
touch logfile.log
```

7. Copy and paste the contents of the [sample.env](https://github.com/trinidz/rssnotes/blob/main/sample.env) file into your `.env` file.
4. Copy and paste the contents from the [sample.docker-compose.yml](https://github.com/trinidz/rssnotes/blob/main/sample.docker-compose.yml) file into your `docker-compose.yml` file. Save and exit the file.

5. Copy and paste the contents of the [sample.env](https://github.com/trinidz/rssnotes/blob/main/sample.env) file into your `.env` file.

8. Modify the contents of your `.env` file. Add values for the following REQUIRED environment variables.
6. Modify the contents of your `.env` file. Add values for the following REQUIRED environment variables.
- **RELAY_PRIVKEY** --- Use a nostr key generator to create a new set of nostr private and public keys for the relay. DO NOT USE your own existing nostr keys. The relay will use these keys to follow all of your rss feeds and for other background tasks.
- **RELAY_PUBKEY** --- acquired from the new private key created above.
- **RANDOM_SECRET** --- This is used to generate the nostr public/private keys for the rss feeds. This should be a randomly generated string at least 20 characters long.
- **RELAY_URL** --- the URL of your relay ex.: myrssrelay.com. This is only used for display on the relay's main page. It does not affect your relays actual URL.

9. The remaining variables in the `.env` file are optional. Save and exit the `.env` file.

10. Create a file called `seedrelays.json`.
7. The remaining variables in the `.env` file are optional. Save and exit the `.env` file.

11. Copy and paste the contents from the [sample.seedrelays.json](https://github.com/trinidz/rssnotes/blob/main/sample.seedrelays.json) file into your `seedrelays.json` file. Save and exit the file.
8. Copy and paste the contents from the [sample.seedrelays.json](https://github.com/trinidz/rssnotes/blob/main/sample.seedrelays.json) file into your `seedrelays.json` file. Save and exit the file.

12. Run `docker-compose up -d` while in the `rssnotes` directory. This will start the rssnotes container in the background. Go to http://localhost:3334 in your browser.
9. Run `docker-compose up -d` while in the `rssnotes` directory. This will start the rssnotes container in the background. Go to http://localhost:3334 in your browser.

## Run the relay as a service on your system
## Run the relay as a service
1. Clone the repo and cd into the repo folder.
```bash
git clone https://github.com/trinidz/rssnotes
cd rssnotes
```
2. Download the correct [rssnotes released binary](https://github.com/trinidz/rssnotes/releases) for your system into the rssnotes folder.

3. Copy and rename the binary and other necessary files:
3. Rename downloaded the binary:
```bash
# The binary format is simillar to rssnotes-rx.x.x-ostype-arch. Change the cp command to match the specific binary you downloaded.
cp rssnotes-rx.x.x-ostype-arch rssnotes
# The binary format is simillar to rssnotes-rx.x.x-ostype-arch. Change the downloaded binary name to rssnotes.
mv rssnotes-rx.x.x-ostype-arch rssnotes
# Make sure the binary is executable
chmod +x rssnotes
```
4. Copy and rename the other necessary files:
```bash
cp sample.env .env
```
```bash
cp sample.seedrelays.json seedrelays.json
```
4. Open the .env file and add values for the following REQUIRED environment variables.
5. Open the `.env` file and add values for the following REQUIRED environment variables.
- **RELAY_PRIVKEY** --- Use a nostr key generator to create a new set of nostr private and public keys for the relay. DO NOT USE your own existing nostr keys. The relay will use these keys to follow all of your rss feeds and for other background tasks.
- **RELAY_PUBKEY** --- acquired from the new private key created above.
- **RANDOM_SECRET** --- This is used to generate the nostr public/private keys for the rss feeds. This should be a randomly generated string at least 20 characters long.
- **RELAY_URL** --- the URL of your relay ex.: myrssrelay.com. This is only used for display on the relay's main page. It does not affect your relays actual URL.

5. The remaining variables in the .env file are optional.
6. The remaining variables in the `.env` file are optional.

6. Create a systemd service file:
7. Create a systemd service file:

```bash
sudo nano /etc/systemd/system/rssnotes.service
```

7. Add the following contents:
8. Add the following contents:

```ini
[Unit]
Expand All @@ -108,24 +107,24 @@ MemoryLimit=2G
[Install]
WantedBy=multi-user.target
```
8. Replace /home/myuser/ with the actual paths where the files are stored.
9. Replace /home/myuser/ with the actual paths where the files are stored.

9. Reload systemd to recognize the new service:
10. Reload systemd to recognize the new service:

```bash
sudo systemctl daemon-reload
```

10. Start the service:
11. Start the service:

```bash
sudo systemctl start rssnotes
```

11. Enable the service to start on boot:
12. Enable the service to start on boot:

```bash
sudo systemctl enable rssnotes
```

12. Go to http://localhost:3334 in your browser.
13. Go to http://localhost:3334 in your browser.
19 changes: 9 additions & 10 deletions handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"fmt"
"io"
"net/http"
"strconv"
"strings"
"text/template"
"time"
Expand Down Expand Up @@ -155,7 +154,7 @@ func createFeed(r *http.Request, secret *string) *GUIEntry {
guientry.NPubKey, _ = nip19.EncodePublicKey(publicKey)

guientry.BookmarkEntity.ImageURL = s.DefaultProfilePicUrl
if parsedFeed.Image != nil && IsValidIconUrl(parsedFeed.Image.URL) {
if parsedFeed.Image != nil && IconUrlExists(parsedFeed.Image.URL) {
guientry.BookmarkEntity.ImageURL = parsedFeed.Image.URL
}

Expand Down Expand Up @@ -380,7 +379,7 @@ func importFeeds(opmlUrls []opml.Outline, secret *string) []*GUIEntry {
}

localImageURL := s.DefaultProfilePicUrl
if parsedFeed.Image != nil && IsValidIconUrl(parsedFeed.Image.URL) {
if parsedFeed.Image != nil && IconUrlExists(parsedFeed.Image.URL) {
localImageURL = parsedFeed.Image.URL
}

Expand Down Expand Up @@ -455,27 +454,27 @@ func handleExportOpml(w http.ResponseWriter, r *http.Request) {
var rssOMPL = &opml.OPML{
Version: "1.0",
Head: opml.Head{
Title: "rsslay Feeds",
Title: "rssnotes Feeds",
DateCreated: time.Now().Format(time.RFC3339),
OwnerName: "rsslay",
OwnerName: "rssnotes",
},
}

data, _ := getSavedEntities()

for _, feed := range data {
rssOMPL.Body.Outlines = append(rssOMPL.Body.Outlines, opml.Outline{
Type: "rss",
Text: feed.PubKey,
Title: feed.PrivateKey,
Type: "rss",
Text: feed.PubKey,
//Title: feed.PrivateKey,
XMLURL: feed.URL,
HTMLURL: feed.URL,
Created: strconv.FormatInt(feed.LastUpdate, 10),
//Created: strconv.FormatInt(feed.LastUpdate, 10),
})
}

w.Header().Add("content-type", "application/opml")
w.Header().Add("content-disposition", "attachment; filename="+time.Now().Format(time.DateOnly)+"-rsslay.opml")
w.Header().Add("content-disposition", "attachment; filename="+time.Now().Format(time.DateOnly)+"-rssnotes.opml")
outp, err := rssOMPL.XML()
if err != nil {
log.Print("[ERROR] exporting opml file")
Expand Down
4 changes: 2 additions & 2 deletions helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ func IsValidHttpUrl(rawUrl string) bool {
return true
}

func IsValidIconUrl(url string) bool {
func IconUrlExists(url string) bool {
req, err := http.NewRequest("GET", url, nil)
if err != nil {
log.Printf("[DEBUG] %v", err)
return false
}

ctx, cancel := context.WithTimeout(req.Context(), 1*time.Second)
ctx, cancel := context.WithTimeout(req.Context(), 2*time.Second)
defer cancel()

req = req.WithContext(ctx)
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func main() {
return
}

// basic properties returned on the NIP-11 endpoint
//returned on the NIP-11 endpoint
relay.Info.Name = s.RelayName
relay.Info.PubKey = s.RelayPubkey
relay.Info.Description = s.RelayDescription
Expand Down
2 changes: 1 addition & 1 deletion web/templates/created.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
<p>
<a href="https://github.com/trinidz/rssnotes"><strong>rssnotes</strong></a> original work by <a href="https://fiatjaf.com">fiatjaf</a> and <a href="https://piraces.dev">piraces</a> modifications by <a
href="https://njump.me/npub15ucds95a8m2whgj4esll39lhxta5jwk8lqvmtz6ne8lf8ksmggrqz74dq7">trinidz</a>. The source code is
<a href="https://github.com/trinidz/rssnotes/blob/main/LICENSE">UNlicensed</a>. Keep the good vibes 🤙
<a href="https://unlicense.org/">UNlicensed</a>. Keep the good vibes 🤙
</p>
</div>
</footer>
Expand Down
2 changes: 1 addition & 1 deletion web/templates/imported.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
<p>
<a href="https://github.com/trinidz/rssnotes"><strong>rssnotes</strong></a> original work by <a href="https://fiatjaf.com">fiatjaf</a> and <a href="https://piraces.dev">piraces</a> modifications by <a
href="https://njump.me/npub15ucds95a8m2whgj4esll39lhxta5jwk8lqvmtz6ne8lf8ksmggrqz74dq7">trinidz</a>. The source code is
<a href="https://github.com/trinidz/rssnotes/blob/main/LICENSE">UNlicensed</a>. Keep the good vibes 🤙
<a href="https://unlicense.org/">UNlicensed</a>. Keep the good vibes 🤙
</p>
</div>
</footer>
Expand Down
15 changes: 5 additions & 10 deletions web/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,9 @@ <h2 class="subtitle has-text-centered">RSS is powerful! 🍰 Everything is RSSib
<ul>
<li><b>For sites missing a feed (with support for <a
href="https://github.com/RSS-Bridge/rss-bridge/tree/master/bridges">several sites</a>), try using <a
href="https://rss-bridge.github.io/rss-bridge/">RSS-Bridge</a>:</b> get the rss feed for your page
(ex.
<a href="https://rssbridge.nostr.moe/?action=display&bridge=Reddit&context=single&r=nostr&score=2&d=hot&search=&format=Atom">r/nostr
in Reddit</a>) using any public instance (ex. <a href="https://rssbridge.nostr.moe/">nostr.moe
public bridge</a>)
href="https://rss-bridge.github.io/rss-bridge/">RSS-Bridge.</a></b>
</li>
<li><b><a href="https://rsshub.app/">RssHub</a> it's capable of generating RSS feeds from pretty much
<li><b><a href="https://rsshub.app/">RssHub</a> is capable of generating RSS feeds from pretty much
everything too</b>, check it how to use it in <a
href="https://docs.rsshub.app/">https://docs.rsshub.app</a> (ex. <a
href="https://rsshub.app/github/topics/nostr">repos inside nostr topic in GitHub</a>)
Expand Down Expand Up @@ -155,10 +151,9 @@ <h2 class="subtitle">Existing feeds:</h2>
<tr>
<td><img src="{{.BookmarkEntity.ImageURL}}" alt="feed icon" width="128" height="128"></td>
<td><a href="{{.BookmarkEntity.URL}}" style="word-break: break-all;">{{.BookmarkEntity.URL}}</a></td>
<td>
<a href="https://njump.me/{{.NPubKey}}" style="word-break: break-all;">{{.NPubKey}}</a>
<td><span>{{.NPubKey}}</span>
<p>---</p>
<a href="https://www.nostr.guru/p/{{.BookmarkEntity.PubKey}}" style="word-break: break-all;">{{.BookmarkEntity.PubKey}}</a>
<span>{{.BookmarkEntity.PubKey}}</span>
<td><img src="/assets/qrcodes/{{.NPubKey}}.png" alt="npub qrcode" width="128" height="128">
</td>
<td>
Expand All @@ -177,7 +172,7 @@ <h2 class="subtitle">Existing feeds:</h2>
<p>
<a href="https://github.com/trinidz/rssnotes"><strong>rssnotes</strong></a> original work by <a href="https://fiatjaf.com">fiatjaf</a> and <a href="https://piraces.dev">piraces</a> modifications by <a
href="https://njump.me/npub15ucds95a8m2whgj4esll39lhxta5jwk8lqvmtz6ne8lf8ksmggrqz74dq7">trinidz</a>. The source code is
<a href="https://github.com/trinidz/rssnotes/blob/main/LICENSE">UNlicensed</a>. Keep the good vibes 🤙
<a href="https://unlicense.org/">UNlicensed</a>. Keep the good vibes 🤙
</p>
</div>
</footer>
Expand Down
6 changes: 3 additions & 3 deletions web/templates/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ <h2 class="subtitle">Found feeds (showing a maximum of 50, refine your query if
<td><img src="{{.BookmarkEntity.ImageURL}}" alt="feed icon" width="128" height="128"></td>
<td><a href="{{.BookmarkEntity.URL}}" style="word-break: break-all;">{{.BookmarkEntity.URL}}</a></td>
<td>
<a href="https://njump.me/{{.NPubKey}}" style="word-break: break-all;">{{.NPubKey}}</a>
<span>{{.NPubKey}}</span>
<p>---</p>
<a href="https://www.nostr.guru/p/{{.BookmarkEntity.PubKey}}" style="word-break: break-all;">{{.BookmarkEntity.PubKey}}</a>
<span>{{.BookmarkEntity.PubKey}}</span>
<td><img src="/assets/qrcodes/{{.NPubKey}}.png" alt="npub qrcode" width="128" height="128">
</td>
<td>
Expand All @@ -137,7 +137,7 @@ <h2 class="subtitle">Found feeds (showing a maximum of 50, refine your query if
<p>
<a href="https://github.com/trinidz/rssnotes"><strong>rssnotes</strong></a> original work by <a href="https://fiatjaf.com">fiatjaf</a> and <a href="https://piraces.dev">piraces</a> modifications by <a
href="https://njump.me/npub15ucds95a8m2whgj4esll39lhxta5jwk8lqvmtz6ne8lf8ksmggrqz74dq7">trinidz</a>. The source code is
<a href="https://github.com/trinidz/rssnotes/blob/main/LICENSE">UNlicensed</a>. Keep the good vibes 🤙
<a href="https://unlicense.org/">UNlicensed</a>. Keep the good vibes 🤙
</p>
</div>
</footer>
Expand Down

0 comments on commit bf19f06

Please sign in to comment.