diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..2d14c28 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: Official Support Discord + url: https://discord.gg/wGZYt5fasY + about: Join the Discord for faster help & to chat with other users diff --git a/.github/PULL_REQUEST_TEMPLATE/feature.md b/.github/PULL_REQUEST_TEMPLATE/feature.md new file mode 100644 index 0000000..35b20ba --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/feature.md @@ -0,0 +1,27 @@ +--- +name: feature +about: Add new features or functionality +title: "[FEATURE] Title" +labels: enhancement +assignees: '' +projects: 1 + +--- + +## Checklist + + +- [x] I have read the Contributing Guidelines (coming soon) +- [ ] I acknowledge that any submitted code will be licensed under the [ISC License](https://github.com/tycrek/ass/blob/master/LICENSE) +- [ ] I confirm that submitted code is my own work +- [ ] I have tested the code, and confirm that it works + +## Enviroment + + +- Operating System: +- Node version: +- NPM version: + +## Description + diff --git a/.github/PULL_REQUEST_TEMPLATE/feature.yml b/.github/PULL_REQUEST_TEMPLATE/feature.yml deleted file mode 100644 index 9f1c5bf..0000000 --- a/.github/PULL_REQUEST_TEMPLATE/feature.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: feature -description: "For PR's that add new features or functionality" -title: "[FEATURE] Title" -labels: enhancement -assignees: - - tycrek -projects: 1 -body: - - type: markdown - value: "## Thank you for contributing to ass!" - - type: markdown - value: "Please fill out this form to the best of your ability" - - type: checkboxes - attributes: - label: Checklist - id: checklist - options: - - label: "I have read the Contributing Guidelines (coming soon)" - - label: "I acknowledge that any submitted code will be licensed under the [ISC License](https://github.com/tycrek/ass/blob/master/LICENSE)" - required: true - - type: input - label: Relevant Issue - id: issue - description: "Issue this PR resolves, if applicable" - placeholder: "#123" - - type: textarea - label: Description - description: "Describe your PR in detail" - id: description - validations: - required: true - diff --git a/metrics.js b/metrics.js index c0c0067..e10d14e 100644 --- a/metrics.js +++ b/metrics.js @@ -8,33 +8,40 @@ const TLog = require('@tycrek/log'); const log = new TLog({ level: 'debug', timestamp: { enabled: false } }); module.exports = () => { - const data = fs.readJsonSync(path.join(__dirname, 'data.json')); + const data = require('./data'); const { users } = fs.readJsonSync(path.join(__dirname, 'auth.json')); Object.keys(users).forEach((token) => users[token].count = 0); let totalSize = 0; let oldSize = 0; - Object.values(data).forEach(({ token, size }) => { - try { - totalSize += size; - if (token === undefined) oldSize += size; // skipcq: JS-0127 - else { - if (!users[token].size) users[token].size = 0; - users[token].size += size; - users[token].count++; - } - } catch (ex) { - // Silently handle missing tokens from dev environment -tycrek - } - }); + let d = []; - // Get AWS size - bucketSize() + data.get() + .then((D) => (d = D.map(([, resource]) => resource))) + .then(() => { + console.log(d); + d.forEach(({ token, size }) => { + try { + totalSize += size; + if (token === undefined) oldSize += size; // skipcq: JS-0127 + else { + if (!users[token].size) users[token].size = 0; + users[token].size += size; + users[token].count++; + } + } catch (ex) { + // Silently handle missing tokens from dev environment -tycrek + } + }); + + // Get AWS size + return bucketSize(); + }) .then((s3size) => { log.info('---- Usage metrics ----') .blank() .info('Users', Object.keys(users).length) - .info('Files', Object.keys(data).length) + .info('Files', Object.keys(d).length) .info('S3 size', s3enabled ? s3size : '--') .blank() .info('Total size', formatBytes(totalSize))