Git Product home page Git Product logo

shlinked's Introduction

Contributing to Shlinkedin

Hello there, and thanks for contributing to Shlinkedin! This document is largely based off Phoenix and is a work in progress.

Shlinkedin, as you can tell, is young -- there are lots of features to build, bugs to fix, and tests to write. So your help is invaluable!

How to get involved as a technical person

Here are the best ways to contribute, in order of importance:

  • Fix bugs. Let me know in the discord, but also, the best case outcome for me is that you submit a PR fixing that bug, with tests included.
  • Are you a freak and like writing tests or documentation? Shlinkedin is certainly lacking in this department. The more tests the better. The more documentation the better.
  • Want a new feature? Talk to me in the discord about your idea, and if it makes sense, create a PR and build it! It's still the wild west days of Shlinkin', so I'm happy to add some weird stuff.

Once you pick something to contribute, here's how I suggest you go about it:

  1. Join the discord.
  2. Learn some amount of Elixir
  3. Clone ShlinkedIn locally and get it running
  4. Create a pull request
  5. Request to merge, and I'll either approve it and merge to main, or request changes!
  6. Done! Feel free to message me for help at any point along the way.

How to get involved as a non-technical person

Join the discord! This is where the action happens. We are doing this in our spare time and could use a lot of help that isn't writing code.

  • Know a lot about marketing?
  • Are you a decent designer?
  • Have any good ideas whatsoever?

All of the above are very valuable to us right now!

Bug reports

Good bug reports are extremely helpful - thank you! Shlinkedin is quite buggy right now, and I expect it to remain that way as we scale. If you find a bug, the best way to report it is in the bugs channel on our discord. If you want to try fixing it yourself (which is the best outcome for me), create a pull request.

Feature requests

Feature requests (and feedback in general) is very welcome. Please provide as much detail and context as possible. The best place to request a feature is in the features channel on our discord. I'll try and respond and add it to the roadmap if we think it makes sense.

If you want to add a feature yourself (highly encouraged, create a pull request).

Pull requests

Good pull requests - patches, improvements, new features - are a fantastic help. They should remain focused in scope and avoid containing unrelated commits.

IMPORTANT: By submitting a patch, you agree that your work will be licensed under the license used by the project.

If you have any large pull request in mind (e.g. implementing features, refactoring code, etc), please ask first otherwise you risk spending a lot of time working on something that wemight not want to merge into the project.

Please adhere to the coding conventions in the project (indentation, accurate comments, etc.) and don't forget to add your own tests and documentation. When working with git, we recommend the following process in order to craft an excellent pull request:

  1. Fork the project, clone your fork, and configure the remotes:

    # Clone your fork of the repo into the current directory
    git clone https://github.com/<your-username>/shlinked
    # Navigate to the newly cloned directory
    cd shlinked
    # Assign the original repo to a remote called "upstream"
    git remote add upstream https://github.com/cbh123/shlinked
  2. If you cloned a while ago, get the latest changes from upstream, and update your fork:

    git checkout main
    git pull upstream main
    git push
  3. Create a new topic branch (off of main) to contain your feature, change, or fix.

    IMPORTANT: Making changes in main is discouraged. You should always keep your local main in sync with upstream main and make your changes in topic branches.

    git checkout -b <topic-branch-name>
  4. Commit your changes in logical chunks. Keep your commit messages organized, with a short description in the first line and more detailed information on the following lines. Feel free to use Git's interactive rebase feature to tidy up your commits before making them public.

  5. Make sure all the tests are still passing.

    mix test
  6. Push your topic branch up to your fork:

    git push origin <topic-branch-name>
  7. Open a Pull Request with a clear title and description.

  8. If you haven't updated your pull request for a while, you should consider rebasing on master and resolving any conflicts.

Thank you for your contributions!

How to Run Shlinkedin Locally

To start your Phoenix server:

  • Unlock, update, and install dependencies with mix deps.unlock --all; mix deps.update --all; mix deps.get
  • Set up a local Postgres instance, you can download a client here
    • Open Postgres.app and start the server, the rest is handled by Phoneix
  • Create and migrate your database with mix ecto.setup. (You may need to first create a postgres user with the credentials listed in ./config/dev.exs — see this page for more info.)
  • cd assets and install Node.js dependencies with npm install or yarn install
  • Return to root directory and start Phoenix endpoint with mix phx.server

