Git Product home page Git Product logo

libertysoft3 / saidit Goto Github PK

View Code? Open in Web Editor NEW
228.0 228.0 39.0 66.83 MB

The reddit open source fork powering SaidIt

Home Page: https://saidit.net

License: Other

Shell 0.99% Makefile 0.09% Python 46.92% C 0.28% Thrift 0.02% JavaScript 22.93% HTML 9.57% CSS 0.71% Ruby 0.01% PigLatin 0.19% Java 0.07% M 0.13% MATLAB 8.66% Mathematica 0.02% Less 7.90% SCSS 0.41% Objective-C 0.48% Forth 0.01% Cython 0.54% Dockerfile 0.07%

saidit's People

Contributors

13steinj avatar ajacksified avatar alienth avatar andre-d avatar bboe avatar bsimpson63 avatar chrisst avatar chromakode avatar deimos avatar doriangray avatar dwick avatar jedberg avatar jordanmilne avatar kemitche avatar ketralnis avatar keysersosa avatar kjoconnor avatar libertysoft3 avatar madbook avatar melissacole avatar paradox460 avatar powerlanguage avatar rram avatar scamcast avatar shlurbee avatar spez avatar spladug avatar umbrae avatar xiongchiamiov avatar zeantsoi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

saidit's Issues

Reduce isinstance abuse

c082dba#r33462392

Is instance is used a lot in the codebase.

This suggests that some functions are pseudo-overloaded, or are otherwise being dishonest about what information they require. This is a maintenance nightmare! Can we clean this up?

Migrate to Python 3 et al.

Python 2.7 has until the end of the year before it stops receiving updates.

In order to achieve Python 3 compatibility, we'll also have to migrate several other technologies. The ideal approach is three-fold:

  • Make the tests Python 3 compatible without breaking Python 2 compatibility (or the tests!).
  • Make the code Python 3 compatible whilst ensuring that it continues to pass the tests.
  • Remove Python 2 compatibility once we're happily running on Python 3.

Here's a plan of attack:

  • Realise that we're still on Python 2.
  • Explicitly specify b"" and u"" wherever possible and meaningful without breaking stuff. (e.g. site text and localisation strings are u"", whereas a PNG is b"").
  • Migrate to new-style classes (subclasses of object) everywhere.
  • Gradually add all of the __future__ import statements in Python 2 for Python 3 (i.e. from __future__ import division, absolute_import, print_function, unicode_literals) possible to every Python file (starting with the tests) without breaking things, making sure the meaning of the code is preserved while doing so. (This can be checked by observing the bytecode.)
  • Remove Python 2-specific oddities like iterable.next() with the six module.
  • Create a branch where Pylons is gradually replaced with Pyramid. Frequently merge from master to this branch to prevent merge conflicts.
  • Make 99% sure that the Pyramid branch works perfectly, and doesn't secretly depend on Pylons.
  • Merge the Pyramid branch to master and remove Pylons as a dependency.
  • Thoroughly test Saidit in Python 3 – running all of the tests and also making sure the entire site works perfectly. Make 99.5% sure of this.
  • Take a deep breath.
  • Switch over to Python 3.
  • And exhale, because it all went perfectly because we tested it properly.
  • Remove six from the codebase.
  • Remove six as a dependency.
  • Get rid of redundant and meaningless u""s and class NewStyle(object):s.

Useful resources:

  • 2to3, a script that identifies Python 2-specific syntax and shows what changes are required to make it Python 3-compatible.

Federation

Whether through ActivityPub or another protocol, federating the platform counts as a major step towards longevity or immutability. Ultimately transference to a serverless model such as integrating with IPFS or blockchain, might very well finalize anti-censorship security.

The syntax for a federated sub should go: /s/ + sub + @ + federated instance's domain.

For posterity I shall link two projects which should serve as examples:

Support Github Flavored Markdown

I feel like it would be need if we had GFM.

var x = 5; // Colored Syntax + Fenced code blocks
Foo Bar
Fancy Tables!

I don't know how hard it would be to add support for it. I'll close the issue if it's a total pain in the neck.

Unable to install

Hey there,

I can't install this on my server. Could you please update example.ini and annotate the custom settings you've added? I keep on getting errors when my config is read since your custom settings are missing

