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

Words
306
Reading
2 min
Listen
Play
8y

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@profchydon#3371



Posted on Utopian.io - Rewarding Open Source Contributors

STEEMASK UPDATE: A decentralized question and answer website built ... | Ecency