Now you can visit localhost:4000 from your browser.

Other things you may want to do locally

Become an admin:

  • First, create a user account.
  • Using Postgres, you can do a query like the following:
    • UPDATE profiles SET admin = true WHERE id = 1;
  • You can now access localhost:4000/admin

Enable GIPHY Integration:

  • Visit this page to Request a GIPHY API key and follow the steps.
  • Stop your Phoenix server (press ctrl+C, a, Enter)
  • Set your GIPHY API key an environment variable:
    • export GIPHY_API_KEY=your_GIPHY_API_key
  • Restart Phoenix with mix phx.server

My Guide to Learning Elixir

I am putting all my thoughts here on how to introduce you to ShlinkedIn code + Elixir / Phoenix. There's a lot of stuff here but do not be discouraged!

Terminology

  • Elixir: self explanatory, elixir language. Docs
  • Phoenix: a web development framework used for writing web apps in elixir. Docs
  • Liveview (or Phoenix Liveview): this is built on top of Phoenix, and allows you to easily write real time, interative pages, without writing javascript. Docs.
  • Tailwind: the css framework I use for everything, and the reason that the HTML looks messy. It's amazing. Docs

Order of operations

  1. Go through the "up and running" steps to install Elixir/Phoenix on the Phoenix docs. These docs are great. Then follow the steps above to run Shlinkedin locally on your computer.
  2. Watch this video on building a twitter clone in 15 min. A mixture of watching this earlier in the year, and seeing tons of hacker news rave reviews is what convinced me to try it. Also, as you'll soon see, I started ShlinkedIn 2.0 using the exact code from this project.
  3. Take a look at the ShlinkedIn repo, and dig around and see what makes sense to you. I think the most overwhelming part here will probably be the way the project is organized—it feels like a ton of folders and esoteric filenames and impossible to understand. The docs have a very helpful page on directory structure. But here is a concrete example of a page that you can check out and might make sense to you already: go to lib/shlinkedin_web/live/post_live/index.ex. On line 15 you can see the following line:
        {:ok,
         socket
         |> assign(posts: list_posts())
         |> assign(random_profiles: Shlinkedin.Accounts.get_random_profiles(5))
         |> assign(like_map: Timeline.like_map()), temporary_assigns: [posts: []]}
    
    Note how we're assigning to the socket posts as list_posts(). And random_profiles as Shlinkedin.Accounts.get_random_profiles(5). Then, if you navigate to lib/shlinkedin_web/live/post_live/index.html.leex you can see the html for how everything is displayed. Fun! One thing to note here, is that the html has a crazy number of class attributes. This may look very messy and ugly to you, but it's actually by design—I'll get to this later but all the CSS is using tailwind, which is all the rage right now and honestly amazing.
  4. For gettings used to Elixir syntax, check out elixir docs. The main things I found weird with elixir are:
    • There isn't a return keyword. Instead, functions just implicitly return stuff. This is pretty weird, but used to it now.
    • pipes which look like |>, and are used for chaining functions together.
    • pattern matching
    • The fact that you don't really use for-loops (instead, it's all just stuff like Enum.map([1, 2, 3], fn x -> x * 2 end)). This is tricky but does make code so much cleaner.
  5. Learning Phoenix. I used a mixture of the docs, and skimming attached book PDF. Don't want to overwhelm you here, because the phoenix docs have pretty much everything you need to know. But the book is still a good resource.
  6. Learning Liveview, the docs are once again great. I also used this free course which helped.
  7. Let me know what questions and comments and thoughts you have! I can try and think of some good starter tasks too.

shlinked's People

Contributors

aolesky avatar bingusgates avatar cbh123 avatar dd86k avatar evansoohoo avatar hansanonymous avatar holmesjr avatar jacksondc avatar mralexweber avatar onyinye91-ctrl avatar rudolfman avatar sdb2295 avatar tshamz avatar wswoodruff 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

shlinked's Issues

Initial Ecto create fails with a type error

Changed line 23 to
field(:price, Money.Ecto.Amount.Type, default: 100)
from
field(:price, Money.Ecto.Amount.Type, default: "100")
in defmodule Shlinkedin.Ads.Ad