Installer: usable install without running 'Install sample data'

Running the sample data installer

$ cd ~/src/reddit
$ reddit-run scripts/inject_test_data.py -c 'inject_test_data()'

is currently the only way you can have an admin user created, automoderator user created, the default_sr created, etc.

Fix is to create a slimmer version of inject_test_data() called something like inject_default_data() that just does the bare minimum, the first 9 lines. Then update the README installation instructions to say call one of these. Or split the function entirely and calling inject_test_data() after you have already called inject_default_data() is optional.

This is for production paths where people don't want a bunch of sample users and sample posts.

API delete error, something about sticky

If it's subreddit related, it's probably a side effect of the configurable home page. Ensure DynamicSR has the full sticky properties of DefaultSR.

Jun 16 20:59:05 ubuntu reddit-paster: Error - <type 'exceptions.TypeError'>: 'NoneType' object has no attribute '__getitem__'
Jun 16 20:59:05 ubuntu reddit-paster: URL: https://saidit.net/api/del
Jun 16 20:59:05 ubuntu reddit-paster: File '/usr/lib/python2.7/dist-packages/weberror/errormiddleware.py', line 162 in __call__
Jun 16 20:59:05 ubuntu reddit-paster:   app_iter = self.application(environ, sr_checker)
Jun 16 20:59:05 ubuntu reddit-paster: File '/home/reddit/src/reddit/r2/r2/config/middleware.py', line 229 in __call__
Jun 16 20:59:05 ubuntu reddit-paster:   return self.app(environ, start_response)
Jun 16 20:59:05 ubuntu reddit-paster: File '/home/reddit/src/reddit/r2/r2/config/middleware.py', line 287 in __call__
Jun 16 20:59:05 ubuntu reddit-paster:   return self.app(environ, start_response)
Jun 16 20:59:05 ubuntu reddit-paster: File '/home/reddit/src/reddit/r2/r2/config/middleware.py', line 244 in __call__
Jun 16 20:59:05 ubuntu reddit-paster:   return self.app(environ, start_response)
Jun 16 20:59:05 ubuntu reddit-paster: File '/home/reddit/src/reddit/r2/r2/config/middleware.py', line 259 in __call__
Jun 16 20:59:05 ubuntu reddit-paster:   return self.app(environ, start_response)
Jun 16 20:59:05 ubuntu reddit-paster: File '/home/reddit/src/reddit/r2/r2/config/middleware.py', line 380 in __call__
Jun 16 20:59:05 ubuntu reddit-paster:   return self.app(environ, start_response)
Jun 16 20:59:05 ubuntu reddit-paster: File '/home/reddit/src/reddit/r2/r2/config/middleware.py', line 406 in __call__
Jun 16 20:59:05 ubuntu reddit-paster:   return self.app(environ, custom_start_response)
Jun 16 20:59:05 ubuntu reddit-paster: File '/usr/lib/python2.7/dist-packages/routes/middleware.py', line 136 in __call__
Jun 16 20:59:05 ubuntu reddit-paster:   response = self.app(environ, start_response)
Jun 16 20:59:05 ubuntu reddit-paster: File '/usr/lib/python2.7/dist-packages/pylons/wsgiapp.py', line 103 in __call__
Jun 16 20:59:05 ubuntu reddit-paster:   response = self.dispatch(controller, environ, start_response)
Jun 16 20:59:05 ubuntu reddit-paster: File '/usr/lib/python2.7/dist-packages/pylons/wsgiapp.py', line 313 in dispatch
Jun 16 20:59:05 ubuntu reddit-paster:   return controller(environ, start_response)
Jun 16 20:59:05 ubuntu reddit-paster: File '/home/reddit/src/reddit/r2/r2/lib/base.py', line 167 in __call__
Jun 16 20:59:05 ubuntu reddit-paster:   return WSGIController.__call__(self, environ, start_response)
Jun 16 20:59:05 ubuntu reddit-paster: File '/usr/lib/python2.7/dist-packages/pylons/controllers/core.py', line 214 in __call__
Jun 16 20:59:05 ubuntu reddit-paster:   response = self._dispatch_call()
Jun 16 20:59:05 ubuntu reddit-paster: File '/usr/lib/python2.7/dist-packages/pylons/controllers/core.py', line 164 in _dispatch_call
Jun 16 20:59:05 ubuntu reddit-paster:   response = self._inspect_call(func)
Jun 16 20:59:05 ubuntu reddit-paster: File '/usr/lib/python2.7/dist-packages/pylons/controllers/core.py', line 107 in _inspect_call
Jun 16 20:59:05 ubuntu reddit-paster:   result = self._perform_call(func, args)
Jun 16 20:59:05 ubuntu reddit-paster: File '/usr/lib/python2.7/dist-packages/pylons/controllers/core.py', line 57 in _perform_call
Jun 16 20:59:05 ubuntu reddit-paster:   return func(**args)
Jun 16 20:59:05 ubuntu reddit-paster: File '/home/reddit/src/reddit/r2/r2/lib/validator/validator.py', line 255 in newfn
Jun 16 20:59:05 ubuntu reddit-paster:   simple_vals, param_vals, *a, **kw)
Jun 16 20:59:05 ubuntu reddit-paster: File '/home/reddit/src/reddit/r2/r2/lib/validator/validator.py', line 280 in noresponse
Jun 16 20:59:05 ubuntu reddit-paster:   self_method(self, *a, **kw)
Jun 16 20:59:05 ubuntu reddit-paster: File '/home/reddit/src/reddit/r2/r2/controllers/api.py', line 1426 in POST_del
Jun 16 20:59:05 ubuntu reddit-paster:   thing.subreddit_slow.remove_sticky(thing)
Jun 16 20:59:05 ubuntu reddit-paster: File '/home/reddit/src/reddit/r2/r2/models/subreddit.py', line 1456 in remove_sticky
Jun 16 20:59:05 ubuntu reddit-paster:   sticky_fullnames = self.sticky_fullnames[:]
Jun 16 20:59:05 ubuntu reddit-paster: TypeError: 'NoneType' object has no attribute '__getitem__'
Jun 16 20:59:05 ubuntu reddit-paster: 
Jun 16 20:59:05 ubuntu reddit-paster: 
Jun 16 20:59:05 ubuntu reddit-paster: CGI Variables
Jun 16 20:59:05 ubuntu reddit-paster: -------------
Jun 16 20:59:05 ubuntu reddit-paster:   CONTENT_TYPE: 'application/x-www-form-urlencoded; charset=UTF-8'
Jun 16 20:59:05 ubuntu reddit-paster:   FULLPATH: '/api/del'
Jun 16 20:59:05 ubuntu reddit-paster:   HTTP_ACCEPT: 'application/json, text/javascript, */*; q=0.01'
Jun 16 20:59:05 ubuntu reddit-paster:   HTTP_ACCEPT_ENCODING: 'gzip'
Jun 16 20:59:05 ubuntu reddit-paster:   HTTP_ACCEPT_LANGUAGE: 'en-US,en;q=0.9'
Jun 16 20:59:05 ubuntu reddit-paster:   HTTP_CDN_LOOP: 'cloudflare'
Jun 16 20:59:05 ubuntu reddit-paster:   HTTP_CF_CONNECTING_IP: 'REDACT'
Jun 16 20:59:05 ubuntu reddit-paster:   HTTP_CF_IPCOUNTRY: 'CA'
Jun 16 20:59:05 ubuntu reddit-paster:   HTTP_CF_RAY: '4e7fb49c09f0cac4-YYZ'
Jun 16 20:59:05 ubuntu reddit-paster:   HTTP_CF_VISITOR: '{"scheme":"https"}'
Jun 16 20:59:05 ubuntu reddit-paster:   HTTP_CONNECTION: 'close'
Jun 16 20:59:05 ubuntu reddit-paster:   HTTP_COOKIE: '__cfduid=dc10589a59bd5a358c84a14d03793c0871542267523; loid=pn8s5E8cP7fgimcVBh; loidcreated=2018-11-15T07%3A38%3A44.124Z; saidit_session=3104%2C2019-03-18T23%3A19%3A11%2C0d0d8c20cebc87b62969cf059c549e8e553f1d4d; secure_session=1; reddit_mobility=m; pc=sg; JasonCarswell_recentclicks2=t5_qze%2Ct5_ocm%2Ct5_i4o%2Ct5_epb%2Ct5_dyg; io=9aijVvR-U_3xKMKmADiJ'
Jun 16 20:59:05 ubuntu reddit-paster:   HTTP_DNT: '1'
Jun 16 20:59:05 ubuntu reddit-paster:   HTTP_HOST: 'saidit.net'
Jun 16 20:59:05 ubuntu reddit-paster:   HTTP_ORIGIN: 'https://saidit.net'
Jun 16 20:59:05 ubuntu reddit-paster:   HTTP_REFERER: 'https://saidit.net/s/Freedom/comments/qzh/in_a_obsolete_state_logic_is_an_enemy_truth_is_a/'
Jun 16 20:59:05 ubuntu reddit-paster:   HTTP_USER_AGENT: 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.38 Safari/537.36'
Jun 16 20:59:05 ubuntu reddit-paster:   HTTP_X_FORWARDED_FOR: '108.162.241.11'
Jun 16 20:59:05 ubuntu reddit-paster:   HTTP_X_FORWARDED_PROTO: 'https'
Jun 16 20:59:05 ubuntu reddit-paster:   HTTP_X_REQUESTED_WITH: 'XMLHttpRequest'
Jun 16 20:59:05 ubuntu reddit-paster:   PATH_INFO: '/api/del'
Jun 16 20:59:05 ubuntu reddit-paster:   REDDIT_NAME: 'REDACT'
Jun 16 20:59:05 ubuntu reddit-paster:   REMOTE_ADDR: '127.0.0.1'
Jun 16 20:59:05 ubuntu reddit-paster:   REQUEST_METHOD: 'POST'
Jun 16 20:59:05 ubuntu reddit-paster:   SERVER_NAME: '0.0.0.0'
Jun 16 20:59:05 ubuntu reddit-paster:   SERVER_PORT: '8001'
Jun 16 20:59:05 ubuntu reddit-paster:   SERVER_PROTOCOL: 'HTTP/1.1'

