Comparing version 1.0.2 to 1.0.3
@@ -8,3 +8,3 @@ "use strict"; | ||
static createUserAgent(version) { | ||
return `Jodel/${version} Dalvik/2.1.0 (Linux; U; Android 6.0.1; Nexus 5 Build/MOB30Y)`; | ||
return `Jodel/${version} Dalvik/2.1.0 (Linux; U; Android 6.0.1; Nexus 5 Build/MMB29V)`; | ||
} | ||
@@ -11,0 +11,0 @@ } |
@@ -12,2 +12,3 @@ /// <reference types="node" /> | ||
login(location: Types.Location): Promise<void>; | ||
register(location: Types.Location): Promise<void>; | ||
loginWithToken(accessToken: Types.AccessToken): Promise<void>; | ||
@@ -18,5 +19,5 @@ updateLocation(countryCode: string, lat: number, long: number, accuracy?: number): Promise<Types.LocationUpdateResponse>; | ||
reply(ancestor: Types.PostId, message: string, location: Types.Location): Promise<Types.SendPostResponse>; | ||
getMostPopularPosts(position: Types.Coordinates, after?: Types.PostId): Promise<Types.GetPostsResponse>; | ||
getMostDiscussedPosts(position: Types.Coordinates, after?: Types.PostId): Promise<Types.GetPostsResponse>; | ||
getMostRecentPosts(position: Types.Coordinates, after?: Types.PostId): Promise<Types.GetPostsResponse>; | ||
getMostPopularPosts(position?: Types.Coordinates, after?: Types.PostId): Promise<Types.GetPostsResponse>; | ||
getMostDiscussedPosts(position?: Types.Coordinates, after?: Types.PostId): Promise<Types.GetPostsResponse>; | ||
getMostRecentPosts(position?: Types.Coordinates, after?: Types.PostId): Promise<Types.GetPostsResponse>; | ||
getPost(id: Types.PostId, highlight?: string): Promise<Types.Post>; | ||
@@ -23,0 +24,0 @@ getKarma(): Promise<Types.GetKarmaResponse>; |
@@ -5,5 +5,5 @@ "use strict"; | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments)).next()); | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
@@ -98,6 +98,6 @@ }; | ||
params["after"] = after; | ||
if (position) | ||
if (position) { | ||
params["lat"] = position.lat; | ||
if (position) | ||
params["lng"] = position.lng; | ||
} | ||
return this.get("/v2/posts/location/discussed", params).then(ps => { JodelAPI.fixPosts(ps.posts); return ps; }); | ||
@@ -109,6 +109,6 @@ } | ||
params["after"] = after; | ||
if (position) | ||
if (position) { | ||
params["lat"] = position.lat; | ||
if (position) | ||
params["lng"] = position.lng; | ||
} | ||
return this.get("/v2/posts/location/popular", params).then(ps => { JodelAPI.fixPosts(ps.posts); return ps; }); | ||
@@ -120,6 +120,6 @@ } | ||
params["after"] = after; | ||
if (position) | ||
if (position) { | ||
params["lat"] = position.lat; | ||
if (position) | ||
params["lng"] = position.lng; | ||
} | ||
return this.get("/v2/posts/location/", params).then(ps => { JodelAPI.fixPosts(ps.posts); return ps; }); | ||
@@ -274,2 +274,5 @@ } | ||
login(location) { | ||
return this.register(location); | ||
} | ||
register(location) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -276,0 +279,0 @@ const authRes = yield this.api.getRequestToken({ |
"use strict"; | ||
var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments)).next()); | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
@@ -25,8 +33,5 @@ }; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const newHeaders = {}; | ||
Object.assign(newHeaders, headers); | ||
const newHeaders = __assign({}, headers); | ||
const authHeader = newHeaders["Authorization"]; | ||
const auth = authHeader ? authHeader.split(" ")[1] : ""; | ||
if (!path.endsWith("/")) | ||
path += "/"; | ||
const timestampISO = timestamp.toISOString().replace(/\.\d+Z/, "Z"); | ||
@@ -48,3 +53,3 @@ const messageArr = [ | ||
newHeaders["X-Timestamp"] = timestampISO; | ||
newHeaders["X-Authorization"] = `HMAC ${signature.toLocaleUpperCase()}`; | ||
newHeaders["X-Authorization"] = "HMAC " + signature.toUpperCase(); | ||
return newHeaders; | ||
@@ -59,3 +64,3 @@ }); | ||
if (signature && signature instanceof Buffer) | ||
return resolve(signature.toString("hex")); | ||
return resolve(signature.toString("hex").toUpperCase()); | ||
return reject("No buffer :("); | ||
@@ -62,0 +67,0 @@ }); |
{ | ||
"name": "jodel-api", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Node.js Jodel API", | ||
@@ -5,0 +5,0 @@ "main": "./dist/lib.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67508
850