Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #21 from Flamov/dev
Browse files Browse the repository at this point in the history
Updating to v2.0
  • Loading branch information
Flamov authored Jul 13, 2017
2 parents ee7117b + 3dbfae5 commit c01e4b9
Show file tree
Hide file tree
Showing 202 changed files with 22,880 additions and 6,255 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* text=auto
*.css linguist-vendored
*.scss linguist-vendored
*.js linguist-vendored
CHANGELOG.md export-ignore
37 changes: 16 additions & 21 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
# Binary Files
*.mp3
*.m4a

# Mac Files
.DS_Store

# SASS/SCSS
.sass-cache
.sass-cache/*

# NPM/Node
node_modules/

# Builds from gulp tasks
public-build/
builds/
.build

# PHP MySQL information
public/lib/config.php
/node_modules
/public/hot
/public/storage
/public/css
/public/fonts
/public/js
/public/images
/public/favicon.ico
/storage/*.key
/vendor
/.idea
/.vagrant
Homestead.json
Homestead.yaml
npm-debug.log
.env
77 changes: 20 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,39 @@
# Steamchat Website Source Files

Here you can find the source files for the Steamchat (formerly "Steamcast") website. If you're interested in web development and design you can clone this repository to learn, play or modify with at your leisure. Do anything you want with it, no attribution required!
[![codebeat badge](https://codebeat.co/badges/714c3b1a-bcb9-4e10-8644-b875be03ec89)](https://codebeat.co/projects/github-com-flamov-steamchat-website-master) [![Code Climate](https://codeclimate.com/github/Flamov/steamchat-website/badges/gpa.svg)](https://codeclimate.com/github/Flamov/steamchat-website) [![Issue Count](https://codeclimate.com/github/Flamov/steamchat-website/badges/issue_count.svg)](https://codeclimate.com/github/Flamov/steamchat-website)

The website included in this repository is the version from 2013 onwards. We have updated it from its [original state](https://github.com/Flamov/steamchat-website/tree/c6ec7d23f21fbf421eb74abe7b1a97b9d83ec0c9) to be more sanely coded as well as clean up the original files, add CSS3 support, as well as a bunch of other additions and improvements.
These are the source files for the [Steamchat Podcast website](http://www.thesteamchat.com/).

We have backups of the Steamchat websites from 2009-2012 and are currently fixing them up for release. We will edit this readme once they're released.
### Requirements

## Requirements
The website uses [Laravel](https://www.laravel.com/), which has its own [set of requirements that you can find here](https://laravel.com/docs/5.4/installation#server-requirements). Additionally, CSS is compiled using Sass, and JavaScript is written in a mixture of vanilla JavaScript and Vue.

If you plan on hosting the website in a local environment or otherwise, the following is required:
For more information on how the website is structured, [check out the wiki](https://github.com/Flamov/steamchat-website/wiki).

* PHP 5.4 or greater
* Access to `.htaccess` for Apache or equivalent directory-level configuration
* Must have `RewriteEngine` or equivalent enabled
### Repository Branches

## Installation

1. Set up a web server following the [requirements](#requirements) above
2. Clone this repository or [download the ZIP](https://github.com/Flamov/steamchat-website/archive/master.zip) and place the files in the web server
3. Make sure the [`.htaccess`](.htaccess) file is working as intended ([see below](#intended-htaccess-behaviourconfiguration))

## Things To Note

#### Intended .htaccess Behaviour/Configuration

The intended behaviour is having the server rewrite (*not* redirect) requests to episode pages (e.g. `/episodes/50/`) as `lib/pages/episodePage.php` while passing in two URL parameters:

| Parameter Name | Value(s) |
| Branch Name | Notes |
|---|---|
| *type* | *"episode"*, *"snack"* |
| *number* | integer |

###### Example:
* User requests `episodes/50/`
* Server rewrites as `lib/pages/pageEpisode.php?type=episode&number=50`

###### Notes:
* Be wary of singular and plural requests; there are additional rules in the [.htaccess](.htaccess#L16-L18) file that *redirects* requests with singular notations (`/episode/`) to plural ones (`/episodes/`)
* Also be wary of requests with and without trailing slashes ("/")
* The above rewrite rules also apply to the Specials and About pages (no URL parameters or singular/plural rules required):
* `/specials/` as `/lib/pages/pageSpecials.php`
* `/about/` as `/lib/pages/pageAbout.php`

In addition, when a user requests an episode page with "`/download/`" appended to the end (e.g. `/episodes/50/download/`, both with and without a trailing slash) it will rewrite as `/lib/pages/pageEpisode.php?type=episode&number=50&download`. A value for the `download` URL parameter is not required.
| `master` | Used for deployment of the [production website](http://www.thesteamchat.com/). |
| `dev` | Development branch. |

#### SVG Support
### Database Data

The website uses SVGs for its logos and icons instead of bitmaps. Make sure your web server is configured to pass the correct MIME type for SVGs ([more info here](http://www.kaioa.com/node/45)) — this should be enabled with lines 25-26 in the [`.htaccess`](.htaccess#L25-L26) file included in this repository.
You can find an occasionally-updated [MySQL database dump here](https://gist.github.com/Flamov/d0fbca7ec66783027b14b244d086af73). Episode audio files and artwork are hosted elsewhere.

#### Latest Episode Control
### SVG Support

The latest episode to be shown on the homepage and individual episode pages is controlled by the PHP variable `$latestEpisode` (integer) at line 3 in [`episodeData.php`](lib/episodeData.php#L3). This is done instead of automatically retrieving the latest episode from the first index of the episode data file (see below) so we can upload episode artwork and data (and test it) before publishing it publically on the website.
The website makes use of SVG files. Make sure your web server is configured to pass the correct MIME type for SVG files.

#### Episode Data

Episode data is controlled in the [`lib/episodeData.php`](lib/episodeData.php) file. Information on how the arrays are structured can be found in [the comment (lines 5-18) at the start of the file](lib/episodeData.php#L5-L18).

If you plan on further developing with this repository, we *highly* recommend you use a database to retrieve episode data instead of including and referring to a single PHP file with a large associative array. We provided the episode data file included in the repository purely for reference; it's a ~50Kb file that gets requested every time you visit a page on the website and therefore isn't recommended as it could lead to server performance issues.

#### CSS & JavaScript

SASS/SCSS files are used to compile the CSS for the website but knowledge in SASS is not required; we have also included human-readable versions of the CSS.

In addition, JavaScript files are closure-compiled and minified however we have also included human-readable versions as well.

#### Things Not Included In This Repository:
### Things Not Included In This Repository:
* Episode MP3 and M4A files
* Episode XML/RSS feeds
* Promotional pages (e.g. the Portal 2 Launch Party promo page)
* Old episode artwork for episodes 1-99
* Episode artwork
* ~~Backup of the Half-Life 3 beta (removed per Valve's request)~~

## Contributors:
### Contributors:
* [@Flamov](https://www.github.com/Flamov)
* [@chocolatethunder](https://www.github.com/chocolatethunder)

### Credits:
* Some icons used are provided by _feather_: https://www.github.com/colebemis/feather
* RSS feed generation is done with _podcastfeed_: https://www.github.com/torann/podcastfeed
40 changes: 40 additions & 0 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];

/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')
// ->hourly();
}

/**
* Register the Closure based commands for the application.
*
* @return void
*/
protected function commands()
{
require base_path('routes/console.php');
}
}
100 changes: 100 additions & 0 deletions app/Episode.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Episode extends Model
{

// Returns formatted episode title prepended with episode type and number text
// Function parameter will return episode title without the "Episode" text if passed-in as true and episode type is 'episode'
public function getTitle($short) {

$type = $this->type;
$number = $this->number;
$title = $this->title;

if ($type === 'episode') {
$prepend = '#' . $number;
if ($short === false) {
$prepend = 'Episode ' . $prepend;
}
}
else if ($type === 'snack') {
$prepend = 'Snack';
}

return $prepend . ': ' . $title;

}

// Return absolute URL to episode page
public function getURL() {

return route('episode', [
'type' => $this->type,
'number' => $this->number
]);

}

// Returns the episode duration in seconds
public function getDurationSeconds() {

$duration = $this->file_duration;
sscanf($duration, '%d:%d:%d', $hours, $minutes, $seconds);
$duration = ($hours * 3600) + ($minutes * 60);
if ($seconds !== null) {
$duration += $seconds;
}

return $duration;

}

// Returns previous episode (if it exists) by previous ID
public function getPreviousEpisode() {

$type = $this->type;
$number = $this->number - 1;
$previousEpisode = static::where('active', true)
->where('type', $type)
->where('number', $number)
->first();

return $previousEpisode;

}

// Returns next episode (if it exists) by next ID
public function getNextEpisode() {

$type = $this->type;
$number = $this->number + 1;
$nextEpisode = static::where('active', true)
->where('type', $type)
->where('number', $number)
->first();

return $nextEpisode;

}

// Return specific episode data in JSON format
public function getJSONData() {

return response()->json([
'title' => static::getTitle(true),
'release' => date_format(new \DateTime($this->release_date), 'd/m/Y'),
'url' => static::getURL(),
'file' => $this->file_url,
'duration' => static::getDurationSeconds(),
'mask' => $this->mask,
'colour' => $this->colour,
'background' => $this->background
]);

}

}
65 changes: 65 additions & 0 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php

