Skip to content

Commit

Permalink
Removing some TODOs and changes to the readme (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
kashishvjain authored Dec 13, 2023
1 parent 21dab44 commit 4370ac4
Show file tree
Hide file tree
Showing 12 changed files with 6 additions and 51 deletions.
24 changes: 6 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ your previous posts may break.

## Access

Access your website at `https://yourdomain.com/private`. You will be prompted to create account or login if required.
Access your website at `https://{yourdomain}.com/private`. You will be prompted to create account or login if required.

## Debugging

Expand Down Expand Up @@ -130,7 +130,7 @@ specified in the .env file.
In order to play nice with the fediverse, it must be hosted on an
SSL-enabled endpoint.

### Easiest: Glitch
### Easy: Glitch

Use Glitch to create a new project! Glitch will provide you with hosting for your instance of Shuttlecraft,
and you can start for FREE!
Expand All @@ -140,22 +140,10 @@ It all starts when you click this link -> [Remix this project on Glitch](https:/
WHOA! What happened? Well, a copy of the Shuttlecraft code was sent to a new, unique, owned-by-you web server and it started getting set up. You just need to make it yours by following these steps:

1. First, make sure the URL of your Glitch project is the one you like. You can change it in the "Settings" menu.
2. Then, configure the options [as described above](#config) using the .env editor.
3. Finally, login to the dashboard at `https://yourdomain.glitch.me/private`.
4. Done!

### Basic: Reverse proxy

1. Clone the repo to your own server.
2. Configure it and set it up to run on a port of your choosing.
3. Configure Caddy or Nginx with a Certbot SSL certificate.
4. Configure your domain to proxy requests to the localhost port.

A sample `Caddyfile` is included in the repo. [Install Caddy](https://caddyserver.com/download) and run:

```
caddy run --config Caddyfile
```
2. Then, configure the options [as described above](#config) using the .env editor.
3. Finally, create and login to the dashboard at `https://yourdomain.glitch.me/private`.
4. It is very important that the domain you add while creating you user is `https://{yourdomain}.glitch.me`. If not this will break things!
5. Done!

### Advanced: Docker

Expand Down
1 change: 0 additions & 1 deletion design/dms.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
{{> minicomposer inReplyTo=lastIncoming to=feed.id}}
</div>
{{else}}
<!-- TODO: empty state? -->
<div class="empty">
Select a conversation. To create a new one, navigate to a profile.
</div>
Expand Down
1 change: 0 additions & 1 deletion design/feeds.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
{{/with}}
{{/each}}
{{else}}
<!-- TODO: empty state? -->
<div class="empty">
No posts. <a href="/private/feeds/{{getUsername feed.id}}">Reload</a>
</div>
Expand Down
4 changes: 0 additions & 4 deletions design/login.handlebars
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
<form class='authetication-form' action='/account/login' method='POST'>
<h1 class='form-title'>Login</h1>

{{! <label for='username' class='form-label'>Username:</label> }}

<input type='text' id='username' name='username' class='form-input' placeholder='username' required />

{{! <label for='password' class='form-label'>Password:</label> }}

<input type='password' id='password' name='password' class='form-input' placeholder='password' required />
{{#if message}}
<div style='color: red;'>{{message}}</div>
Expand Down
12 changes: 0 additions & 12 deletions lib/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ const logger = debug('ono:account');

const { DOMAIN } = process.env;

// TODO:
// Change the mydomain
// const mydomain = "localhost:3000";

/**
* The function `getInboxIndex` returns the inbox index by reading a JSON dictionary from a specified
* path.
Expand Down Expand Up @@ -366,11 +362,6 @@ export const getNotifications = () => {
return readJSONDictionary(notificationsFile);
};

// todo: expose an interface for adding to the block list.
// const writeBlocks = (data) => {
// return writeJSONDictionary(blocksFile, data);
// }

/**
* The function checks if an actor is blocked based on a list of banned users or domains.
* @returns The function `isBlocked` returns a boolean value. It returns `true` if the `actor` is found
Expand Down Expand Up @@ -580,7 +571,6 @@ export const createNote = async (body, cw, inReplyTo, toUser, editOf) => {

if (inReplyTo || toUser) {
if (toUser) {
// TODO: validate the to field is a legit account
to = [toUser];
cc = [];
directMessage = true;
Expand Down Expand Up @@ -770,8 +760,6 @@ export const follow = async request => {
} else {
createActivity(activity.object);
}
} else if (activity.type === 'Announce') {
// TODO: fetch boosted posts, etc.
}
});
});
Expand Down
1 change: 0 additions & 1 deletion lib/notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ export const getActivity = async id => {
if (indexed !== false) {
// if is cached, no need to check for file
if (indexed.type === 'fail') {
// TODO: could retry after a while...
throw new Error('Activity was unreachable', indexed);
} else {
const noteFile = getFileName(id);
Expand Down
2 changes: 0 additions & 2 deletions lib/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,6 @@ const ensureDataFolder = () => {
if (!fs.existsSync(path.resolve(prefsFile))) {
logger('create default settings', prefsFile);
writeJSONDictionary(prefsFile, DEFAULT_SETTINGS);
} else {
// todo: validate settings, add any missing keys with default values
}
};

Expand Down
1 change: 0 additions & 1 deletion lib/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ export const fetchUser = async user => {
} else {
logger('fetch fresh user for', user, `${username}`);
// attempt to fetch a new one async
// TODO: needs to be debounced - could try to load same user many times quickly
fetchUserFromSource(username, account?.actor?.id).catch(err =>
console.error('Error updating user data for', username, err)
);
Expand Down
1 change: 0 additions & 1 deletion public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const fetch = (url, type, payload = undefined) => {
return new Promise((resolve, reject) => {
const Http = new XMLHttpRequest();
Http.open(type, url);
// TODO: should be a parameter
Http.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
Http.send(payload);

Expand Down
4 changes: 0 additions & 4 deletions routes/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ router.get('/notifications', async (req, res) => {
notes.map(async notification => {
const { actor } = await fetchUser(notification.notification.actor);
let note, original;
// TODO: check if user is in following list
actor.isFollowing = isFollowing(actor.id);

if (notification.notification.type === 'Like' || notification.notification.type === 'Announce') {
Expand Down Expand Up @@ -340,7 +339,6 @@ router.get('/post', async (req, res) => {
* Update and create the post using the POST method
*/
router.post('/post', async (req, res) => {
// TODO: this is probably supposed to be a post to /api/outbox
const post = await createNote(req.body.post, req.body.cw, req.body.inReplyTo, req.body.to, req.body.editOf);
if (post.directMessage === true) {
// return html partial of the new post for insertion in the feed
Expand Down Expand Up @@ -673,8 +671,6 @@ router.post('/follow', async (req, res) => {
// send unfollow
await ActivityPub.sendUndoFollow(actor, status.id);

// todo: this should just be a function like removeFollowing

let following = getFollowing();

// filter out the one we are removing
Expand Down
5 changes: 0 additions & 5 deletions routes/inbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ router.post('/', async (req, res) => {
logger('Incoming follow request');
addFollower(incomingRequest);

// TODO: should wait to confirm follow acceptance?
ActivityPub.sendAccept(actor, incomingRequest);
break;
case 'Undo':
Expand Down Expand Up @@ -158,7 +157,6 @@ router.post('/', async (req, res) => {
if (incomingRequest.object.directMessage === true || addressedOnlyToMe(incomingRequest)) {
await acceptDM(incomingRequest.object, incomingRequest.object.attributedTo);
} else if (isReplyToMyPost(incomingRequest.object)) {
// TODO: What about replies to replies? should we traverse up a bit?
if (!isIndexed(incomingRequest.object.id)) {
createActivity(incomingRequest.object);
addNotification({
Expand Down Expand Up @@ -188,9 +186,6 @@ router.post('/', async (req, res) => {
// from a following
// or from someone else who replied to a following?
// the visibility should be determined on the feed
// TODO: we may want to discard things NOT from followings
// since they may never be seen
// and we can always go fetch them...
createActivity(incomingRequest.object);
}

Expand Down
1 change: 0 additions & 1 deletion routes/outbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ router.get('/', async (req, res) => {
collection.id = `${outboxUrl}?offset=${offset}`;
collection.partOf = outboxUrl;
collection.next = `${outboxUrl}?offset=${offset + 10}`;
// todo: stop at 0
if (offset - 10 > 0) {
collection.prev = `${outboxUrl}?offset=${offset - 10}`;
} else {
Expand Down

0 comments on commit 4370ac4

Please sign in to comment.