Merge pull request #38 from tycrek/dev

pull/39/head^2
Josh Moore 3 years ago committed by GitHub
commit 2472bc6d28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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

@ -0,0 +1,27 @@
---
name: feature
about: Add new features or functionality
title: "[FEATURE] Title"
labels: enhancement
assignees: ''
projects: 1
---
## Checklist
<!-- All boxes are required -->
- [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
<!-- Describe your development environment -->
- Operating System:
- Node version:
- NPM version:
## Description
<!-- Describe your PR in detail. Include links to any relevant Issues. -->

@ -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

@ -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))

Loading…
Cancel
Save