STEEMASK UPDATE: A decentralized question and answer website built on the STEEM Blockchain

in utopian-io •  7 years ago  (edited)

STEEMASK UPDATE: A decentralized question and answer website built on the STEEM Blockchain


What is the project about?

steemasklogo.png

SteemAsk is a question and answer website that is been built to allow users ask both steem and non-steem related question while getting reply from other members of the community. Many steemit users especially newbies need guidance and most times they wish can get access to other members and ask question to help them be successful on steemit. SteemAsk provides the platform for this, and users can also search for questions to get quick answers. SteemAsk is the stackoverflow of the steem blockchain.

How does it work?

SteemAsk works exactly like every other question and answer forum, but on SteemAsk:

  • Users can upvote questions and answers they find really helpful.
  • Users can check payout for their and any other account
  • Users can trade Steem and SBD in the marketplace.

Previous Update

Link to first update

New Features

  • Login via steemconnect:

    For steemAsk to be a trusted site, users need to login via steemconnect so they don't have to provide their key on the website. Users can now login on steemAsk via steemconnect.

  • Check Payout Feature:

    Users can now check expected post payout on steemAsk. This feature helps users keep track of their expected post payout.

How i implemented this

UserRepository.php

<?php

namespace App\Http\Repositories;

class UserRepository
{

  public function steemConnect ()
  {

    session_start();

    if (isset($_GET['access_token']) and isset($_GET['expires_in'])) {

        $_SESSION['code'] = $_GET['access_token'];

    if (!isset($_SESSION['code'])) {

        return false;

    } else {

      $authstr = "authorization: " . $_SESSION['code'];

      $check = curl_init();

      curl_setopt_array($check, array(

            CURLOPT_URL => "https://v2.steemconnect.com/api/me",
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_ENCODING => "",
            CURLOPT_MAXREDIRS => 1,
            CURLOPT_TIMEOUT => 30,
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_CUSTOMREQUEST => "POST",
            CURLOPT_POSTFIELDS => "{}",
            CURLOPT_HTTPHEADER => array(
                $authstr,
                "cache-control: no-cache",
                "content-type: application/json",
            ),

        ));

        $user = curl_exec($check);

        curl_close($check);

        $user = json_decode($user, TRUE);

      }

    }

    return $user;
}

public function getUserBlogData ($username)
{

  $query = urlencode('{"tag":"'.$username.'", "limit": "100"}');
  $url = 'https://api.steemjs.com/get_discussions_by_blog?query='.$query;
  $json= file_get_contents($url);
  $data = json_decode($json,true);
  return $data;

}


}


?>

UsersController.php

<?php

namespace App\Http\Controllers;

use App\Http\Repositories\UserRepository;

use App\Http\Repositories\CoinmarketcapRepository;

use Illuminate\Http\Request;

class UsersController extends Controller
{

    protected $user;

    protected $coinmarketcap;

    public function __construct(UserRepository $user , CoinmarketcapRepository $coinmarketcap)
    {
        $this->coinmarketcap = $coinmarketcap;
        $this->user = $user;
    }

    public function loginViaSteemConnect ()
    {

        $data['user'] = $this->user->steemConnect();

        $data['coinmarketcap'] = $this->coinmarketcap->getAllCoinDetails();

        $_SESSION['username'] = $data['user']['user'];
        $profile = $data['user']['account']['json_metadata'];
        $profile = json_decode($profile, TRUE);

        $_SESSION['about'] = $profile['profile']['about'];
        $_SESSION['location'] = $profile['profile']['location'];
        $_SESSION['website'] = $profile['profile']['website'];
        $_SESSION['avatar'] = "https://steemitimages.com/u/".$data['user']['user']."/avatar";



        return view ('home' , $data);

    }

    public function logout ()
    {

        session_start();
        session_destroy();

        return redirect('/');

    }

    public function payout ()
    {

      if (session_status () == PHP_SESSION_NONE) {
         session_start();
      }

      $username = $_SESSION['username'];

      $data['coinmarketcap'] = $this->coinmarketcap->getAllCoinDetails();
      $data['profile'] = $this->user->getUserBlogData($username);

      return view ('pages.payout' , $data);

    }

}

Commits on github

Roadmap

  • Get all basic functionalities working
  • Release Alpha version for testing
  • Get all other functionalities working
  • Release beta version
  • Continuous maintenance and addition of features for better user experience

How to contribute

You can contact me on discord: @profchydon#3371



Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Thank you for the contribution. It has been approved.

  • You should add .txt files to you .gitignore

Need help? Write a ticket on https://support.utopian.io.
Chat with us on Discord.

[utopian-moderator]

Oh! Thanks for that. Skipped my mind.

Hey @helo, I just gave you a tip for your hard work on moderation. Upvote this comment to support the utopian moderators and increase your future rewards!

Is it hosted anywhere?

Not yet.. As soon as i'm done with the basic functionalities, i will release the beta version

Hey @profchydon! Thank you for the great work you've done!

We're already looking forward to your next contribution!

Fully Decentralized Rewards

We hope you will take the time to share your expertise and knowledge by rating contributions made by others on Utopian.io to help us reward the best contributions together.

Utopian Witness!

Vote for Utopian Witness! We are made of developers, system administrators, entrepreneurs, artists, content creators, thinkers. We embrace every nationality, mindset and belief.

Want to chat? Join us on Discord https://discord.me/utopian-io

This is great work @profchydon, keep doing what you do best.