Skip to content

Commit b30ec7e

Browse files
committed
readme
1 parent f834e3b commit b30ec7e

File tree

3 files changed

+38
-46
lines changed

3 files changed

+38
-46
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Nothing here (yet)
1+
Use the software wherever and however you like, you are free to modify it, just don't claim you are the original author. Don't use this program anywhere it can put human lives in danger or cause other damage. The developer is in no way responsible for any consequences, be it account suspension due to use of the API or if there is any reddit or other platform ToS violation.

README.md

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,12 @@ In late march 2023 the mobile web interface got removed by reddit staff.
2121
None of them are like the old ``.compact`` interface. Most lack old browser compatability, some are 'privacy-oriented' which means you cannot log into your reddit account.
2222

2323
## What it's not?
24-
It's not a privacy-focused client. If it provides any additional privacy/security (or so you believe) then congrats, go celebrate & rejoice, however this is unintentional and not something to rely on. And neither is it a full scale reddit client utilizing all features exposed by the official API. It is and likely will remain only a subset of what the official front-end provides, much like the `i.reddit.com` used to be (it had not the edit post feature, posting was limited, no moderation etc). If we can achieve same feature coverage this will exceed my expectations by far. See the roadmap below for detail.
24+
It's not a privacy-focused client or a reddit automation software.
2525

26-
### Why won't you add dynamic user account switching
27-
Because I believe this could open the door for multi accounting, automation and other stuff reddit might get upset about. Yes reddit allows alts, you can use them as well by editing configs. This decision is final as of right now, I am not taking it because I am all that invested into reddit cleanliness or following ToS, I just don't want to contribute to any shady activity, which will ultimately lead to reddit becoming more strict. If you want an automated solution for upvoting, spamming, pharming accounts, go develop one or buy it off the market, plenty of them available. I want reddit to stay as relaxed as it is.
28-
29-
### Why not an in-browser client?
30-
I thought about it but there are several obstacles. One of the most ambitious goals I have so far is making this app a drop-in replacement of `i.reddit.com` through the use of `.hosts` file. I have a freaking number of bookmarks pointing to `i.reddit.com` pages, would be great to revive them.
26+
## Is pasting my login/password safe
27+
Short answer: yes. CompactBro is fully open-source and contains no backdoors. It is generally safe, but I am not responsible for 3rd party libraries and also cannot guarantee your account won't die because of API use (even though the API is public, most websites do not like when you use anything but the official web/mobile client). If your account poses great value I wouldn't advice to risk it.
3128

3229
## How to install
33-
Work in progress!
34-
3530
First, download binary for your operating system from the releases page. Alternatively, clone this repo and build it (you need `git` and functional go >= 1.20.3 installation):
3631
```bash
3732
git clone https://github.com/rdtmaster/compactbro
@@ -42,6 +37,7 @@ go build
4237
chmod +x compactbro && ./compactbro #on *nix
4338
compactbro.exe #on windows
4439
```
40+
4541
## Configuration
4642
- Login to reddit and head over to **preferences** => **apps**, create a new APP. The name could be any (e.g. `compactbro`), type should be `script` and other fields are optional. Note down App ID and secret.
4743
- create config file `compactbro.toml` in your `<default-config-directory>\compactbro` (if you are unsure of the location, launch the software and it will print the path in use, create the file there)
@@ -77,18 +73,14 @@ Password = "<password>"
7773
Replace values in `<...>` with credentials of your choice; be advised these are basic auth credentials you will use to access the app, they have nothing to do with username/password you use to log into your reddit account, therefore these do not have to match, even though they can if so you choose.
7874

7975
### HTTPS
80-
Today majority of websites and apps are overly secure, with HTTPS enforced everywhere. Most resources in fact do not need it. There's nothing wrong about using plain HTTP in most scenarios. Any half sain person understands that if you just want to read the news or even sh1tpost on reddit it should not involve cryptography (which introduces great overhead and a big number of errors). Well, at least not by default. Think twice prior to enabling HTTPS, chances are you don't need it.
81-
However, if you transmit any data without HTTPS **in theory** it could be intercepted. So in a nutshell, if you use compactbro server-side and you live in a free/democratic country, there's not much to worry about. Yet in case you are concerned about government surveillance or are just a little bit paranoid, there's an option to use HTTPS built into Compactbro. It could come handy if you want compactbro to become a drop-in replacement for `i.reddit.com`. Below are the steps to achieve this. The manual is (work-in-progress), it covers only Windows+Firefox setup but it should work basically anywhere with little changes.
76+
If you require traffic between compactbro instance and your browser to be encrypted there's an option to use HTTPS. Usually you don't need it if you run the program locally.
8277

8378
To generate keys, install OpenSSL (there are binaries available for most platforms, refer to their site for more info) and generate SSL certs:
8479
```shell
8580
cd <path-to-compactbro>/certs
86-
8781
openssl ecparam -genkey -name prime256v1 -out key.pem
88-
89-
openssl req -new -sha1 -key key.pem -out csr.csr -subj "/CN=i.reddit.com" -addext "subjectAltName=DNS:localhost,DNS:localhost,IP:127.0.0.1"
90-
91-
openssl req -x509 -sha1 -days 365 -key key.pem -in csr.csr -out certificate.pem
82+
openssl req -new -sha1 -key key.pem -out csr.csr -subj "/CN=localhost" -addext "subjectAltName=DNS:localhost,DNS:localhost,IP:127.0.0.1"
83+
openssl req -x509 -sha1 -days 3650 -key key.pem -in csr.csr -out certificate.pem
9284
```
9385
This will generate self-signed SSL certificate, which you have to import to your browser as a trusted root CA (for firefox: `settings` => `advanced` => `certificates` => `import`).
9486