namespace App\Exceptions;

use Exception;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

class Handler extends ExceptionHandler
{
/**
* A list of the exception types that should not be reported.
*
* @var array
*/
protected $dontReport = [
\Illuminate\Auth\AuthenticationException::class,
\Illuminate\Auth\Access\AuthorizationException::class,
\Symfony\Component\HttpKernel\Exception\HttpException::class,
\Illuminate\Database\Eloquent\ModelNotFoundException::class,
\Illuminate\Session\TokenMismatchException::class,
\Illuminate\Validation\ValidationException::class,
];

/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $exception
* @return void
*/
public function report(Exception $exception)
{
parent::report($exception);
}

/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
{
return parent::render($request, $exception);
}

/**
* Convert an authentication exception into an unauthenticated response.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Auth\AuthenticationException $exception
* @return \Illuminate\Http\Response
*/
protected function unauthenticated($request, AuthenticationException $exception)
{
if ($request->expectsJson()) {
return response()->json(['error' => 'Unauthenticated.'], 401);
}

return redirect()->guest(route('login'));
}
}
32 changes: 32 additions & 0 deletions app/Http/Controllers/Auth/ForgotPasswordController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;

class ForgotPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset emails and
| includes a trait which assists in sending these notifications from
| your application to your users. Feel free to explore this trait.
|
*/

use SendsPasswordResetEmails;

/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
}
Loading

0 comments on commit c01e4b9

Please sign in to comment.