Can't login through API

Whenever I try to use the API, I get an error saying:

Access to XMLHttpRequest at 'https://saidit.net/api/login/Yhvr' from origin '<local server>' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I'm thinking that you might need to disable Access-Control-Allow-Origin. Maybe not, I barely understand this HTTP stuff.

Python 2.x: ASCII

After installation, an error appears:

UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-5: ordinal not in range(128)

On your server accepts this encoding. I wonder where to dig?

Improve on-site debug information.

As the site's code isn't a secret, I can't think of any issue with providing tracebacks and such on the site proper. This does not mean that there isn't an issue with doing so.

This is a proposal for improving the "this broke" error page to display debug information (where possible) in addition to a funny picture, which will expedite the fixing of bugs.

Port to Ubuntu 18 LTS

Major components of task:

  • update install script
  • dependency hell, old fbthrift required for baseplate and the activity service is brutal
  • find an alternative for upstart events: reddit-start, reddit-stop, reddit-flush. Using systemd service depedencies
  • re-implement upstart services as systemd services
  • much testing
  • create new issue to support classic sysvinit for devuian, etc. with a parameter to the install script

Add title text from links to client-side image expandos.

This is tricky with the current code. If the elements were being created using ordinary DOM commands, it would be simple:

var a = thingy can't remember this
var img = document.createElement("img");
img.src = a.href;
if (a.title) img.title = a.title;
thingy can't remember.appendChild(img);