Otherwise it failed on mix ecto.create.

Perhaps it's something in my own local setup. Not sure. But this did get things compiled. Might prove calamitous to me down the road. We'll see.

Thanks for this entire repo. Quite a good deep dive down the LiveView rabbit hole.

Tictactoe page

@asdfio can you write a static index.html that has a playable tictactoe game? don't use any dependencies (fast)

Add SSO

Hi there,

I'd like to suggest adding SSO because it's not only more convenient but arguably more secure than rolling your own auth.

Bonus points for using LinkedIn as the first supported identity provider :D

Cheers

When you tag someone, it should also search for their name

A lot of people have clever usernames. "That Secretary" is "thatsextretary," and Elizabeth Holmes is just "Theranos."

When I use the @ symbol and start to type in a user, it should also search for their name. I know who "That Secretary" is, but I would have to do a separate lookup to find out about thatsexretary.

Please assign to me or yourself. Might take me a while to get around to it.

Remove unused variables in tests

I have quite a few declared but unused variables in my tests. These variables can be ignored by adding an _ to the beginning of the name.

For example, the error warning: variable "view" is unused (there is a variable with the same name in the context, use the pin operator (^) to match on it or prefix this variable with underscore if it is not meant to be used) test/shlinkedin_web/live/market_live_test.exs:38: ShlinkedinWeb.MarketLiveTest."test create an ad"/1

can be fixed by adding an underscore to view. IE, going from:

    {:ok, view, html} = "blah blah blah"

to

    {:ok, _view, html} = "blah blah blah"

To Recreate

Run mix test. You will see warnings that looks like this:
Screen Shot 2021-08-22 at 10 09 42 PM

TicTacToe page

@asdfio can you write a static index.html that has a playable tictactoe game? don't use any dependencies

Intergalactic Battle Simulator

A strategy game where players command a fleet of spaceships and engage in epic battles against enemy factions. Players must manage resources, research new technologies, and devise tactics to outsmart their opponents and achieve victory in the intergalactic war.

Keep getting spammed with shlink requests by some guy

Apparently he thinks it's funny, the guy is not funny so why should i approve? (I treat the time of my profile viewers very seriously).

Would be nice if after hitting "destroy" once or twice he won't be able to make more of these.

error with `seeds.exs` when running `mix ecto.setup`

[debug] QUERY OK db=2.0ms queue=1.5ms idle=168.3ms
INSERT INTO "chat_conversations" ("profile_ids","title","inserted_at","updated_at") VALUES ($1,$2,$3,$4) RETURNING "id" [[3, 4], "Modern Talking", ~N[2021-09-20 17:28:21], ~N[2021-09-20 17:28:21]]
[debug] QUERY ERROR db=7.6ms queue=1.6ms idle=184.8ms
INSERT INTO "chat_conversation_members" ("owner","profile_id","inserted_at","updated_at") VALUES ($1,$2,$3,$4) RETURNING "id" [true, 3, ~N[2021-09-20 17:28:21], ~N[2021-09-20 17:28:21]]
** (Postgrex.Error) ERROR 23502 (not_null_violation) null value in column "conversation_id" of relation "chat_conversation_members" violates not-null constraint

    table: chat_conversation_members
    column: conversation_id

Failing row contains (1, t, null, 3, 2021-09-20 17:28:21, 2021-09-20 17:28:21, null).
    (ecto_sql 3.7.0) lib/ecto/adapters/sql.ex:756: Ecto.Adapters.SQL.raise_sql_call_error/1
    (ecto 3.7.1) lib/ecto/repo/schema.ex:744: Ecto.Repo.Schema.apply/4
    (ecto 3.7.1) lib/ecto/repo/schema.ex:367: anonymous fn/15 in Ecto.Repo.Schema.do_insert/4
    priv/repo/seeds.exs:20: (file)

Per suggestion from @cbh123, I commented out the offending lines in seeds.exs, and that did seem to work. I was then able to run mix ecto.drop and mix ecto.setup successfully.

Wanted to post this here for posterity and discussion of how to fix the issue!

Kerbal Space Program

