diff --git a/.gitignore b/.gitignore index a835337..efbb269 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ node_modules/* vendor/* public/app.* -config.ini +.apikey [Tt]humbs.db desktop.ini $RECYCLE.BIN/ diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..373dd17 --- /dev/null +++ b/build.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +# delete old files, using find to avoid errors +echo "=> Cleanup" +rm -v ./public/app.js +rm -v ./public/app.css + +# styles +echo +echo "=> LESS" +lessc --verbose ./src/less/app.less ./public/app.css + +# scripts +echo +echo "=> TypeScript" +tsc \ + -p ./src/typescript/tsconfig.json \ + --listFiles \ + --listEmittedFiles diff --git a/config.example.ini b/config.example.ini deleted file mode 100644 index fca056c..0000000 --- a/config.example.ini +++ /dev/null @@ -1,2 +0,0 @@ -api_key = your api key here -endpoint = https://ws.audioscrobbler.com/2.0/ diff --git a/gulpfile.js b/gulpfile.js deleted file mode 100644 index 6bcde5d..0000000 --- a/gulpfile.js +++ /dev/null @@ -1,53 +0,0 @@ -// aliases -var gulp = require('gulp'), - less = require('gulp-less'), - ts = require('gulp-typescript'), - concat = require('gulp-concat'), - jsmin = require('gulp-minify'), - path = require('path'); - -// variables -var destination = './public', - less_sources = './src/less/**/*.less', - less_watch = less_sources, - ts_config = './tsconfig.json', - ts_sources = './src/typescript/**/*.ts', - ts_watch = ts_sources; - -// default task -gulp.task('default', ['less', 'typescript']); - -// watcher -gulp.task('watch', function () { - gulp.watch(less_watch, ['less']); - gulp.watch(ts_watch, ['typescript']); -}); - -// less -gulp.task('less', function () { - return gulp.src(less_sources) - .pipe(less({ - paths: [ - path.join(__dirname, 'less', 'includes') - ], - compress: true - })) - .pipe(concat('app.css')) - .pipe(gulp.dest(destination)); -}); - -// typescript -gulp.task('typescript', function () { - var tsProject = ts.createProject(ts_config); - - return gulp.src(ts_sources) - .pipe(ts(tsProject)) - .pipe(jsmin({ - ext: { - src: '-', - min: '.js' - }, - noSource: true - })) - .pipe(gulp.dest(destination)); -}); diff --git a/package.json b/package.json deleted file mode 100644 index 7faec99..0000000 --- a/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "private": true, - "dependencies": { - "gulp": "^3.9.1", - "gulp-concat": "^2.6.0", - "gulp-less": "^3.0.5", - "gulp-minify": "0.0.11", - "gulp-typescript": "^2.13.0" - } -} diff --git a/public/get.php b/public/get.php index f1af208..9f8b357 100644 --- a/public/get.php +++ b/public/get.php @@ -14,13 +14,13 @@ if (!file_exists('../vendor/autoload.php')) { require_once '../vendor/autoload.php'; -if (!file_exists('../config.ini')) { - die(view(['error' => 'Configuration missing! Make a copy of config.example.ini named config.ini and set your API key.'])); +if (!file_exists('../.apikey')) { + die(view(['error' => 'API key file missing! Create a file called ".apikey" in the root directory and place your last.fm api key in there.'])); } -$config = parse_ini_file('../config.ini'); +$api_key = trim(file_get_contents('../.apikey')); -$auth = new AuthApi('setsession', ['apiKey' => $config['api_key']]); +$auth = new AuthApi('setsession', ['apiKey' => $api_key]); $user = new UserApi($auth); $now = $user->getRecentTracks(['user' => (isset($_GET['u']) ? $_GET['u'] : ''), 'limit' => '1']); diff --git a/public/resources/no-cover.png b/public/resources/no-cover.png index 596814b..fee93ba 100644 Binary files a/public/resources/no-cover.png and b/public/resources/no-cover.png differ diff --git a/src/typescript/tsconfig.json b/src/typescript/tsconfig.json new file mode 100644 index 0000000..62dc844 --- /dev/null +++ b/src/typescript/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "target": "es5", + "noImplicitAny": false, + "removeComments": true, + "outFile": "../../public/app.js" + }, + "filesGlob": [ + "**/*.ts" + ] +} \ No newline at end of file