As the jQuery directly inserts HTML, though, this is slightly more tricky. Which approach should be taken?

  • String manipulation; or
  • DOM manipulation?

Not allowing the sub to appear on /s/all makes it not appear on /subs/mine/moderator

Having the "allow this sub to be included in /s/all as well as the default and trending lists" checkbox in sub settings unticked makes the sub not appear in /subs/mine/moderator.

The Slide client uses this endpoint (specifically https://oauth.saidit.net/subs/mine/moderator.json?limit=100) to determine whether to show moderation actions on posts and comments, and they never showed up for /s/WatchPeopleDie, where this option was turned off. Turning it on makes everything work as expected.

Chat is still dark in light mode

The image

Above is a screenshot of the Saidit website (cropped to show just the chat box and that I am in light mode).

In light mode, the chat box retains its dark theme. The expected behavior is that the chat box switches to a light theme, as does the rest of the site.

I'm running Chrome 73 on Windows 7.

Search for "+++" fails, etc.

Post search:

  • Searching for "+++" fails
  • Return no results or something more user friendly. Ditch the jank!
  • Ideally this string is searchable, for "A+++" in titles

Sub search:

  • search for "news" does not return "upliftingnews"
  • "Ice" and "ice" doesn't find "Ice_Poseidon2"

Chat leaks private sub names

Rather than joining the private sub name as a chat channel, join its md5 or sha1 name checksum. Should be an easy fix.

Upgrade jQuery to 3.x

I don't know of the boundaries to this, but jQuery 2.11 is pretty old. Can we get a new one?

It'll help with development, for those of us who use jQuery, because newer is faster.

Markdown expando clicks should preventDefault

Someone with a browser setting to open new tabs is seeing 'JPG' click open a new tab. Event.preventdefault() in toggleMdExpando() should fix

The href is "JavaScript: null" but I guess that's not enough.

Visual Revamp

This is in reference to the Ask Saidit Thread (I am 0eye)

Link to the banner/icons used in the demo

Here is the CSS:

/*
This code inherents the license from the SaidIt project
https://github.com/libertysoft3/saidit/blob/master/LICENSE
Author: 0eye
*/
#header, .footer-banner{
  background-image:url('http://138.68.219.81/img/saidit/banner.jpg');
  background-attachment:fixed;
  background-size:cover;
  background-position:center;
}
.footer-banner{
  background-position:center bottom;
  min-height:0;
  height:5px;
}
#header-img.default-header{
  height:15rem;
  background-position:98% 10%;
  background-size:200px;
}
.arrow.up{
  background-image: url('http://138.68.219.81/img/saidit/light.png');
}
.arrow.upmod{
  background-image: url('http://138.68.219.81/img/saidit/light-set.png');
}
.arrow.down{
  background-image: url('http://138.68.219.81/img/saidit/fun-alt.png');
}
.arrow.downmod{
  background-image: url('http://138.68.219.81/img/saidit/fun-set-alt.png');
}
.thing .title:visited, .thing.visited .title {
  color:#ff7500;
}
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: #999999; 
}
::-webkit-scrollbar-thumb {
  background: #5A90C5; 
}
::-webkit-scrollbar-thumb:hover {
  background: #ef842d; 
}

