Update and test twitter endpoints and connections. Prepare java spring server

This commit is contained in:
sigonasr2 2020-07-18 15:39:27 -05:00
parent 8202feb6cb
commit 0785506fad
548 changed files with 74849 additions and 58 deletions

View File

@ -1,22 +1,13 @@
const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = function(app) {
var endpoints = [
"/song/:songname",
"/register",
"/remove",
"/submit",
"/songdiffs",
"/accuracy/:username",
"/recalculatescore/:playid",
"/bestplay/:username/:songname/:difficulty",
"/userdata/:username",
"/playcount/:username/:songname/:difficulty",
"/songpasscount/:username/:songname/:difficulty",
"/songfccount/:username/:songname/:difficulty",
"/rating/:username",
"/users/:orderby/:sortorder",
]
app.use(
"/image",
createProxyMiddleware({
target: 'http://projectdivar.com:4503',
changeOrigin: true,
})
);
app.use(
"/song/:songname",
createProxyMiddleware({

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,2 @@
#Fri Jul 17 18:05:12 CDT 2020
gradle.version=6.4.1

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

22
imgparser/HELP.md Normal file
View File

@ -0,0 +1,22 @@
# Getting Started
### Reference Documentation
For further reference, please consider the following sections:
* [Official Gradle documentation](https://docs.gradle.org)
* [Spring Boot Gradle Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.3.1.RELEASE/gradle-plugin/reference/html/)
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.3.1.RELEASE/gradle-plugin/reference/html/#build-image)
* [Spring Web](https://docs.spring.io/spring-boot/docs/2.3.1.RELEASE/reference/htmlsingle/#boot-features-developing-web-applications)
### Guides
The following guides illustrate how to use some features concretely:
* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/)
* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/)
* [Building REST services with Spring](https://spring.io/guides/tutorials/bookmarks/)
### Additional Links
These additional references should also help you:
* [Gradle Build Scans insights for your project's build](https://scans.gradle.com#gradle)

24
imgparser/build.gradle Normal file
View File

@ -0,0 +1,24 @@
plugins {
id 'org.springframework.boot' version '2.3.1.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'java'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
test {
useJUnitPlatform()
}

View File

@ -0,0 +1 @@
server.port=4503

Binary file not shown.

View File

@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

185
imgparser/gradlew vendored Executable file
View File

@ -0,0 +1,185 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

104
imgparser/gradlew.bat vendored Normal file
View File

@ -0,0 +1,104 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@ -0,0 +1 @@
rootProject.name = 'demo'

View File

@ -0,0 +1,19 @@
package com.example.demo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.HashMap;
@RestController
public class Controller {
@GetMapping("/image")
public HashMap<String,String> helloWorld(@RequestParam("url") String url){
HashMap<String,String> map = new HashMap<>();
map.put("test1",Integer.toString(1));
map.put("test2","Hello World");
return map;
}
}

View File

@ -0,0 +1,14 @@
package com.example.demo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class Controller {
@GetMapping("/")
public String helloWorld() {
return "Hello from Spring!";
}
}

View File

@ -0,0 +1,13 @@
package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}

View File

@ -0,0 +1 @@
server.port=4503

View File

@ -0,0 +1,13 @@
package com.example.demo;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class DemoApplicationTests {
@Test
void contextLoads() {
}
}

View File

@ -135,7 +135,9 @@ CalculateSongScore=(song)=>{
}
}
var score = ((song.cool*100+song.fine*50+song.safe*10+song.sad*5)/((noteCount)/(noteCount/1000)))*scoreMult
if (scoreMult>0) {
score += Math.pow(song.rating,3)/5
}
return Number(score);
}
@ -157,8 +159,8 @@ CalculateRating=(username)=>{
.catch((err)=>{throw new Error(err.message)})*/
return db.query('select id from users where username=$1 limit 1',[username])
.then((data)=>{if(data.rows.length>0){userId=data.rows[0].id;return db.query('select * from songs order by id asc')}else{return 0}})
.then((data)=>{if(data.rows.length>0){songs=data.rows;return Promise.all(data.rows.map((song)=>{return db.query('select * from plays where userId=$1 and songId=$2 order by score desc limit 100',[userId,song.id]).then((data)=>{if (data.rows.length>0){debugScoreList+=song.name+"\n"; songs[song.id-1].score=data.rows.reduce((sum,play,i)=>{debugScoreList+=" "+(play.score)+" -> "+(play.score*Math.pow(0.8,i))+"\n";/*console.log("Play score:"+play.score+". Sum:"+sum);*/return sum+play.score*Math.pow(0.8,i);},0);debugScoreList+=" "+songs[song.id-1].score+"\n";}})}))}})
.then(()=>{return songs.sort((a,b)=>{var scorea=(a.score)?a.score:0;var scoreb=(b.score)?b.score:0;return (scorea>scoreb)?-1:1;}).reduce((sum,song,i)=>{if(song.score){debugScoreList+=song.name+": "+song.score+" -> "+(song.score*Math.pow(0.8,i))+"\n";return sum+song.score*Math.pow(0.8,i)}else{return sum}},0);})
.then((data)=>{if(data.rows.length>0){songs=data.rows;return Promise.all(data.rows.map((song)=>{return db.query('select * from plays where userId=$1 and songId=$2 order by score desc limit 100',[userId,song.id]).then((data)=>{if (data.rows.length>0){debugScoreList+=song.name+"\n"; songs[song.id-1].score=data.rows.reduce((sum,play,i)=>{debugScoreList+=" "+(play.score)+" -> "+(play.score*Math.pow(0.2,i))+"\n";/*console.log("Play score:"+play.score+". Sum:"+sum);*/return sum+play.score*Math.pow(0.2,i);},0);debugScoreList+=" "+songs[song.id-1].score+"\n";}})}))}})
.then(()=>{return songs.sort((a,b)=>{var scorea=(a.score)?a.score:0;var scoreb=(b.score)?b.score:0;return (scorea>scoreb)?-1:1;}).reduce((sum,song,i)=>{if(song.score){debugScoreList+=song.name+": "+song.score+" -> "+(song.score*Math.pow(0.9,i))+"\n";return sum+song.score*Math.pow(0.9,i)}else{return sum}},0);})
.then((data)=>{/*console.log(debugScoreList);*/return data})
}
@ -272,7 +274,7 @@ app.get('/users/:orderby/:sortorder',(req,res)=>{
res.status(400).json("Invalid query!")
}
})
/*
app.get('/twitter/mentions', function(req, res) {
if (req.query.data) {
console.log(req.query.data)
@ -282,39 +284,46 @@ app.get('/twitter/mentions', function(req, res) {
}
})
axios.get('https://api.twitter.com/1.1/search/tweets.json?q=@divarbot', {
const pixels = require("get-pixels");
*/
var process_images = []
function Process(data){
for (var i in data.data.statuses) {
var tweet = data.data.statuses[i]
if (tweet.source && tweet.source.includes("Nintendo Switch Share")) {
if (tweet.extended_entities) {
//console.log(tweet.extended_entities.media)
for (var j=0;j<tweet.extended_entities.media.length;j++) {
var media = tweet.extended_entities.media[j]
process_images.push(media.media_url)
}
}
}
}
//console.log(process_images)
if (data.data.search_metadata.next_results) {
return axios.get('https://api.twitter.com/1.1/search/tweets.json'+data.data.search_metadata.next_results, {
headers: {
/*BEARER*/ Authorization: 'Bearer '+process.env.TWITTER_BEARER //the token is a variable which holds the token
}})
.then((data)=>{return Process(data)})
}
})
/*
const crypto = require('crypto')
function ChallengeCRC(crc_token, consumer_secret) {
hmac = crypto.createHmac('sha256', consumer_secret).update(crc_token).digest('base64')
return hmac
return "Done!";
}
app.get('/twitter/mentions', function(req, res) {
var crc_token = req.query.crc_token
if (crc_token) {
var hash = ChallengeCRC(crc_token, process.env.TWITTER_CONSUMER_SECRET)
res.status(200);
res.send({
res_token: 'sha256=' + hash
})
} else {
res.status(400);
res.send('Error: crc_token missing from req.')
/*
axios.get('https://api.twitter.com/1.1/search/tweets.json?q=@divarbot', {
headers: {
Authorization: 'Bearer '+process.env.TWITTER_BEARER //the token is a variable which holds the token
}
})
console.log("Setting up webhook...")
axios.post("https://api.twitter.com/1.1/account_activity/all/mentions/webhooks.json?url=http://projectdivar.com/twitter/mentions")
*/
.then((data)=>{
//console.log(data.data.statuses)
//console.log(data.data)
return Process(data);
})
.then((data)=>{process_images.forEach((image)=>{console.log(image)})})*/

21
server/node_modules/arr-flatten/LICENSE generated vendored Executable file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014-2017, Jon Schlinkert.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

86
server/node_modules/arr-flatten/README.md generated vendored Executable file
View File

@ -0,0 +1,86 @@
# arr-flatten [![NPM version](https://img.shields.io/npm/v/arr-flatten.svg?style=flat)](https://www.npmjs.com/package/arr-flatten) [![NPM monthly downloads](https://img.shields.io/npm/dm/arr-flatten.svg?style=flat)](https://npmjs.org/package/arr-flatten) [![NPM total downloads](https://img.shields.io/npm/dt/arr-flatten.svg?style=flat)](https://npmjs.org/package/arr-flatten) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/arr-flatten.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/arr-flatten) [![Windows Build Status](https://img.shields.io/appveyor/ci/jonschlinkert/arr-flatten.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/jonschlinkert/arr-flatten)
> Recursively flatten an array or arrays.
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save arr-flatten
```
## Install
Install with [bower](https://bower.io/)
```sh
$ bower install arr-flatten --save
```
## Usage
```js
var flatten = require('arr-flatten');
flatten(['a', ['b', ['c']], 'd', ['e']]);
//=> ['a', 'b', 'c', 'd', 'e']
```
## Why another flatten utility?
I wanted the fastest implementation I could find, with implementation choices that should work for 95% of use cases, but no cruft to cover the other 5%.
## About
### Related projects
* [arr-filter](https://www.npmjs.com/package/arr-filter): Faster alternative to javascript's native filter method. | [homepage](https://github.com/jonschlinkert/arr-filter "Faster alternative to javascript's native filter method.")
* [arr-union](https://www.npmjs.com/package/arr-union): Combines a list of arrays, returning a single array with unique values, using strict equality… [more](https://github.com/jonschlinkert/arr-union) | [homepage](https://github.com/jonschlinkert/arr-union "Combines a list of arrays, returning a single array with unique values, using strict equality for comparisons.")
* [array-each](https://www.npmjs.com/package/array-each): Loop over each item in an array and call the given function on every element. | [homepage](https://github.com/jonschlinkert/array-each "Loop over each item in an array and call the given function on every element.")
* [array-unique](https://www.npmjs.com/package/array-unique): Remove duplicate values from an array. Fastest ES5 implementation. | [homepage](https://github.com/jonschlinkert/array-unique "Remove duplicate values from an array. Fastest ES5 implementation.")
### Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
### Contributors
| **Commits** | **Contributor** |
| --- | --- |
| 20 | [jonschlinkert](https://github.com/jonschlinkert) |
| 1 | [lukeed](https://github.com/lukeed) |
### Building docs
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
To generate the readme, run the following command:
```sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```
### Running tests
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
```sh
$ npm install && npm test
```
### Author
**Jon Schlinkert**
* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
### License
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).
***
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on July 05, 2017._

22
server/node_modules/arr-flatten/index.js generated vendored Normal file
View File

@ -0,0 +1,22 @@
/*!
* arr-flatten <https://github.com/jonschlinkert/arr-flatten>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
'use strict';
module.exports = function (arr) {
return flat(arr, []);
};
function flat(arr, res) {
var i = 0, cur;
var len = arr.length;
for (; i < len; i++) {
cur = arr[i];
Array.isArray(cur) ? flat(cur, res) : res.push(cur);
}
return res;
}

115
server/node_modules/arr-flatten/package.json generated vendored Normal file
View File

@ -0,0 +1,115 @@
{
"_from": "arr-flatten@^1.1.0",
"_id": "arr-flatten@1.1.0",
"_inBundle": false,
"_integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==",
"_location": "/arr-flatten",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "arr-flatten@^1.1.0",
"name": "arr-flatten",
"escapedName": "arr-flatten",
"rawSpec": "^1.1.0",
"saveSpec": null,
"fetchSpec": "^1.1.0"
},
"_requiredBy": [
"/image-pixels",
"/pxls",
"/to-uint8"
],
"_resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz",
"_shasum": "36048bbff4e7b47e136644316c99669ea5ae91f1",
"_spec": "arr-flatten@^1.1.0",
"_where": "/home/sigonasr2/divar/server/node_modules/image-pixels",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"bugs": {
"url": "https://github.com/jonschlinkert/arr-flatten/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Jon Schlinkert",
"url": "http://twitter.com/jonschlinkert"
},
{
"name": "Luke Edwards",
"url": "https://lukeed.com"
}
],
"deprecated": false,
"description": "Recursively flatten an array or arrays.",
"devDependencies": {
"ansi-bold": "^0.1.1",
"array-flatten": "^2.1.1",
"array-slice": "^1.0.0",
"benchmarked": "^1.0.0",
"compute-flatten": "^1.0.0",
"flatit": "^1.1.1",
"flatten": "^1.0.2",
"flatten-array": "^1.0.0",
"glob": "^7.1.1",
"gulp-format-md": "^0.1.12",
"just-flatten-it": "^1.1.23",
"lodash.flattendeep": "^4.4.0",
"m_flattened": "^1.0.1",
"mocha": "^3.2.0",
"utils-flatten": "^1.0.0",
"write": "^0.3.3"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/jonschlinkert/arr-flatten",
"keywords": [
"arr",
"array",
"elements",
"flat",
"flatten",
"nested",
"recurse",
"recursive",
"recursively"
],
"license": "MIT",
"main": "index.js",
"name": "arr-flatten",
"repository": {
"type": "git",
"url": "git+https://github.com/jonschlinkert/arr-flatten.git"
},
"scripts": {
"test": "mocha"
},
"verb": {
"toc": false,
"layout": "default",
"tasks": [
"readme"
],
"plugins": [
"gulp-format-md"
],
"related": {
"list": [
"arr-filter",
"arr-union",
"array-each",
"array-unique"
]
},
"lint": {
"reflinks": true
}
},
"version": "1.1.0"
}

View File

@ -0,0 +1,44 @@
{
"env": {
"browser": true,
"node": true,
"commonjs": true,
"es6": true
},
"extends": "eslint:recommended",
"rules": {
"strict": 2,
"indent": 0,
"linebreak-style": 0,
"quotes": 0,
"semi": 0,
"no-cond-assign": 1,
"no-constant-condition": 1,
"no-duplicate-case": 1,
"no-empty": 1,
"no-ex-assign": 1,
"no-extra-boolean-cast": 1,
"no-extra-semi": 1,
"no-fallthrough": 1,
"no-func-assign": 1,
"no-global-assign": 1,
"no-implicit-globals": 2,
"no-inner-declarations": ["error", "functions"],
"no-irregular-whitespace": 2,
"no-loop-func": 1,
"no-magic-numbers": ["warn", { "ignore": [1, 0, -1], "ignoreArrayIndexes": true}],
"no-multi-str": 1,
"no-mixed-spaces-and-tabs": 1,
"no-proto": 1,
"no-sequences": 1,
"no-throw-literal": 1,
"no-unmodified-loop-condition": 1,
"no-useless-call": 1,
"no-void": 1,
"no-with": 2,
"wrap-iife": 1,
"no-redeclare": 1,
"no-unused-vars": ["error", { "vars": "all", "args": "none" }],
"no-sparse-arrays": 1
}
}

View File

@ -0,0 +1,5 @@
language: node_js
node_js:
- '6'
- '5'
- '4'

45
server/node_modules/arraybuffer-to-string/browser.js generated vendored Normal file
View File

@ -0,0 +1,45 @@
/**
* @module arraybuffer-to-string/browser
*/
'use strict'
module.exports = function ArrayBufferToString (buffer, encoding) {
if (encoding == null) encoding = 'utf8'
var uint8 = new Uint8Array(buffer)
if (encoding === 'hex') {
var out = ''
for (var i = 0, l = uint8.byteLength; i < l; ++i) {
out += toHex(uint8[i])
}
return out
}
if (encoding === 'base64') {
str = String.fromCharCode.apply(null, uint8)
return btoa(str)
}
if (encoding === 'binary' ||
encoding === 'latin1' ||
!global.TextDecoder) {
str = String.fromCharCode.apply(null, uint8)
return str
}
//TextDecoder way
if (encoding === 'utf16le') encoding = 'utf-16le'
var decoder = new TextDecoder(encoding)
var str = decoder.decode(uint8)
return str
}
function toHex (n) {
if (n < 16) return '0' + n.toString(16)
return n.toString(16)
}

11
server/node_modules/arraybuffer-to-string/index.js generated vendored Normal file
View File

@ -0,0 +1,11 @@
/**
* @module arraybuffer-to-string
*/
'use strict'
module.exports = function ArrayBufferToString (buffer, encoding) {
if (encoding == null) encoding = 'utf8'
return Buffer.from(buffer).toString(encoding)
}

65
server/node_modules/arraybuffer-to-string/package.json generated vendored Normal file
View File

@ -0,0 +1,65 @@
{
"_from": "arraybuffer-to-string@^1.0.2",
"_id": "arraybuffer-to-string@1.0.2",
"_inBundle": false,
"_integrity": "sha512-WbIYlLVmvIAyUBdQRRuyGOJRriOQy9OAsWcyURmsRQp9+g647hdMSS2VFKXbJLVw0daUu06hqwLXm9etVrXI9A==",
"_location": "/arraybuffer-to-string",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "arraybuffer-to-string@^1.0.2",
"name": "arraybuffer-to-string",
"escapedName": "arraybuffer-to-string",
"rawSpec": "^1.0.2",
"saveSpec": null,
"fetchSpec": "^1.0.2"
},
"_requiredBy": [
"/image-pixels"
],
"_resolved": "https://registry.npmjs.org/arraybuffer-to-string/-/arraybuffer-to-string-1.0.2.tgz",
"_shasum": "c373aa7bb0e6844d9a2bc9654c8889a9570a26e2",
"_spec": "arraybuffer-to-string@^1.0.2",
"_where": "/home/sigonasr2/divar/server/node_modules/image-pixels",
"author": {
"name": "Dima Yv",
"email": "dfcreative@gmail.com"
},
"browser": "./browser.js",
"bugs": {
"url": "https://github.com/dfcreative/arraybuffer-to-string/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Convert ArrayBuffer to string",
"devDependencies": {
"buffer-to-arraybuffer": "0.0.4",
"is-browser": "^2.0.1",
"string-to-arraybuffer": "^1.0.0",
"tape": "^4.7.0"
},
"homepage": "https://github.com/dfcreative/arraybuffer-to-string#readme",
"keywords": [
"arraybuffer",
"array-buffer",
"array",
"buffer",
"string",
"base64",
"atob",
"btoa",
"datauri"
],
"license": "MIT",
"main": "index.js",
"name": "arraybuffer-to-string",
"repository": {
"type": "git",
"url": "git+https://github.com/dfcreative/arraybuffer-to-string.git"
},
"scripts": {
"test": "node test.js"
},
"version": "1.0.2"
}

27
server/node_modules/arraybuffer-to-string/readme.md generated vendored Normal file
View File

@ -0,0 +1,27 @@
# arraybuffer-to-string [![unstable](https://img.shields.io/badge/stability-unstable-orange.svg)](http://github.com/badges/stability-badges) [![Build Status](https://img.shields.io/travis/dfcreative/arraybuffer-to-string.svg)](https://travis-ci.org/dfcreative/arraybuffer-to-string)
Convert _ArrayBuffer_ to string with optional encoding.
[![npm install arraybuffer-to-string](https://nodei.co/npm/arraybuffer-to-string.png?mini=true)](https://npmjs.org/package/arraybuffer-to-string/)
```js
var ab2str = require('arraybuffer-to-string')
var uint8 = new Uint8Array([ 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33 ])
ab2str(uint8) // 'Hello World!'
ab2str(uint8, 'base64') // 'SGVsbG8gV29ybGQh'
ab2str(uint8, 'hex') // '48656c6c6f20576f726c6421'
ab2str(uint8, 'iso-8859-2') // 'Hello World!'
```
### var str = arrayBufferToString(buffer, encoding='utf8')
Convert ArrayBuffer/ArrayBufferView/Array `buffer` to string with defined encoding. Available encoding: `utf8`, `binary`, `base64`, `hex`, `ascii`, `latin1`, `ucs2`, `utf16` and [many others](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/encoding).
Note: in browser it relies on [TextDecoder API](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/decode), so if you are dealing with charsets other than `utf8`, `ascii`, `binary` or `base64` in old browsers, please include [encoding polyfill](https://github.com/inexorabletash/text-encoding).
### Related
* [string-to-arraybuffer](https://github.com/dfcreative/string-to-arraybuffer) convert string to arraybuffer.
* [create-data-uri](https://www.npmjs.com/package/create-data-uri) convert binary data to datauri string.

257
server/node_modules/arraybuffer-to-string/test.js generated vendored Normal file
View File

@ -0,0 +1,257 @@
'use strict'
var toString = require('./');
var t = require('tape')
var b2ab = require('buffer-to-arraybuffer')
var isBrowser = require('is-browser')
var str2ab = require('string-to-arraybuffer')
t('basics', t => {
t.equal(
toString(new Uint8Array([ 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33 ])),
'Hello World!'
)
t.end()
})
t('utf8 buffer to base64', function (t) {
t.equal(
toString(b2ab(Buffer.from('Ձאab', 'utf8')), 'base64'),
'1YHXkGFi'
)
t.end()
})
t('utf8 buffer to hex', function (t) {
t.equal(
toString(b2ab(Buffer.from('Ձאab', 'utf8')), 'hex'),
'd581d7906162'
)
t.end()
})
t('utf8 to utf8', function (t) {
t.equal(
toString(b2ab(Buffer.from('öäüõÖÄÜÕ', 'utf8')), 'utf8'),
'öäüõÖÄÜÕ'
)
t.end()
})
t('utf16le to utf16', function (t) {
t.equal(
toString(b2ab(Buffer.from(toString(b2ab(Buffer.from('abcd', 'utf8')), 'utf16le'), 'utf16le')), 'utf8'),
'abcd'
)
t.end()
})
t('utf16le to hex', function (t) {
t.equal(
toString(b2ab(Buffer.from('abcd', 'utf16le')), 'hex'),
'6100620063006400'
)
t.end()
})
t('ascii buffer to base64', function (t) {
t.equal(
toString(b2ab(Buffer.from('123456!@#$%^', 'ascii')), 'base64'),
'MTIzNDU2IUAjJCVe'
)
t.end()
})
t('ascii buffer to hex', function (t) {
t.equal(
toString(b2ab(Buffer.from('123456!@#$%^', 'ascii')), 'hex'),
'31323334353621402324255e'
)
t.end()
})
t('base64 buffer to utf8', function (t) {
t.equal(
toString(b2ab(Buffer.from('1YHXkGFi', 'base64')), 'utf8'),
'Ձאab'
)
t.end()
})
t('hex buffer to utf8', function (t) {
t.equal(
toString(b2ab(Buffer.from('d581d7906162', 'hex')), 'utf8'),
'Ձאab'
)
t.end()
})
t('base64 buffer to ascii', function (t) {
t.equal(
toString(b2ab(Buffer.from('MTIzNDU2IUAjJCVe', 'base64')), 'ascii'),
'123456!@#$%^'
)
t.end()
})
t('hex buffer to ascii', function (t) {
t.equal(
toString(b2ab(Buffer.from('31323334353621402324255e', 'hex')), 'ascii'),
'123456!@#$%^'
)
t.end()
})
t('base64 buffer to binary', function (t) {
t.equal(
toString(b2ab(Buffer.from('MTIzNDU2IUAjJCVe', 'base64')), 'binary'),
'123456!@#$%^'
)
t.end()
})
t('hex buffer to binary', function (t) {
t.equal(
toString(b2ab(Buffer.from('31323334353621402324255e', 'hex')), 'binary'),
'123456!@#$%^'
)
t.end()
})
t('utf8 to binary', function (t) {
/* jshint -W100 */
t.equal(
toString(b2ab(Buffer.from('öäüõÖÄÜÕ', 'utf8')), 'binary'),
'öäüõÖÄÜÕ'
)
/* jshint +W100 */
t.end()
})
t('utf8 replacement chars (1 byte sequence)', function (t) {
t.equal(
toString(b2ab(Buffer.from([ 0x80 ])) ),
'\uFFFD'
)
t.equal(
toString(b2ab(Buffer.from([ 0x7F ])) ),
'\u007F'
)
t.end()
})
t('utf8 replacement chars (2 byte sequences)', function (t) {
t.equal(
toString(b2ab(Buffer.from([ 0xC7 ])) ),
'\uFFFD'
)
t.equal(
toString(b2ab(Buffer.from([ 0xC7, 0xB1 ])) ),
'\u01F1'
)
t.equal(
toString(b2ab(Buffer.from([ 0xC0, 0xB1 ])) ),
'\uFFFD\uFFFD'
)
t.equal(
toString(b2ab(Buffer.from([ 0xC1, 0xB1 ])) ),
'\uFFFD\uFFFD'
)
t.end()
})
//FIXME: browser-only case in some reason
isBrowser && t('utf8 replacement chars (3 byte sequences)', function (t) {
t.equal(
toString(b2ab(Buffer.from([ 0xE0 ])) ),
'\uFFFD'
)
t.equal(
toString(Buffer.from([ 0xE0, 0xAC ]) ),
// new Buffer([ 0xE0, 0xAC ]).toString(),
'\uFFFD\uFFFD'
)
t.equal(
toString(b2ab(Buffer.from([ 0xE0, 0xAC, 0xB9 ])) ),
'\u0B39'
)
t.end()
})
isBrowser && t('utf8 replacement chars (4 byte sequences)', function (t) {
t.equal(
toString(b2ab(Buffer.from([ 0xF4 ])) ),
'\uFFFD'
)
t.equal(
toString(b2ab(Buffer.from([ 0xF4, 0x8F ])) ),
'\uFFFD\uFFFD'
)
t.equal(
toString(b2ab(Buffer.from([ 0xF4, 0x8F, 0x80 ])) ),
'\uFFFD\uFFFD\uFFFD'
)
t.equal(
toString(b2ab(Buffer.from([ 0xF4, 0x8F, 0x80, 0x84 ])) ),
'\uDBFC\uDC04'
)
t.equal(
toString(b2ab(Buffer.from([ 0xFF ])) ),
'\uFFFD'
)
t.equal(
toString(b2ab(Buffer.from([ 0xFF, 0x8F, 0x80, 0x84 ])) ),
'\uFFFD\uFFFD\uFFFD\uFFFD'
)
t.end()
})
t.skip('bad utf part', t => {
t.equal(
toString(new Uint8Array([236, 134, 219])),
'<27><><EFBFBD>'
)
t.end()
})
t.skip('utf8 replacement chars on 256 random bytes', function (t) {
t.equal(
toString(b2ab(Buffer.from([ 152, 130, 206, 23, 243, 238, 197, 44, 27, 86, 208, 36, 163, 184, 164, 21, 94, 242, 178, 46, 25, 26, 253, 178, 72, 147, 207, 112, 236, 68, 179, 190, 29, 83, 239, 147, 125, 55, 143, 19, 157, 68, 157, 58, 212, 224, 150, 39, 128, 24, 94, 225, 120, 121, 75, 192, 112, 19, 184, 142, 203, 36, 43, 85, 26, 147, 227, 139, 242, 186, 57, 78, 11, 102, 136, 117, 180, 210, 241, 92, 3, 215, 54, 167, 249, 1, 44, 225, 146, 86, 2, 42, 68, 21, 47, 238, 204, 153, 216, 252, 183, 66, 222, 255, 15, 202, 16, 51, 134, 1, 17, 19, 209, 76, 238, 38, 76, 19, 7, 103, 249, 5, 107, 137, 64, 62, 170, 57, 16, 85, 179, 193, 97, 86, 166, 196, 36, 148, 138, 193, 210, 69, 187, 38, 242, 97, 195, 219, 252, 244, 38, 1, 197, 18, 31, 246, 53, 47, 134, 52, 105, 72, 43, 239, 128, 203, 73, 93, 199, 75, 222, 220, 166, 34, 63, 236, 11, 212, 76, 243, 171, 110, 78, 39, 205, 204, 6, 177, 233, 212, 243, 0, 33, 41, 122, 118, 92, 252, 0, 157, 108, 120, 70, 137, 100, 223, 243, 171, 232, 66, 126, 111, 142, 33, 3, 39, 117, 27, 107, 54, 1, 217, 227, 132, 13, 166, 3, 73, 53, 127, 225, 236, 134, 219, 98, 214, 125, 148, 24, 64, 142, 111, 231, 194, 42, 150, 185, 10, 182, 163, 244, 19, 4, 59, 135, 16 ])) ),
'\uFFFD\uFFFD\uFFFD\u0017\uFFFD\uFFFD\uFFFD\u002C\u001B\u0056\uFFFD\u0024\uFFFD\uFFFD\uFFFD\u0015\u005E\uFFFD\uFFFD\u002E\u0019\u001A\uFFFD\uFFFD\u0048\uFFFD\uFFFD\u0070\uFFFD\u0044\uFFFD\uFFFD\u001D\u0053\uFFFD\uFFFD\u007D\u0037\uFFFD\u0013\uFFFD\u0044\uFFFD\u003A\uFFFD\uFFFD\uFFFD\u0027\uFFFD\u0018\u005E\uFFFD\u0078\u0079\u004B\uFFFD\u0070\u0013\uFFFD\uFFFD\uFFFD\u0024\u002B\u0055\u001A\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u0039\u004E\u000B\u0066\uFFFD\u0075\uFFFD\uFFFD\uFFFD\u005C\u0003\uFFFD\u0036\uFFFD\uFFFD\u0001\u002C\uFFFD\uFFFD\u0056\u0002\u002A\u0044\u0015\u002F\uFFFD\u0319\uFFFD\uFFFD\uFFFD\u0042\uFFFD\uFFFD\u000F\uFFFD\u0010\u0033\uFFFD\u0001\u0011\u0013\uFFFD\u004C\uFFFD\u0026\u004C\u0013\u0007\u0067\uFFFD\u0005\u006B\uFFFD\u0040\u003E\uFFFD\u0039\u0010\u0055\uFFFD\uFFFD\u0061\u0056\uFFFD\uFFFD\u0024\uFFFD\uFFFD\uFFFD\uFFFD\u0045\uFFFD\u0026\uFFFD\u0061\uFFFD\uFFFD\uFFFD\uFFFD\u0026\u0001\uFFFD\u0012\u001F\uFFFD\u0035\u002F\uFFFD\u0034\u0069\u0048\u002B\uFFFD\uFFFD\uFFFD\u0049\u005D\uFFFD\u004B\uFFFD\u0726\u0022\u003F\uFFFD\u000B\uFFFD\u004C\uFFFD\uFFFD\u006E\u004E\u0027\uFFFD\uFFFD\u0006\uFFFD\uFFFD\uFFFD\uFFFD\u0000\u0021\u0029\u007A\u0076\u005C\uFFFD\u0000\uFFFD\u006C\u0078\u0046\uFFFD\u0064\uFFFD\uFFFD\uFFFD\uFFFD\u0042\u007E\u006F\uFFFD\u0021\u0003\u0027\u0075\u001B\u006B\u0036\u0001\uFFFD\uFFFD\uFFFD\u000D\uFFFD\u0003\u0049\u0035\u007F\uFFFD\uFFFD\uFFFD\uFFFD\u0062\uFFFD\u007D\uFFFD\u0018\u0040\uFFFD\u006F\uFFFD\uFFFD\u002A\uFFFD\uFFFD\u000A\uFFFD\uFFFD\uFFFD\u0013\u0004\u003B\uFFFD\u0010'
)
t.end()
})
isBrowser && t('utf8 replacement chars for anything in the surrogate pair range', function (t) {
t.equal(
toString(b2ab(Buffer.from([ 0xED, 0x9F, 0xBF ])) ),
'\uD7FF'
)
t.equal(
toString(b2ab(Buffer.from([ 0xED, 0xA0, 0x80 ])) ),
'\uFFFD\uFFFD\uFFFD'
)
t.equal(
toString(b2ab(Buffer.from([ 0xED, 0xBE, 0x8B ])) ),
'\uFFFD\uFFFD\uFFFD'
)
t.equal(
toString(b2ab(Buffer.from([ 0xED, 0xBF, 0xBF ])) ),
'\uFFFD\uFFFD\uFFFD'
)
t.equal(
toString(b2ab(Buffer.from([ 0xEE, 0x80, 0x80 ])) ),
'\uE000'
)
t.end()
})
t('utf8 don\'t replace the replacement char', function (t) {
t.equal(
toString(b2ab(Buffer.from('\uFFFD')) ),
'\uFFFD'
)
t.end()
})

6
server/node_modules/atob-lite/.npmignore generated vendored Normal file
View File

@ -0,0 +1,6 @@
node_modules
*.log
.DS_Store
bundle.js
test
test.js

18
server/node_modules/atob-lite/LICENSE.md generated vendored Normal file
View File

@ -0,0 +1,18 @@
This software is released under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

37
server/node_modules/atob-lite/README.md generated vendored Normal file
View File

@ -0,0 +1,37 @@
# atob-lite
![](http://img.shields.io/badge/stability-stable-orange.svg?style=flat)
![](http://img.shields.io/npm/v/atob-lite.svg?style=flat)
![](http://img.shields.io/npm/dm/atob-lite.svg?style=flat)
![](http://img.shields.io/npm/l/atob-lite.svg?style=flat)
Smallest/simplest possible means of using atob with both Node and browserify.
In the browser, decoding base64 strings is done using:
``` javascript
var decoded = atob(encoded)
```
However in Node, it's done like so:
``` javascript
var decoded = new Buffer(encoded, 'base64').toString('utf8')
```
You can easily check if `Buffer` exists and switch between the approaches
accordingly, but using `Buffer` anywhere in your browser source will pull
in browserify's `Buffer` shim which is pretty hefty. This package uses
the `main` and `browser` fields in its `package.json` to perform this
check at build time and avoid pulling `Buffer` in unnecessarily.
## Usage
[![NPM](https://nodei.co/npm/atob-lite.png)](https://nodei.co/npm/atob-lite/)
### `decoded = atob(encoded)`
Returns the decoded value of a base64-encoded string.
## License
MIT. See [LICENSE.md](http://github.com/hughsk/atob-lite/blob/master/LICENSE.md) for details.

3
server/node_modules/atob-lite/atob-browser.js generated vendored Normal file
View File

@ -0,0 +1,3 @@
module.exports = function _atob(str) {
return atob(str)
}

3
server/node_modules/atob-lite/atob-node.js generated vendored Normal file
View File

@ -0,0 +1,3 @@
module.exports = function atob(str) {
return Buffer.from(str, 'base64').toString('binary')
}

67
server/node_modules/atob-lite/package.json generated vendored Normal file
View File

@ -0,0 +1,67 @@
{
"_from": "atob-lite@^2.0.0",
"_id": "atob-lite@2.0.0",
"_inBundle": false,
"_integrity": "sha1-D+9a1G8b16hQLGVyfwNn1e5D1pY=",
"_location": "/atob-lite",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "atob-lite@^2.0.0",
"name": "atob-lite",
"escapedName": "atob-lite",
"rawSpec": "^2.0.0",
"saveSpec": null,
"fetchSpec": "^2.0.0"
},
"_requiredBy": [
"/string-to-arraybuffer"
],
"_resolved": "https://registry.npmjs.org/atob-lite/-/atob-lite-2.0.0.tgz",
"_shasum": "0fef5ad46f1bd7a8502c65727f0367d5ee43d696",
"_spec": "atob-lite@^2.0.0",
"_where": "/home/sigonasr2/divar/server/node_modules/string-to-arraybuffer",
"author": {
"name": "Hugh Kennedy",
"email": "hughskennedy@gmail.com",
"url": "http://hughsk.io/"
},
"browser": "atob-browser.js",
"bugs": {
"url": "https://github.com/hughsk/atob-lite/issues"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "Smallest/simplest possible means of using atob with both Node and browserify",
"devDependencies": {
"browserify": "^10.2.4",
"smokestack": "^3.3.0",
"tap-closer": "^1.0.0",
"tap-spec": "^4.0.0",
"tape": "^4.0.0"
},
"homepage": "https://github.com/hughsk/atob-lite",
"keywords": [
"atob",
"base64",
"isomorphic",
"browser",
"node",
"shared"
],
"license": "MIT",
"main": "atob-node.js",
"name": "atob-lite",
"repository": {
"type": "git",
"url": "git://github.com/hughsk/atob-lite.git"
},
"scripts": {
"test": "npm run test-node && npm run test-browser",
"test-browser": "browserify test | smokestack | tap-spec",
"test-node": "node test | tap-spec"
},
"version": "2.0.0"
}

2
server/node_modules/bmp-js/.npmignore generated vendored Normal file
View File

@ -0,0 +1,2 @@
node_modules
.idea

21
server/node_modules/bmp-js/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 @丝刀口
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

44
server/node_modules/bmp-js/README.md generated vendored Normal file
View File

@ -0,0 +1,44 @@
bmp-js
======
A pure javascript Bmp encoder and decoder for node.js
Supports all bits decoding(1,4,8,16,24,32) and encoding with 24bit.
##Install
$ npm install bmp-js
How to use?
---
###Decode BMP
```js
var bmp = require("bmp-js");
var bmpBuffer = fs.readFileSync('bit24.bmp');
var bmpData = bmp.decode(bmpBuffer);
```
`bmpData` has all properties includes:
1. fileSize,reserved,offset
2. headerSize,width,height,planes,bitPP,compress,rawSize,hr,vr,colors,importantColors
3. palette
4. data-------byte array order by ABGR ABGR ABGR,4 bytes per pixel
###Encode RGB
```js
var bmp = require("bmp-js");
//bmpData={data:Buffer,width:Number,height:Height}
var rawData = bmp.encode(bmpData);//default no compression,write rawData to .bmp file
```
License
---
U can use on free with [MIT License](https://github.com/shaozilee/bmp-js/blob/master/LICENSE)

9
server/node_modules/bmp-js/bmp-js.iml generated vendored Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

15
server/node_modules/bmp-js/index.js generated vendored Normal file
View File

@ -0,0 +1,15 @@
/**
* @author shaozilee
*
* support 1bit 4bit 8bit 24bit decode
* encode with 24bit
*
*/
var encode = require('./lib/encoder'),
decode = require('./lib/decoder');
module.exports = {
encode: encode,
decode: decode
};

485
server/node_modules/bmp-js/lib/decoder.js generated vendored Normal file
View File

@ -0,0 +1,485 @@
/**
* @author shaozilee
*
* Bmp format decoder,support 1bit 4bit 8bit 24bit bmp
*
*/
function BmpDecoder(buffer,is_with_alpha) {
this.pos = 0;
this.buffer = buffer;
this.is_with_alpha = !!is_with_alpha;
this.bottom_up = true;
this.flag = this.buffer.toString("utf-8", 0, this.pos += 2);
if (this.flag != "BM") throw new Error("Invalid BMP File");
this.parseHeader();
this.parseRGBA();
}
BmpDecoder.prototype.parseHeader = function() {
this.fileSize = this.buffer.readUInt32LE(this.pos);
this.pos += 4;
this.reserved = this.buffer.readUInt32LE(this.pos);
this.pos += 4;
this.offset = this.buffer.readUInt32LE(this.pos);
this.pos += 4;
this.headerSize = this.buffer.readUInt32LE(this.pos);
this.pos += 4;
this.width = this.buffer.readUInt32LE(this.pos);
this.pos += 4;
this.height = this.buffer.readInt32LE(this.pos);
this.pos += 4;
this.planes = this.buffer.readUInt16LE(this.pos);
this.pos += 2;
this.bitPP = this.buffer.readUInt16LE(this.pos);
this.pos += 2;
this.compress = this.buffer.readUInt32LE(this.pos);
this.pos += 4;
this.rawSize = this.buffer.readUInt32LE(this.pos);
this.pos += 4;
this.hr = this.buffer.readUInt32LE(this.pos);
this.pos += 4;
this.vr = this.buffer.readUInt32LE(this.pos);
this.pos += 4;
this.colors = this.buffer.readUInt32LE(this.pos);
this.pos += 4;
this.importantColors = this.buffer.readUInt32LE(this.pos);
this.pos += 4;
if(this.bitPP === 16 && this.is_with_alpha){
this.bitPP = 15
}
if (this.bitPP < 15) {
var len = this.colors === 0 ? 1 << this.bitPP : this.colors;
this.palette = new Array(len);
for (var i = 0; i < len; i++) {
var blue = this.buffer.readUInt8(this.pos++);
var green = this.buffer.readUInt8(this.pos++);
var red = this.buffer.readUInt8(this.pos++);
var quad = this.buffer.readUInt8(this.pos++);
this.palette[i] = {
red: red,
green: green,
blue: blue,
quad: quad
};
}
}
if(this.height < 0) {
this.height *= -1;
this.bottom_up = false;
}
}
BmpDecoder.prototype.parseRGBA = function() {
var bitn = "bit" + this.bitPP;
var len = this.width * this.height * 4;
this.data = new Buffer(len);
this[bitn]();
};
BmpDecoder.prototype.bit1 = function() {
var xlen = Math.ceil(this.width / 8);
var mode = xlen%4;
var y = this.height >= 0 ? this.height - 1 : -this.height
for (var y = this.height - 1; y >= 0; y--) {
var line = this.bottom_up ? y : this.height - 1 - y
for (var x = 0; x < xlen; x++) {
var b = this.buffer.readUInt8(this.pos++);
var location = line * this.width * 4 + x*8*4;
for (var i = 0; i < 8; i++) {
if(x*8+i<this.width){
var rgb = this.palette[((b>>(7-i))&0x1)];
this.data[location+i*4] = 0;
this.data[location+i*4 + 1] = rgb.blue;
this.data[location+i*4 + 2] = rgb.green;
this.data[location+i*4 + 3] = rgb.red;
}else{
break;
}
}
}
if (mode != 0){
this.pos+=(4 - mode);
}
}
};
BmpDecoder.prototype.bit4 = function() {
//RLE-4
if(this.compress == 2){
this.data.fill(0xff);
var location = 0;
var lines = this.bottom_up?this.height-1:0;
var low_nibble = false;//for all count of pixel
while(location<this.data.length){
var a = this.buffer.readUInt8(this.pos++);
var b = this.buffer.readUInt8(this.pos++);
//absolute mode
if(a == 0){
if(b == 0){//line end
if(this.bottom_up){
lines--;
}else{
lines++;
}
location = lines*this.width*4;
low_nibble = false;
continue;
}else if(b == 1){//image end
break;
}else if(b ==2){
//offset x,y
var x = this.buffer.readUInt8(this.pos++);
var y = this.buffer.readUInt8(this.pos++);
if(this.bottom_up){
lines-=y;
}else{
lines+=y;
}
location +=(y*this.width*4+x*4);
}else{
var c = this.buffer.readUInt8(this.pos++);
for(var i=0;i<b;i++){
if (low_nibble) {
setPixelData.call(this, (c & 0x0f));
} else {
setPixelData.call(this, (c & 0xf0)>>4);
}
if ((i & 1) && (i+1 < b)){
c = this.buffer.readUInt8(this.pos++);
}
low_nibble = !low_nibble;
}
if ((((b+1) >> 1) & 1 ) == 1){
this.pos++
}
}
}else{//encoded mode
for (var i = 0; i < a; i++) {
if (low_nibble) {
setPixelData.call(this, (b & 0x0f));
} else {
setPixelData.call(this, (b & 0xf0)>>4);
}
low_nibble = !low_nibble;
}
}
}
function setPixelData(rgbIndex){
var rgb = this.palette[rgbIndex];
this.data[location] = 0;
this.data[location + 1] = rgb.blue;
this.data[location + 2] = rgb.green;
this.data[location + 3] = rgb.red;
location+=4;
}
}else{
var xlen = Math.ceil(this.width/2);
var mode = xlen%4;
for (var y = this.height - 1; y >= 0; y--) {
var line = this.bottom_up ? y : this.height - 1 - y
for (var x = 0; x < xlen; x++) {
var b = this.buffer.readUInt8(this.pos++);
var location = line * this.width * 4 + x*2*4;
var before = b>>4;
var after = b&0x0F;
var rgb = this.palette[before];
this.data[location] = 0;
this.data[location + 1] = rgb.blue;
this.data[location + 2] = rgb.green;
this.data[location + 3] = rgb.red;
if(x*2+1>=this.width)break;
rgb = this.palette[after];
this.data[location+4] = 0;
this.data[location+4 + 1] = rgb.blue;
this.data[location+4 + 2] = rgb.green;
this.data[location+4 + 3] = rgb.red;
}
if (mode != 0){
this.pos+=(4 - mode);
}
}
}
};
BmpDecoder.prototype.bit8 = function() {
//RLE-8
if(this.compress == 1){
this.data.fill(0xff);
var location = 0;
var lines = this.bottom_up?this.height-1:0;
while(location<this.data.length){
var a = this.buffer.readUInt8(this.pos++);
var b = this.buffer.readUInt8(this.pos++);
//absolute mode
if(a == 0){
if(b == 0){//line end
if(this.bottom_up){
lines--;
}else{
lines++;
}
location = lines*this.width*4;
continue;
}else if(b == 1){//image end
break;
}else if(b ==2){
//offset x,y
var x = this.buffer.readUInt8(this.pos++);
var y = this.buffer.readUInt8(this.pos++);
if(this.bottom_up){
lines-=y;
}else{
lines+=y;
}
location +=(y*this.width*4+x*4);
}else{
for(var i=0;i<b;i++){
var c = this.buffer.readUInt8(this.pos++);
setPixelData.call(this, c);
}
if(b&1 == 1){
this.pos++;
}
}
}else{//encoded mode
for (var i = 0; i < a; i++) {
setPixelData.call(this, b);
}
}
}
function setPixelData(rgbIndex){
var rgb = this.palette[rgbIndex];
this.data[location] = 0;
this.data[location + 1] = rgb.blue;
this.data[location + 2] = rgb.green;
this.data[location + 3] = rgb.red;
location+=4;
}
}else {
var mode = this.width % 4;
for (var y = this.height - 1; y >= 0; y--) {
var line = this.bottom_up ? y : this.height - 1 - y
for (var x = 0; x < this.width; x++) {
var b = this.buffer.readUInt8(this.pos++);
var location = line * this.width * 4 + x * 4;
if (b < this.palette.length) {
var rgb = this.palette[b];
this.data[location] = 0;
this.data[location + 1] = rgb.blue;
this.data[location + 2] = rgb.green;
this.data[location + 3] = rgb.red;
} else {
this.data[location] = 0;
this.data[location + 1] = 0xFF;
this.data[location + 2] = 0xFF;
this.data[location + 3] = 0xFF;
}
}
if (mode != 0) {
this.pos += (4 - mode);
}
}
}
};
BmpDecoder.prototype.bit15 = function() {
var dif_w =this.width % 3;
var _11111 = parseInt("11111", 2),_1_5 = _11111;
for (var y = this.height - 1; y >= 0; y--) {
var line = this.bottom_up ? y : this.height - 1 - y
for (var x = 0; x < this.width; x++) {
var B = this.buffer.readUInt16LE(this.pos);
this.pos+=2;
var blue = (B & _1_5) / _1_5 * 255 | 0;
var green = (B >> 5 & _1_5 ) / _1_5 * 255 | 0;
var red = (B >> 10 & _1_5) / _1_5 * 255 | 0;
var alpha = (B>>15)?0xFF:0x00;
var location = line * this.width * 4 + x * 4;
this.data[location] = alpha;
this.data[location + 1] = blue;
this.data[location + 2] = green;
this.data[location + 3] = red;
}
//skip extra bytes
this.pos += dif_w;
}
};
BmpDecoder.prototype.bit16 = function() {
var dif_w =(this.width % 2)*2;
//default xrgb555
this.maskRed = 0x7C00;
this.maskGreen = 0x3E0;
this.maskBlue =0x1F;
this.mask0 = 0;
if(this.compress == 3){
this.maskRed = this.buffer.readUInt32LE(this.pos);
this.pos+=4;
this.maskGreen = this.buffer.readUInt32LE(this.pos);
this.pos+=4;
this.maskBlue = this.buffer.readUInt32LE(this.pos);
this.pos+=4;
this.mask0 = this.buffer.readUInt32LE(this.pos);
this.pos+=4;
}
var ns=[0,0,0];
for (var i=0;i<16;i++){
if ((this.maskRed>>i)&0x01) ns[0]++;
if ((this.maskGreen>>i)&0x01) ns[1]++;
if ((this.maskBlue>>i)&0x01) ns[2]++;
}
ns[1]+=ns[0]; ns[2]+=ns[1]; ns[0]=8-ns[0]; ns[1]-=8; ns[2]-=8;
for (var y = this.height - 1; y >= 0; y--) {
var line = this.bottom_up ? y : this.height - 1 - y;
for (var x = 0; x < this.width; x++) {
var B = this.buffer.readUInt16LE(this.pos);
this.pos+=2;
var blue = (B&this.maskBlue)<<ns[0];
var green = (B&this.maskGreen)>>ns[1];
var red = (B&this.maskRed)>>ns[2];
var location = line * this.width * 4 + x * 4;
this.data[location] = 0;
this.data[location + 1] = blue;
this.data[location + 2] = green;
this.data[location + 3] = red;
}
//skip extra bytes
this.pos += dif_w;
}
};
BmpDecoder.prototype.bit24 = function() {
for (var y = this.height - 1; y >= 0; y--) {
var line = this.bottom_up ? y : this.height - 1 - y
for (var x = 0; x < this.width; x++) {
//Little Endian rgb
var blue = this.buffer.readUInt8(this.pos++);
var green = this.buffer.readUInt8(this.pos++);
var red = this.buffer.readUInt8(this.pos++);
var location = line * this.width * 4 + x * 4;
this.data[location] = 0;
this.data[location + 1] = blue;
this.data[location + 2] = green;
this.data[location + 3] = red;
}
//skip extra bytes
this.pos += (this.width % 4);
}
};
/**
* add 32bit decode func
* @author soubok
*/
BmpDecoder.prototype.bit32 = function() {
//BI_BITFIELDS
if(this.compress == 3){
this.maskRed = this.buffer.readUInt32LE(this.pos);
this.pos+=4;
this.maskGreen = this.buffer.readUInt32LE(this.pos);
this.pos+=4;
this.maskBlue = this.buffer.readUInt32LE(this.pos);
this.pos+=4;
this.mask0 = this.buffer.readUInt32LE(this.pos);
this.pos+=4;
for (var y = this.height - 1; y >= 0; y--) {
var line = this.bottom_up ? y : this.height - 1 - y;
for (var x = 0; x < this.width; x++) {
//Little Endian rgba
var alpha = this.buffer.readUInt8(this.pos++);
var blue = this.buffer.readUInt8(this.pos++);
var green = this.buffer.readUInt8(this.pos++);
var red = this.buffer.readUInt8(this.pos++);
var location = line * this.width * 4 + x * 4;
this.data[location] = alpha;
this.data[location + 1] = blue;
this.data[location + 2] = green;
this.data[location + 3] = red;
}
}
}else{
for (var y = this.height - 1; y >= 0; y--) {
var line = this.bottom_up ? y : this.height - 1 - y;
for (var x = 0; x < this.width; x++) {
//Little Endian argb
var blue = this.buffer.readUInt8(this.pos++);
var green = this.buffer.readUInt8(this.pos++);
var red = this.buffer.readUInt8(this.pos++);
var alpha = this.buffer.readUInt8(this.pos++);
var location = line * this.width * 4 + x * 4;
this.data[location] = alpha;
this.data[location + 1] = blue;
this.data[location + 2] = green;
this.data[location + 3] = red;
}
}
}
};
BmpDecoder.prototype.getData = function() {
return this.data;
};
module.exports = function(bmpData) {
var decoder = new BmpDecoder(bmpData);
return decoder;
};

81
server/node_modules/bmp-js/lib/encoder.js generated vendored Normal file
View File

@ -0,0 +1,81 @@
/**
* @author shaozilee
*
* BMP format encoder,encode 24bit BMP
* Not support quality compression
*
*/
function BmpEncoder(imgData){
this.buffer = imgData.data;
this.width = imgData.width;
this.height = imgData.height;
this.extraBytes = this.width%4;
this.rgbSize = this.height*(3*this.width+this.extraBytes);
this.headerInfoSize = 40;
this.data = [];
/******************header***********************/
this.flag = "BM";
this.reserved = 0;
this.offset = 54;
this.fileSize = this.rgbSize+this.offset;
this.planes = 1;
this.bitPP = 24;
this.compress = 0;
this.hr = 0;
this.vr = 0;
this.colors = 0;
this.importantColors = 0;
}
BmpEncoder.prototype.encode = function() {
var tempBuffer = new Buffer(this.offset+this.rgbSize);
this.pos = 0;
tempBuffer.write(this.flag,this.pos,2);this.pos+=2;
tempBuffer.writeUInt32LE(this.fileSize,this.pos);this.pos+=4;
tempBuffer.writeUInt32LE(this.reserved,this.pos);this.pos+=4;
tempBuffer.writeUInt32LE(this.offset,this.pos);this.pos+=4;
tempBuffer.writeUInt32LE(this.headerInfoSize,this.pos);this.pos+=4;
tempBuffer.writeUInt32LE(this.width,this.pos);this.pos+=4;
tempBuffer.writeInt32LE(-this.height,this.pos);this.pos+=4;
tempBuffer.writeUInt16LE(this.planes,this.pos);this.pos+=2;
tempBuffer.writeUInt16LE(this.bitPP,this.pos);this.pos+=2;
tempBuffer.writeUInt32LE(this.compress,this.pos);this.pos+=4;
tempBuffer.writeUInt32LE(this.rgbSize,this.pos);this.pos+=4;
tempBuffer.writeUInt32LE(this.hr,this.pos);this.pos+=4;
tempBuffer.writeUInt32LE(this.vr,this.pos);this.pos+=4;
tempBuffer.writeUInt32LE(this.colors,this.pos);this.pos+=4;
tempBuffer.writeUInt32LE(this.importantColors,this.pos);this.pos+=4;
var i=0;
var rowBytes = 3*this.width+this.extraBytes;
for (var y = 0; y <this.height; y++){
for (var x = 0; x < this.width; x++){
var p = this.pos+y*rowBytes+x*3;
i++;//a
tempBuffer[p]= this.buffer[i++];//b
tempBuffer[p+1] = this.buffer[i++];//g
tempBuffer[p+2] = this.buffer[i++];//r
}
if(this.extraBytes>0){
var fillOffset = this.pos+y*rowBytes+this.width*3;
tempBuffer.fill(0,fillOffset,fillOffset+this.extraBytes);
}
}
return tempBuffer;
};
module.exports = function(imgData, quality) {
if (typeof quality === 'undefined') quality = 100;
var encoder = new BmpEncoder(imgData);
var data = encoder.encode();
return {
data: data,
width: imgData.width,
height: imgData.height
};
};

60
server/node_modules/bmp-js/package.json generated vendored Normal file
View File

@ -0,0 +1,60 @@
{
"_from": "bmp-js@^0.1.0",
"_id": "bmp-js@0.1.0",
"_inBundle": false,
"_integrity": "sha1-4Fpj95amwf8l9Hcex62twUjAcjM=",
"_location": "/bmp-js",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "bmp-js@^0.1.0",
"name": "bmp-js",
"escapedName": "bmp-js",
"rawSpec": "^0.1.0",
"saveSpec": null,
"fetchSpec": "^0.1.0"
},
"_requiredBy": [
"/image-decode"
],
"_resolved": "https://registry.npmjs.org/bmp-js/-/bmp-js-0.1.0.tgz",
"_shasum": "e05a63f796a6c1ff25f4771ec7adadc148c07233",
"_spec": "bmp-js@^0.1.0",
"_where": "/home/sigonasr2/divar/server/node_modules/image-decode",
"author": {
"name": "shaozilee",
"email": "shaozilee@gmail.com"
},
"bugs": {
"url": "https://github.com/shaozilee/bmp-js/issues"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "A pure javascript BMP encoder and decoder",
"devDependencies": {},
"homepage": "https://github.com/shaozilee/bmp-js#readme",
"keywords": [
"bmp",
"1bit",
"4bit",
"8bit",
"16bit",
"24bit",
"32bit",
"encoder",
"decoder",
"image",
"javascript",
"js"
],
"license": "MIT",
"main": "index.js",
"name": "bmp-js",
"repository": {
"type": "git",
"url": "git+https://github.com/shaozilee/bmp-js.git"
},
"version": "0.1.0"
}

BIN
server/node_modules/bmp-js/test/bit1.bmp generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
server/node_modules/bmp-js/test/bit16_565.bmp generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
server/node_modules/bmp-js/test/bit16_565_out.bmp generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
server/node_modules/bmp-js/test/bit16_a444.bmp generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
server/node_modules/bmp-js/test/bit16_a444_out.bmp generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
server/node_modules/bmp-js/test/bit16_a555.bmp generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
server/node_modules/bmp-js/test/bit16_a555_out.bmp generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
server/node_modules/bmp-js/test/bit16_x444.bmp generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
server/node_modules/bmp-js/test/bit16_x444_out.bmp generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
server/node_modules/bmp-js/test/bit16_x555.bmp generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
server/node_modules/bmp-js/test/bit16_x555_out.bmp generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
server/node_modules/bmp-js/test/bit1_out.bmp generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
server/node_modules/bmp-js/test/bit24.bmp generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
server/node_modules/bmp-js/test/bit24_out.bmp generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
server/node_modules/bmp-js/test/bit32.bmp generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

BIN
server/node_modules/bmp-js/test/bit32_alpha.bmp generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

BIN
server/node_modules/bmp-js/test/bit32_alpha_out.bmp generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
server/node_modules/bmp-js/test/bit32_out.bmp generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
server/node_modules/bmp-js/test/bit4.bmp generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

BIN
server/node_modules/bmp-js/test/bit4_RLE.bmp generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
server/node_modules/bmp-js/test/bit4_RLE_out.bmp generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
server/node_modules/bmp-js/test/bit4_out.bmp generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
server/node_modules/bmp-js/test/bit8.bmp generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
server/node_modules/bmp-js/test/bit8_RLE.bmp generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
server/node_modules/bmp-js/test/bit8_RLE_out.bmp generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
server/node_modules/bmp-js/test/bit8_out.bmp generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

33
server/node_modules/bmp-js/test/test.js generated vendored Normal file
View File

@ -0,0 +1,33 @@
var fs = require("fs");
var coder = require("../index.js");
var bmps = ["./bit1", "./bit4", "./bit4_RLE", "./bit8", "./bit8_RLE", "./bit16_565", "./bit16_a444", "./bit16_a555", "./bit16_x444", "./bit16_x555", "./bit24", "./bit32", "./bit32_alpha"];
console.log("test bmp decoding and encoding...");
for(var b=0; b<bmps.length;b++){
var src =bmps[b];
console.log("----------------"+src+".bmp");
var bufferData = fs.readFileSync(src+".bmp");
var decoder = coder.decode(bufferData);
console.log("width:",decoder.width);
console.log("height",decoder.height);
console.log("fileSize:",decoder.fileSize);
//encode with 24bit
var encodeData = coder.encode(decoder);
fs.writeFileSync(src+"_out.bmp", encodeData.data);
}
console.log("test bmp success!");

4
server/node_modules/buffer-equal/.travis.yml generated vendored Normal file
View File

@ -0,0 +1,4 @@
language: node_js
node_js:
- 0.8
- "0.10"

62
server/node_modules/buffer-equal/README.markdown generated vendored Normal file
View File

@ -0,0 +1,62 @@
buffer-equal
============
Return whether two buffers are equal.
[![build status](https://secure.travis-ci.org/substack/node-buffer-equal.png)](http://travis-ci.org/substack/node-buffer-equal)
example
=======
``` js
var bufferEqual = require('buffer-equal');
console.dir(bufferEqual(
new Buffer([253,254,255]),
new Buffer([253,254,255])
));
console.dir(bufferEqual(
new Buffer('abc'),
new Buffer('abcd')
));
console.dir(bufferEqual(
new Buffer('abc'),
'abc'
));
```
output:
```
true
false
undefined
```
methods
=======
``` js
var bufferEqual = require('buffer-equal')
```
bufferEqual(a, b)
-----------------
Return whether the two buffers `a` and `b` are equal.
If `a` or `b` is not a buffer, return `undefined`.
install
=======
With [npm](http://npmjs.org) do:
```
npm install buffer-equal
```
license
=======
MIT

14
server/node_modules/buffer-equal/example/eq.js generated vendored Normal file
View File

@ -0,0 +1,14 @@
var bufferEqual = require('../');
console.dir(bufferEqual(
new Buffer([253,254,255]),
new Buffer([253,254,255])
));
console.dir(bufferEqual(
new Buffer('abc'),
new Buffer('abcd')
));
console.dir(bufferEqual(
new Buffer('abc'),
'abc'
));

14
server/node_modules/buffer-equal/index.js generated vendored Normal file
View File

@ -0,0 +1,14 @@
var Buffer = require('buffer').Buffer; // for use with browserify
module.exports = function (a, b) {
if (!Buffer.isBuffer(a)) return undefined;
if (!Buffer.isBuffer(b)) return undefined;
if (typeof a.equals === 'function') return a.equals(b);
if (a.length !== b.length) return false;
for (var i = 0; i < a.length; i++) {
if (a[i] !== b[i]) return false;
}
return true;
};

62
server/node_modules/buffer-equal/package.json generated vendored Normal file
View File

@ -0,0 +1,62 @@
{
"_from": "buffer-equal@0.0.1",
"_id": "buffer-equal@0.0.1",
"_inBundle": false,
"_integrity": "sha1-kbx0sR6kBbyRa8aqkI+q+ltKrEs=",
"_location": "/buffer-equal",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "buffer-equal@0.0.1",
"name": "buffer-equal",
"escapedName": "buffer-equal",
"rawSpec": "0.0.1",
"saveSpec": null,
"fetchSpec": "0.0.1"
},
"_requiredBy": [
"/readimage"
],
"_resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-0.0.1.tgz",
"_shasum": "91bc74b11ea405bc916bc6aa908faafa5b4aac4b",
"_spec": "buffer-equal@0.0.1",
"_where": "/home/sigonasr2/divar/server/node_modules/readimage",
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
"url": "http://substack.net"
},
"bugs": {
"url": "https://github.com/substack/node-buffer-equal/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "return whether two buffers are equal",
"devDependencies": {
"tap": "0.2.4"
},
"directories": {
"example": "example",
"test": "test"
},
"engines": {
"node": ">=0.4.0"
},
"homepage": "https://github.com/substack/node-buffer-equal#readme",
"keywords": [
"buffer",
"equal"
],
"license": "MIT",
"main": "index.js",
"name": "buffer-equal",
"repository": {
"type": "git",
"url": "git://github.com/substack/node-buffer-equal.git"
},
"scripts": {
"test": "tap test/*.js"
},
"version": "0.0.1"
}

35
server/node_modules/buffer-equal/test/eq.js generated vendored Normal file
View File

@ -0,0 +1,35 @@
var bufferEqual = require('../');
var test = require('tap').test;
test('equal', function (t) {
var eq = bufferEqual(
new Buffer([253,254,255]),
new Buffer([253,254,255])
);
t.strictEqual(eq, true);
t.end();
});
test('not equal', function (t) {
var eq = bufferEqual(
new Buffer('abc'),
new Buffer('abcd')
);
t.strictEqual(eq, false);
t.end();
});
test('not equal not buffer', function (t) {
var eq = bufferEqual(
new Buffer('abc'),
'abc'
);
t.strictEqual(eq, undefined);
t.end();
});
test('equal not buffer', function (t) {
var eq = bufferEqual('abc', 'abc');
t.strictEqual(eq, undefined);
t.end();
});

18
server/node_modules/buffer-to-uint8array/LICENSE generated vendored Normal file
View File

@ -0,0 +1,18 @@
This software is released under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,5 @@
var tou8 = require('../');
var buf = new Buffer('whatever');
var a = tou8(buf);
console.log(a.constructor.name);
console.log(a);

11
server/node_modules/buffer-to-uint8array/index.js generated vendored Normal file
View File

@ -0,0 +1,11 @@
module.exports = function (buf) {
if (!buf) return undefined;
if (buf.constructor.name === 'Uint8Array'
|| buf.constructor === Uint8Array) {
return buf;
}
if (typeof buf === 'string') buf = Buffer(buf);
var a = new Uint8Array(buf.length);
for (var i = 0; i < buf.length; i++) a[i] = buf[i];
return a;
};

60
server/node_modules/buffer-to-uint8array/package.json generated vendored Normal file
View File

@ -0,0 +1,60 @@
{
"_from": "buffer-to-uint8array@^1.1.0",
"_id": "buffer-to-uint8array@1.1.0",
"_inBundle": false,
"_integrity": "sha1-z29BKHwCL0WNp1LDkcGo1TXsX3I=",
"_location": "/buffer-to-uint8array",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "buffer-to-uint8array@^1.1.0",
"name": "buffer-to-uint8array",
"escapedName": "buffer-to-uint8array",
"rawSpec": "^1.1.0",
"saveSpec": null,
"fetchSpec": "^1.1.0"
},
"_requiredBy": [
"/image-decode"
],
"_resolved": "https://registry.npmjs.org/buffer-to-uint8array/-/buffer-to-uint8array-1.1.0.tgz",
"_shasum": "cf6f41287c022f458da752c391c1a8d535ec5f72",
"_spec": "buffer-to-uint8array@^1.1.0",
"_where": "/home/sigonasr2/divar/server/node_modules/image-decode",
"author": {
"name": "substack"
},
"bugs": {
"url": "https://github.com/substack/buffer-to-uint8array/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "convert a buffer (or string) to a Uint8Array",
"devDependencies": {
"tape": "^4.0.0"
},
"directories": {
"example": "example",
"test": "test"
},
"homepage": "https://github.com/substack/buffer-to-uint8array#readme",
"keywords": [
"Uint8Array",
"u8",
"byte",
"buffer",
"typedarray"
],
"license": "MIT",
"main": "index.js",
"name": "buffer-to-uint8array",
"repository": {
"type": "git",
"url": "git://github.com/substack/buffer-to-uint8array.git"
},
"scripts": {
"test": "tape test/*.js"
},
"version": "1.1.0"
}

View File

@ -0,0 +1,37 @@
# buffer-to-uint8array
convert a buffer (or string) to a Uint8Array
# example
``` js
var tou8 = require('buffer-to-uint8array');
var buf = new Buffer('whatever');
var a = tou8(buf);
console.log(a.constructor.name);
console.log(a);
```
# methods
``` js
var tou8 = require('buffer-to-uint8array')
```
## var u = tou8(buf)
Convert `buf`, a `Buffer` or `string` to a `Uint8Array`.
If `buf` is already a Uint8Array, it will be returned.
# install
With [npm](https://npmjs.org) do:
```
npm install buffer-to-uint8array
```
# license
MIT

10
server/node_modules/buffer-to-uint8array/test/buf.js generated vendored Normal file
View File

@ -0,0 +1,10 @@
var test = require('tape');
var tou8 = require('../');
test('buffer to uint8', function (t) {
t.plan(2);
var buf = new Buffer('whatever');
var a = tou8(buf);
t.equal(a.constructor.name, 'Uint8Array', 'constructor name');
t.equal(a.length, 8, 'buffer length');
});

10
server/node_modules/buffer-to-uint8array/test/str.js generated vendored Normal file
View File

@ -0,0 +1,10 @@
var test = require('tape');
var tou8 = require('../');
test('string to uint8', function (t) {
t.plan(2);
var str = 'whatever';
var a = tou8(str);
t.equal(a.constructor.name, 'Uint8Array', 'constructor name');
t.equal(a.length, 8, 'length');
});

15
server/node_modules/buffer-to-uint8array/test/u8.js generated vendored Normal file
View File

@ -0,0 +1,15 @@
var test = require('tape');
var tou8 = require('../');
test('uint8 to uint8', function (t) {
t.plan(3);
var a = new Uint8Array(8);
var buf = Buffer('whatever');
for (var i = 0; i < buf.length; i++) a[i] = buf[i];
var b = tou8(a);
t.equal(a, b, 'reference equality');
t.equal(a.constructor.name, 'Uint8Array', 'constructor name');
t.equal(a.length, 8, 'u8 length');
});

Some files were not shown because too many files have changed in this diff Show More