@@ -110,10 +102,7 @@ You can use your own domain as well.
110102
- [x] View Posts+comments
111103
- [x] Edit posts
112104
- [x] Edit comments
113-
- [ ] Handle more comments (partially complete)
114105
- [x] Comment under post and reply to comments
115-
- [ ] Delete comment
116-
- [ ] Delete post
117106
- [x] Infinite scrolling subreddit, DMs and user overview page
118107
- [x] Check inbox and display orange icon, add config option to turn it on/off
119108
- [x] View messages (DMs, comment replies, post replies, username mentions, sent)
@@ -123,7 +112,10 @@ You can use your own domain as well.
123112
- [x] User attrs (submitter, mod, admin)
124113
- [x] Image/video thumbnails
125114
- [x] Mark NSFW, spoiler
126-
- [ ] Create good readme (partially complete)
115+
- [ ] Handle more comments (partially complete)
116+
- [ ] GIFs display
117+
- [ ] Delete comment
118+
- [ ] Delete post
127119

128120
## Roadmap for future versions
129121
- [ ] Full support for DM messages
@@ -138,10 +130,10 @@ You can use your own domain as well.
138130

139131
## Versioning policy
140132
It'll be nice if v1 can ever see the light and even nicer if something beyond that gets released.
141-
Minor versions are subject for eventual delition from the releases section, except the latest one. At the moment v1 is the only major version planned, its goal in a nutshell: "*release something that compiles and lets you browse and comment*". New major version should be released once something notable happens, minor versions are released whenever I want to see if it still works.
133+
New versions are released on every change pushed to the repo, in general you should download the latest version.
142134

143135
## Compatability and intentional decisions
144136
1. Javascript (e.g. frontend) has been completely re-written without use of `jQuery` library. Adopting reddit's codebase would be even harder then coding everything from scratch. Initial plan was to leave HTML and CSS untouched, but it was impossible
145-
2. Compactbro web interface supports Firefox 47.0 and server supports Windows 7x32. Effort should be made to try and support older versions of Firefox. At no point should Compactbro ever drop Windows 7 (incl.32 bit) support or bump minimum supported browser version. If adding any new feature requires to raise those minimum system requirements, that feature should be forgotten.
137+
2. Compactbro web interface supports Firefox 47.0 and server supports Windows 7x32. Effort should be made to try and support older versions of Firefox. At no point should Compactbro ever drop Windows 7 (incl.32 bit) support or bump minimum supported browser version. If adding any new feature requires to raise those minimum system requirements, that feature should be forgotten. Note: the last version of Go officially supporting Win7 is `go1.20.14` so it must be used to compile CompactBro.
146138
3. Compactbro assumes you are over 18 and are willing to view NSFW and spoiler content. By using this software you confirm you reached that age and have no issue with adult materials.
147-
4. Compactbro uses the `amber` engine. It turned out to be pretty backward and limited in terms of functionality, most notably it has no support for recursive mixins. That said, I enjoyed using this engine, it makes creating templates very fast, probably as rapid as it could be. Making page templates still eight around 70% of the time spent to develop this software, with any other engine I doubt I can ever finish it.
139+
4. CompactBro uses the `amber` engine. It turned out to be pretty backward and limited in terms of functionality, most notably it has no support for recursive mixins. That said, I enjoyed using this engine, it makes creating templates very fast, probably as rapid as it could be. Making page templates still eight around 70% of the time spent to develop this software, with any other engine I doubt I can ever finish it.

static/js.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ function hide(elem){
2323
function show(elem){
2424
elem.classList.remove('hidden');
2525
}
26+
27+
function isHidden(elem){
28+
return elem.classList.contains('hidden');
29+
}
30+
31+
function isShown(elem){
32+
return !isHidden(elem);
33+
}
34+
2635
function togDisplay(elem){
2736
if (elem.classList.contains('hidden')) {
2837
show(elem);
@@ -137,24 +146,6 @@ function setEvents(thing){
137146
}
138147

139148

140-
141-
//------- Event Listeners -------
142-
143-
function backgroundUnread(){
144-
if (document.getElementById('msgTrigger')){
145-
return;
146-
}
147-
fetch(baseURL+'/checkunread/', {method: 'HEAD', credentials: 'include'}).then(r =>{
148-
if (r.status === 200){
149-
const mail = document.getElementById('mail');
150-
const mailcl = mail.classList;
151-
mail.href='/message/unread/';
152-
mailcl.remove('nohavemail');
153-
mailcl.add('havemail');
154-
}
155-
});
156-
}
157-
158149
function get(url){
159150
return fetch(baseURL+url, {method: 'GET', credentials: 'include'});
160151
}
@@ -172,14 +163,23 @@ function pst(url,json){
172163
});
173164
}
174165

175-
function isHidden(elem){
176-
return elem.classList.contains('hidden');
177-
}
178166

179-
function isShown(elem){
180-
return !isHidden(elem);
167+
function backgroundUnread(){
168+
if (document.getElementById('msgTrigger')){
169+
return;
170+
}
171+
fetch(baseURL+'/checkunread/', {method: 'HEAD', credentials: 'include'}).then(r =>{
172+
if (r.status === 200){
173+
const mail = document.getElementById('mail');
174+
const mailcl = mail.classList;
175+
mail.href='/message/unread/';
176+
mailcl.remove('nohavemail');
177+
mailcl.add('havemail');
178+
}
179+
});
181180
}
182181

182+
183183
function optionsDisplay(id){
184184
togDisplay(document.getElementById(id).getElementsByClassName('options_expando')[0]);
185185
}

0 commit comments

Comments
 (0)