Issues pointed out by the community:

  • The top banner is "too big".
  • One person hates scrollbar overrides. (But most people do not customize the scrollbar at an OS level. )
  • Orange color for visited links might need to change. (I took this color from the 'new message' icon, should it match the color of the highlighted tab?)
  • Need Day theme icons. (Basically inverted night icons)

Other potential issues:

  • Icons need to be recreated from scratch to avoid potential licensing issues.

Moving forward:

At this point I think I'm looking for more feedback from the dev team on the above points. I'm willing to try the PR myself but I don't have any knowledge of the back-end code. How hard is it to set up a development environment? From what I've heard its a PITA.

404 From official url

Either remove the API usage guidelines, or fix the 404.

preferences -> apps -> are you a developer? create an app... -> read the API usage guidelines

Add expando support for documents

Maybe I'm crazy, and this is going too far. But I think we can get at least 5% of the stuff on this list to display on Saidit.

However, for full compatibility, many of these each need their own hacks. PDF should be an <embed> tag in an <object> tag _or_ an <iframe>`; maybe there's a JavaScript feature detection method for when to use each? We'll also need a MIME-type table, with fallbacks for different browsers (which support / mandate different MIME-types) – making sure the default "unknown" option is always the correct, canonical, official MIME-type to ensure maximum future-compatibility.

My head hurts just thinking about the logistics of this. I think we just need:

  • A framework that allows us to add new "document" types fairly easily, without making spaghetti code.
  • Support for PDFs.
  • Support for everything else that works on most browsers, gradually.

Sound good?

Orphaned RabbitMQ messages squatting on RAM

Some RabbitMQ messages are not being processed! After ~2 years in production, some serious memory is being wasted on:

$ sudo rabbitmqctl list_queues
cloudsearch_changes	244741
event_collector	9388043

Event collector messages are likely the sub traffic stats/reddit pixel data that has never worked...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.