"Kerbal Space Program" (KSP) is a space flight simulation game developed by Squad. In the game, players take control of a space program operated by the fictional alien race known as Kerbals. Players can design and build rockets, spaceplanes, and other spacecraft, and then launch them into space to complete various missions, such as reaching orbit, landing on other celestial bodies, and conducting scientific experiments.

Relicense under the AGPL

the project is licensed under the GPL but because it runs on the server it can still be "stolen" and used as closed source so i suggest re-licensing it under the AGPL.

See the FSF page and wikipedia for details, but basically with the GPL someone can take your code , add a lot of code to it and because he is not distributing the software he will not release the changes (it is no longer reciprocal), then the proprietary competitor can become better then the open source version and attract all the users to him (possibly using more aggressive monetization) , with the AGPL he has to release the changes.

hashtag button on content generator doesn't add spaces

If you click the hashtag button on the content-generator it will append "#blah #blah" to the content-field, as expected.

Press it a second time and it will add more tags "#blah #blah", however it doesn't add any space before the addition - with the end result of:

#blah #blah#blah #blah

That breaks the tags. I guess if the field doesn't end in a newline/whitespace a character should be injected prior to the (new) tag(s).

Performance/Analytics

Now that the site has been running in production for a few months, are you able to share any details on how it has been performing on day to day basis (ie request throughout, requests/day, db utilization, etc)? I ask because I would like to understand the kind of server or infrastructure the site is running on. From my personal browsing experience, the performance seems a bit sluggish when navigating between various routes. Without knowing the details of the hardware stack, it’s hard to attribute this behavior to a specific entity (ie module, function, db etc). I apologize in advance if this request is not supposed to be under issues. If I need to post it elsewhere, please advsie and go ahead and close the issue. Thank you for an amazing project🙏!

ShlinkMail z-index bug

The ShlinkMail header, which shows the name of the person I'm ShlinkMailing with, is below the profile picture icons that accompany chat messages. Those profile pictures are visible on top of the header:

image

Expected behavior: pictures disappear behind the header.

Add support for ActivityPub

This is admittedly a very big ask.

ActivityPub is the protocol that underpins federation in software like Mastodon, Misskey, Firefish, Pleroma, Akkoma, and others.

gitignore .elixir_ls

.elixir_ls contains a lot of compiled BEAM files along with other metadata for the LSP to work. I don't think putting compiled files on the repo is a good idea

TicTacToe Page

@asdfio can you write a static index.html that has a playable tictactoe game? don't use any dependencies!

Bug: Postgrex crash in home live test

Overview

In the test clap headline from someone else test case in HomeLiveTest, line 292 where we load another profile fails with a postgrex crash.

This is the line that causes the error, which should be a routine load profile function:

other_profile = Shlinkedin.Profiles.get_profile_by_profile_id(other_profile.id)

And this is the error:

