This repository has been archived by the owner on Sep 18, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from death-save:v1.1.4
v1.1.4
- Loading branch information
Showing
16 changed files
with
4,358 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Snowpack dependency directory (https://snowpack.dev/) | ||
web_modules/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
.parcel-cache | ||
|
||
# Next.js build output | ||
.next | ||
out | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and not Next.js | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# public | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port | ||
|
||
# Stores VSCode versions used for testing VSCode extensions | ||
.vscode-test | ||
|
||
# yarn v2 | ||
.yarn/cache | ||
.yarn/unplugged | ||
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* About this module FormApp | ||
* @extends FormApplication | ||
*/ | ||
class PinCushionAboutApp extends FormApplication { | ||
constructor(options={}) { | ||
super(options); | ||
} | ||
|
||
/** | ||
* Call app default options | ||
* @override | ||
*/ | ||
static get defaultOptions() { | ||
return mergeObject(super.defaultOptions, { | ||
id: "pin-cushion-about", | ||
title: `About ${PinCushion.MODULE_TITLE}`, | ||
template: `${PinCushion.PATH}/templates/about.hbs`, | ||
popOut: true, | ||
width: 500, | ||
height: 480 | ||
}); | ||
} | ||
|
||
/** | ||
* Supplies data to the template | ||
*/ | ||
async getData() { | ||
return { | ||
moduleName: PinCushion.MODULE_TITLE, | ||
version: game.modules.get(PinCushion.MODULE_NAME).data.version, | ||
patrons: await this.fetchPatrons() | ||
} | ||
} | ||
|
||
/** | ||
* Fetches a list of Patrons to display on the About page | ||
*/ | ||
async fetchPatrons() { | ||
const jsonPath = `${PinCushion.PATH}/patrons.json`; | ||
const response = await fetch(jsonPath); | ||
if (!response.ok) return null; | ||
|
||
const json = await response.json(); | ||
return json; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
const jsdoc2md = require('jsdoc-to-markdown'); | ||
const { parallel, series } = require('gulp'); | ||
const fs = require('fs'); | ||
const zip = require('gulp-zip'); | ||
const gulp = require('gulp'); | ||
const version = require('./package.json').version; | ||
const fetch = require('node-fetch'); | ||
|
||
function docs(done) { | ||
jsdoc2md.render({ files: ['modules/*.?(m)js', '*.js'], configure: 'jsdoc-conf.json' }) | ||
.then(output => fs.writeFileSync('api.md', output)); | ||
return done(); | ||
} | ||
|
||
async function patrons(done) { | ||
|
||
const patrons = await fetchPatrons(); | ||
const uniquePatrons = patrons.filter((v, i, a) => { | ||
return a.findIndex(t => (t.attributes.full_name === v.attributes.full_name)) === i; | ||
}); | ||
|
||
const activePatrons = uniquePatrons.filter(m => m.attributes.patron_status === "active_patron"); | ||
const patronList = []; | ||
for (let p of activePatrons) { | ||
const nameParts = p.attributes.full_name.split(" "); | ||
const firstName = nameParts[0]; | ||
const lastName = nameParts.length > 1 && nameParts[1].length ? nameParts[1] : ""; | ||
const lastInitial = lastName ? lastName.substr(0,1) : ""; | ||
const name = lastInitial ? `${firstName} ${lastInitial}` : `${firstName}`; | ||
|
||
const patron = { | ||
name | ||
} | ||
|
||
patronList.push(patron); | ||
} | ||
|
||
fs.writeFileSync('patrons.json', JSON.stringify(patronList, null, 4)) | ||
console.log(activePatrons.length); | ||
|
||
return done(); | ||
} | ||
|
||
function build(done) { | ||
gulp.src('module.json') | ||
.pipe(gulp.dest('dist')); | ||
|
||
gulp.src([ | ||
'**/*', | ||
'!dist/**', | ||
'!out/**', | ||
'!jsdoc/**', | ||
'!node_modules/**', | ||
'!.gitignore', | ||
'!gulpfile.js', | ||
'!package.json', | ||
'!package-lock.json' | ||
]) | ||
.pipe(zip(`combat-carousel.zip`)) | ||
.pipe(gulp.dest('dist')); | ||
return done(); | ||
} | ||
|
||
async function fetchPatrons(patrons=[], nextPage=null) { | ||
const accessToken = fs.readFileSync('patreon_key.txt', 'utf-8'); | ||
const campaignId = '5254689'; | ||
const url = `https://www.patreon.com/api/oauth2/v2/campaigns/${campaignId}/members`; | ||
const query = '?fields%5Bmember%5D=full_name,patron_status'; | ||
const pagination = nextPage ? `&page%5Bcursor%5D=${nextPage}` : ''; | ||
|
||
let myHeaders = new fetch.Headers(); | ||
myHeaders.append("Authorization", `Bearer ${accessToken}`); | ||
myHeaders.append("Cookie", "__cfduid=d0ff53e0a0f52232bc3d071e4e41b36f11601349207; patreon_device_id=aa72995a-d296-4e22-8336-fba6580fa49b; __cf_bm=6d8302a7c059da3dc166c9718f7372a386a1911c-1601350627-1800-AXgBmtTqEn83/w2Ka4Mq+ewtUVrvq5+bZppjqM6WDA2ofb1XwF22RNcARQzzHOF2S9K/A2UUeVUnfInGOwqJ6qk="); | ||
|
||
const requestOptions = { | ||
method: 'GET', | ||
headers: myHeaders, | ||
redirect: 'follow' | ||
}; | ||
|
||
const response = await fetch(`${url}${query}${pagination}`, requestOptions); | ||
//console.log(response); | ||
const json = await response.json(); | ||
//console.log(json); | ||
const data = json.data; | ||
//console.log(data); | ||
const responseNextPage = json.meta && json.meta.pagination && json.meta.pagination.cursors ? json.meta.pagination.cursors.next : null; | ||
//console.log(responseNextPage); | ||
//console.log(json.meta); | ||
patrons = patrons.concat(data); | ||
//console.log(patrons); | ||
|
||
if (responseNextPage) { | ||
const nextPatrons = await fetchPatrons(patrons, responseNextPage); | ||
//console.log(nextPatrons); | ||
patrons = patrons.concat(nextPatrons) | ||
} | ||
|
||
console.log(patrons.length); | ||
return patrons; | ||
} | ||
|
||
const chores = parallel(patrons, docs); | ||
|
||
exports.build = build; | ||
exports.docs = docs; | ||
exports.patrons = patrons; | ||
exports.chores = chores; | ||
exports.default = series(chores, build); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"source": { | ||
"includePattern": ".+\\.(m|c)?js(doc|x)?$" | ||
}, | ||
"plugins": [ | ||
"@pixi/jsdoc-template/plugins/es6-fix" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.