21:52:04.350 [error] Postgrex.Protocol (#PID<0.441.0>) disconnected: ** (DBConnection.ConnectionError) owner #PID<0.487.0> exited

To recreate

  • Run mix test test/shlinkedin_web/live/home_live_test.exs:263
  • Then comment out everything below line 291, starting where we load other_profile = Shlinkedin.Profiles.get_profile_by_profile_id(other_profile.id)
  • Re-run the test and there is no Postgrex error

Other notes

Feature Request: Keyword Muting

As a user of the social network, I would like to have the ability to mute specific keywords or phrases from appearing in my feed. This feature would allow users to have more control over the content they see and help them avoid topics they may find distressing or uninteresting.

The implementation could include an option in the user settings where users can add or remove keywords/phrases to their mute list. Any posts containing the muted keywords/phrases would then be automatically hidden from the user's feed.

This feature would enhance the user experience by providing a more personalized and curated feed based on individual preferences.

Oh btw, this was written by AI.

Closing Remark: And so, dear issue, we bid thee adieu, with keywords to mute and much more to do. Though closed, thy legacy shan't be in vain, for in our codebase, thou shalt remain.

Add "delete account" button

Add a button on your profile settings that deletes you profile/user/ all profile related info so that the process is not manual.

ShlinkMail text entry bug

When I type a ShlinkMail message and hit "enter," the message gets sent but not removed from the textbox.

Expected behavior: textbox resets to empty. This happens correctly if I click the send button (mailbox icon).

Firefox 94.0.1 on MacOS 10.14.6

Our lighthouse score is terrible.

Screen Shot 2021-09-07 at 12 09 57 PM

Lots of low hanging fruit to make it better. To recreate, in chrome you can open the develop console and then click the lighthouse tab.

Elite Dangerous

Elite Dangerous is a space exploration and trading simulator developed by Frontier Developments. The game is set in a realistic, open-world galaxy based on the Milky Way and features a massively multiplayer online environment. Players can explore the galaxy, trade goods, mine resources, engage in combat, and participate in various missions. The game is known for its stunning visuals and complex gameplay mechanics.

Elite Dangerous

"Elite Dangerous" is a space exploration and trading simulator developed by Frontier Developments. The game is set in a realistic, open-world galaxy based on the Milky Way and features a massively multiplayer online environment. Players can explore the galaxy, trade goods, mine resources, engage in combat, and participate in various missions. The game is known for its stunning visuals and complex gameplay mechanics.

Permalink

A feature to generate permalinks like Twitter's share button would be very useful.

Space Exploration Game

A game where players explore the vastness of space, discover new planets, and interact with alien species. The goal is to uncover the mysteries of the universe and make important decisions that will shape the future of the galaxy.

Kerbal Space Program

Kerbal Space Program (KSP) is a space flight simulation game developed by Squad. In the game, players take control of a space program operated by the fictional alien race known as Kerbals. Players can design and build rockets, spaceplanes, and other spacecraft, and then launch them into space to complete various missions, such as reaching orbit, landing on other celestial bodies, and conducting scientific experiments.

Cosmic Colony Builder

A simulation game where players establish and manage a colony on a distant planet. Players must overcome environmental challenges, ensure the well-being of the colonists, and expand their settlement while dealing with external threats and diplomatic relations with other colonies.

No Man's Sky

"No Man's Sky" is an open-world exploration and survival game developed by Hello Games. The game is set in a procedurally generated universe with over 18 quintillion planets, each with its own unique flora, fauna, and resources. Players can explore planets, gather resources, build bases, trade with alien races, and engage in space combat. The game has received several major updates since its initial release, adding new features and improving the overall experience.

Refresh bug

Problem

Pages on ShlinkedIn will occasionally refresh. This is really annoying if you're on a form page because all your text will be deleted.

Other things to note:

  • I haven't been able to reproduce locally
  • This has been happening basically since ShlinkedIn was started (jan 2021).
  • the problem doesn't seem to be memory or activity. Watching the server logs doesn't show any swap memory being used, and the bug seems to happen regardless of how active ShlinkedIn is at the time (this could be wrong though)
  • I've noticed this message in the logs when the refresh happens:
Your app is failing health checks, which means it isn't listening on port 4000 yet. 
 Readiness probe failed: dial tcp 192.168.203.252:4000: connect: connection refused 
 Attempting to start 'shlinkedin' on host 'b'shlinkedin-8556f447b5-l9g5x'' 
 Attempting health checks on port 4000 
 web.1 | started with pid 44 
 Your app is failing health checks, which means it isn't listening on port 4000 yet. 
 Readiness probe failed: dial tcp 192.168.203.252:4000: connect: connection refused 

This is a normal, expected message when an app is deployed, and the health checks look normal shortly afterwards.

Theories

  1. @smaugs theory. The issue here is that I think this is how liveview is actually designed to work? shDataProblem-1.pdf
  2. Something going wrong with a broadcast when a new post or comment is made? Or an error that is broadcasted out to all pages? https://github.com/cbh123/shlinked/blob/main/lib/shlinkedin/timeline.ex#L305
  3. ???

Implement putting links in posts.

Lets just say i want to write this is my favorite quote:

“they trust me, dumb f*cks” – mark zuckerberg – CEO and founder of facebook

You might not laugh, and think it’s some ridiculous nonsense.

If also put a link showing it’s true then i think there is a better chance you will laugh.

Some things are funny because they are true or an exgaggeration of the truth, I even think maybe humour is just a mechanism developed by evolution to reward the discovery of unexpected connections .

I think you can use something like an embedded markdown editor to make it easier to implment (something like this ).

It could also be nice adding a bit more information to posts (something like edutainment).

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.