fix: admin contribute list + source permission

pull/1395/head
NGPixel 5 years ago
parent c04eea9c2b
commit 91e897ccd9

@ -64,16 +64,16 @@
input(type='image', src='/img/donate_paypal.png', border='0', name='submit', title='PayPal - The safer, easier way to pay online!', alt='Donate with PayPal button')
img(alt='', border='0', src='https://www.paypal.com/en_CA/i/scr/pixel.gif', width='1', height='1')
v-tab-item(:transition='false', :reverse-transition='false')
.body-1.pa-3 {{ $t('admin:contribute.ethereum') }}
.body-2.pa-3 {{ $t('admin:contribute.ethereum') }}
.ml-3
.admin-contribute-ethaddress
strong Ethereum Address
span 0xE1d55C19aE86f6Bcbfb17e7f06aCe96BdBb22Cb5
div: img(src='/img/donate_eth_qr.png')
v-tab-item(:transition='false', :reverse-transition='false')
.body-1.pa-3 {{ $t('admin:contribute.tshirts') }}
.body-2.pa-3 {{ $t('admin:contribute.tshirts') }}
v-card-actions.ml-2
v-btn(outlined, :color='darkMode ? `blue lighten-1` : `primary`', href='https://wikijs.threadless.com', large)
v-btn(outlined, :color='$vuetify.theme.dark ? `blue lighten-1` : `primary`', href='https://wikijs.threadless.com', large)
v-icon(left) mdi-tshirt-crew
span {{ $t('admin:contribute.shop') }}
v-divider.mt-3
@ -93,48 +93,27 @@
li {{ $t('admin:contribute.talkToFriends') }}
i18next(path='admin:contribute.followUsOnTwitter', tag='li')
a(href='https://twitter.com/requarks', target='_blank') Twitter
v-toolbar(color='teal', dense, dark)
.subtitle-1 Sponsors
v-spacer
v-btn(outlined, small, href='https://opencollective.com/wikijs/order/1273') Become a Sponsor
v-list(two-line)
template(v-for='(sponsor, idx) in sponsors')
v-list-item(:key='sponsor.id')
v-list-item-avatar
img(v-if='sponsor.image', :src='sponsor.image')
v-avatar(v-else, color='teal', size='40')
span.white--text.subtitle-1 {{sponsor.name[0].toUpperCase()}}
v-list-item-content
v-list-item-title {{sponsor.name}}
v-list-item-subtitle {{sponsor.description}}
v-list-item-action(v-if='sponsor.twitter')
v-btn(icon, :href='sponsor.twitter', target='_blank')
v-icon mdi-twitter
v-list-item-action(v-if='sponsor.website')
v-btn(icon, :href='sponsor.website', target='_blank')
v-icon(color='grey') mdi-earth
v-divider(v-if='idx < sponsors.length - 1')
v-toolbar(color='blue-grey', dense, dark)
.subtitle-1 Backers
v-spacer
v-btn(outlined, small, href='https://opencollective.com/wikijs/order/1272') Become a Backer
v-list(two-line, dense)
template(v-for='(backer, idx) in backers')
v-list-item(:key='backer.id')
v-list-item-avatar
img(v-if='backer.image', :src='backer.image')
v-avatar(v-else, color='blue-grey', size='40')
span.white--text.subtitle-1 {{backer.name[0].toUpperCase()}}
v-list-item-content
v-list-item-title {{backer.name}}
v-list-item-subtitle {{backer.description}}
v-list-item-action(v-if='backer.twitter')
v-btn(icon, :href='backer.twitter', target='_blank')
v-icon mdi-twitter
v-list-item-action(v-if='backer.website')
v-btn(icon, :href='backer.website', target='_blank')
v-icon(color='grey') mdi-earth
v-divider(v-if='idx < backers.length - 1')
v-toolbar(color='indigo', dense, dark)
.subtitle-1 Sponsors &amp; Backers
v-container.pa-5.grey(fluid, :class='$vuetify.theme.dark ? `darken-3` : `lighten-4`')
v-progress-circular(indeterminate, color='indigo', size='24', width='2', v-if='backers.length < 1')
v-row(dense)
v-col(cols='12', lg='6', xl='4', v-for='(backer, idx) in backers', :key='backer.id')
v-card.grey(flat, :class='$vuetify.theme.dark ? `darken-4` : `lighten-2`')
v-list-item
v-list-item-avatar
img(v-if='backer.avatar', :src='backer.avatar')
v-avatar(v-else, color='blue-grey', size='40')
span.white--text.subtitle-1 {{backer.name[0].toUpperCase()}}
v-list-item-content
v-list-item-title {{backer.name}}
v-list-item-subtitle: .caption Since {{backer.joined | moment('MMMM DD, YYYY')}} on {{backer.source}}
v-list-item-action(v-if='backer.twitter')
v-btn(icon, :href='backer.twitter', target='_blank')
v-icon(color='grey') mdi-twitter
v-list-item-action(v-if='backer.website')
v-btn(icon, :href='backer.website', target='_blank')
v-icon(color='grey') mdi-earth
v-toolbar(color='primary', dense, dark)
.subtitle-1 Special Thanks
v-list(two-line)
@ -211,29 +190,31 @@
</template>
<script>
import _ from 'lodash'
import { get } from 'vuex-pathify'
import groupsQuery from 'gql/admin/contribute/contribute-query-contributors.gql'
import gql from 'graphql-tag'
export default {
data() {
return {
contributors: []
}
},
computed: {
darkMode: get('site/dark'),
sponsors() {
return _.filter(this.contributors, ['tier', 'sponsors'])
},
backers() {
return _.reject(this.contributors, ['tier', 'sponsors'])
backers: []
}
},
apollo: {
contributors: {
query: groupsQuery,
backers: {
query: gql`
{
contribute {
contributors {
id
source
name
joined
website
twitter
avatar
}
}
}
`,
fetchPolicy: 'network-only',
update: (data) => data.contribute.contributors,
watchLoading (isLoading) {

@ -36,7 +36,7 @@
},
"dependencies": {
"@aoberoi/passport-slack": "1.0.5",
"@azure/storage-blob": "12.0.1",
"@azure/storage-blob": "12.0.2",
"@bugsnag/js": "6.5.0",
"@exlinc/keycloak-passport": "1.0.2",
"@root/csr": "0.8.1",
@ -45,10 +45,10 @@
"acme": "3.0.3",
"algoliasearch": "3.35.1",
"apollo-fetch": "0.7.0",
"apollo-server": "2.9.15",
"apollo-server-express": "2.9.15",
"apollo-server": "2.9.16",
"apollo-server-express": "2.9.16",
"auto-load": "3.0.4",
"aws-sdk": "2.596.0",
"aws-sdk": "2.606.0",
"azure-search-client": "3.1.5",
"bcryptjs-then": "1.0.1",
"bluebird": "3.7.2",
@ -64,8 +64,8 @@
"cors": "2.8.5",
"custom-error-instance": "2.1.1",
"dependency-graph": "0.8.1",
"diff": "4.0.1",
"diff2html": "2.12.1",
"diff": "4.0.2",
"diff2html": "3.0.0-master.128204d",
"dotize": "0.3.0",
"elasticsearch6": "npm:@elastic/elasticsearch@6",
"elasticsearch7": "npm:@elastic/elasticsearch@7",
@ -73,7 +73,7 @@
"express": "4.17.1",
"express-brute": "1.0.1",
"express-session": "1.17.0",
"file-type": "12.4.2",
"file-type": "13.1.0",
"filesize": "6.0.1",
"fs-extra": "8.1.0",
"getos": "3.1.1",
@ -84,7 +84,7 @@
"graphql-tools": "4.0.6",
"he": "1.2.0",
"highlight.js": "9.17.1",
"i18next": "19.0.2",
"i18next": "19.0.3",
"i18next-express-middleware": "1.9.1",
"i18next-node-fs-backend": "2.1.3",
"image-size": "0.8.3",
@ -94,7 +94,7 @@
"jsonwebtoken": "8.5.1",
"katex": "0.11.1",
"klaw": "3.0.0",
"knex": "0.20.6",
"knex": "0.20.8",
"lodash": "4.17.15",
"markdown-it": "10.0.0",
"markdown-it-abbr": "1.0.4",
@ -110,14 +110,14 @@
"markdown-it-sup": "1.0.0",
"markdown-it-task-lists": "2.1.1",
"mathjax-node": "2.1.1",
"mime-types": "2.1.25",
"mime-types": "2.1.26",
"moment": "2.24.0",
"moment-timezone": "0.5.27",
"mongodb": "3.4.1",
"mongodb": "3.5.1",
"mssql": "6.0.1",
"multer": "1.4.2",
"mysql2": "2.1.0",
"nanoid": "2.1.8",
"nanoid": "2.1.9",
"node-2fa": "1.1.2",
"node-cache": "5.1.0",
"nodemailer": "6.4.2",
@ -142,9 +142,9 @@
"passport-saml": "1.2.0",
"passport-twitch": "1.0.3",
"pem-jwk": "2.0.0",
"pg": "7.17.0",
"pg": "7.17.1",
"pg-hstore": "2.3.3",
"pg-query-stream": "2.1.2",
"pg-query-stream": "3.0.0",
"pg-tsquery": "8.1.0",
"pug": "2.0.4",
"punycode": "2.1.1",
@ -155,7 +155,7 @@
"request-promise": "4.2.5",
"safe-regex": "2.1.1",
"sanitize-filename": "1.6.3",
"scim-query-filter-parser": "2.0.2",
"scim-query-filter-parser": "2.0.4",
"semver": "7.1.1",
"serve-favicon": "2.5.0",
"simple-git": "1.129.0",
@ -168,26 +168,26 @@
"tar-fs": "2.0.0",
"twemoji": "12.1.4",
"uslug": "1.0.4",
"uuid": "3.3.3",
"uuid": "3.4.0",
"validate.js": "0.13.1",
"winston": "3.2.1",
"xss": "1.0.6",
"yargs": "15.1.0"
},
"devDependencies": {
"@babel/cli": "^7.7.7",
"@babel/core": "^7.7.7",
"@babel/plugin-proposal-class-properties": "^7.7.4",
"@babel/plugin-proposal-decorators": "^7.7.4",
"@babel/plugin-proposal-export-namespace-from": "^7.7.4",
"@babel/plugin-proposal-function-sent": "^7.7.4",
"@babel/plugin-proposal-json-strings": "^7.7.4",
"@babel/plugin-proposal-numeric-separator": "^7.7.4",
"@babel/plugin-proposal-throw-expressions": "^7.7.4",
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
"@babel/plugin-syntax-import-meta": "^7.7.4",
"@babel/polyfill": "^7.7.0",
"@babel/preset-env": "^7.7.7",
"@babel/cli": "^7.8.3",
"@babel/core": "^7.8.3",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-decorators": "^7.8.3",
"@babel/plugin-proposal-export-namespace-from": "^7.8.3",
"@babel/plugin-proposal-function-sent": "^7.8.3",
"@babel/plugin-proposal-json-strings": "^7.8.3",
"@babel/plugin-proposal-numeric-separator": "^7.8.3",
"@babel/plugin-proposal-throw-expressions": "^7.8.3",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-import-meta": "^7.8.3",
"@babel/polyfill": "^7.8.3",
"@babel/preset-env": "^7.8.3",
"@mdi/font": "4.7.95",
"@panter/vue-i18next": "0.15.1",
"@requarks/ckeditor5": "12.4.0-wiki.14",
@ -203,13 +203,13 @@
"apollo-link-persisted-queries": "0.2.2",
"apollo-link-ws": "1.0.19",
"apollo-utilities": "1.3.3",
"autoprefixer": "9.7.3",
"autoprefixer": "9.7.4",
"babel-eslint": "10.0.3",
"babel-jest": "24.9.0",
"babel-loader": "^8.0.6",
"babel-plugin-graphql-tag": "2.5.0",
"babel-plugin-lodash": "3.3.4",
"babel-plugin-prismjs": "1.1.1",
"babel-plugin-prismjs": "2.0.0",
"babel-plugin-transform-imports": "2.0.0",
"cache-loader": "4.1.0",
"chart.js": "2.9.3",
@ -217,8 +217,8 @@
"clipboard": "2.0.4",
"codemirror": "5.50.2",
"copy-webpack-plugin": "5.1.1",
"core-js": "3.6.1",
"css-loader": "3.4.0",
"core-js": "3.6.4",
"css-loader": "3.4.2",
"cssnano": "4.1.10",
"d3": "5.15.0",
"duplicate-package-checker-webpack-plugin": "3.0.0",
@ -226,14 +226,14 @@
"eslint": "6.8.0",
"eslint-config-requarks": "1.0.7",
"eslint-config-standard": "14.1.0",
"eslint-plugin-import": "2.19.1",
"eslint-plugin-import": "2.20.0",
"eslint-plugin-node": "11.0.0",
"eslint-plugin-promise": "4.2.1",
"eslint-plugin-standard": "4.0.1",
"eslint-plugin-vue": "6.1.2",
"fibers": "4.0.2",
"file-loader": "5.0.2",
"filepond": "4.9.3",
"filepond": "4.9.4",
"filepond-plugin-file-validate-type": "1.2.4",
"filesize.js": "2.0.0",
"graphql-persisted-document-loader": "2.0.0",
@ -241,7 +241,7 @@
"hammerjs": "2.0.8",
"html-webpack-plugin": "4.0.0-beta.8",
"html-webpack-pug-plugin": "2.0.0",
"i18next-chained-backend": "2.0.0",
"i18next-chained-backend": "2.0.1",
"i18next-localstorage-backend": "3.0.0",
"i18next-xhr-backend": "3.2.2",
"ignore-loader": "0.1.2",
@ -258,19 +258,19 @@
"postcss-loader": "3.0.0",
"postcss-preset-env": "6.7.0",
"postcss-selector-parser": "6.0.2",
"prismjs": "1.17.1",
"prismjs": "1.19.0",
"pug-lint": "2.6.0",
"pug-loader": "2.4.0",
"pug-plain-loader": "1.0.0",
"raw-loader": "4.0.0",
"resolve-url-loader": "3.1.1",
"sass": "1.24.0",
"sass-loader": "8.0.0",
"sass": "1.25.0",
"sass-loader": "8.0.2",
"sass-resources-loader": "2.0.1",
"script-ext-html-webpack-plugin": "2.1.4",
"simple-progress-webpack-plugin": "1.1.2",
"style-loader": "1.1.2",
"terser": "4.5.0",
"style-loader": "1.1.3",
"terser": "4.6.3",
"twemoji-awesome": "1.0.6",
"url-loader": "3.0.0",
"velocity-animate": "1.5.2",
@ -279,17 +279,17 @@
"vue-apollo": "3.0.2",
"vue-chartjs": "3.5.0",
"vue-clipboards": "1.3.0",
"vue-filepond": "6.0.0",
"vue-filepond": "6.0.2",
"vue-hot-reload-api": "2.3.4",
"vue-loader": "15.8.3",
"vue-moment": "4.1.0",
"vue-router": "3.1.3",
"vue-router": "3.1.5",
"vue-status-indicator": "1.2.1",
"vue-template-compiler": "2.6.11",
"vue2-animate": "2.1.3",
"vuedraggable": "2.23.2",
"vuescroll": "4.14.4",
"vuetify": "2.2.0",
"vuetify": "2.2.4",
"vuetify-loader": "1.4.3",
"vuex": "3.1.2",
"vuex-pathify": "1.4.1",
@ -300,7 +300,7 @@
"webpack-dev-middleware": "3.7.2",
"webpack-hot-middleware": "2.25.0",
"webpack-merge": "4.2.2",
"webpack-subresource-integrity": "1.3.4",
"webpack-subresource-integrity": "1.4.0",
"webpackbar": "4.0.0",
"whatwg-fetch": "3.0.0",
"write-file-webpack-plugin": "4.5.1",

@ -109,7 +109,7 @@ router.get(['/h', '/h/*'], async (req, res, next) => {
_.set(res, 'locals.siteConfig.lang', pageArgs.locale)
if (!WIKI.auth.checkAccess(req.user, ['read:pages'], pageArgs)) {
if (!WIKI.auth.checkAccess(req.user, ['read:history'], pageArgs)) {
_.set(res.locals, 'pageMeta.title', 'Unauthorized')
return res.render('unauthorized', { action: 'history' })
}
@ -182,7 +182,7 @@ router.get(['/s', '/s/*'], async (req, res, next) => {
_.set(res, 'locals.siteConfig.lang', pageArgs.locale)
if (!WIKI.auth.checkAccess(req.user, ['read:pages'], pageArgs)) {
if (!WIKI.auth.checkAccess(req.user, ['read:source'], pageArgs)) {
return res.render('unauthorized', { action: 'source' })
}

@ -1,31 +1,28 @@
const request = require('request-promise')
const _ = require('lodash')
/* global WIKI */
module.exports = {
Query: {
async contribute() { return {} }
},
ContributeQuery: {
async contributors(obj, args, context, info) {
const resp = await request({
uri: 'https://opencollective.com/wikijs/members/all.json',
json: true
})
return _.filter(resp, c => {
return c.role === 'BACKER' && c.totalAmountDonated > 0
}).map(c => ({
company: _.get(c, 'company', '') || '',
currency: _.get(c, 'currency', 'USD') || 'USD',
description: _.get(c, 'description', '') || '',
id: _.get(c, 'MemberId', 0),
image: _.get(c, 'image', '') || '',
name: _.get(c, 'name', 'Anonymous') || '',
profile: _.get(c, 'profile', ''),
tier: _.toLower(_.get(c, 'tier', 'backers')),
totalDonated: Math.ceil(_.get(c, 'totalAmountDonated', 0)),
twitter: _.get(c, 'twitter', '') || '',
website: _.get(c, 'website', '') || ''
}))
try {
const resp = await request({
method: 'POST',
uri: 'https://graph.requarks.io',
json: true,
body: {
query: '{\n sponsors {\n list(kind: BACKER) {\n id\n source\n name\n joined\n website\n twitter\n avatar\n }\n }\n}\n',
variables: {}
}
})
return _.get(resp, 'data.sponsors.list', [])
} catch (err) {
WIKI.logger.warn(err)
}
}
}
}

@ -19,15 +19,11 @@ type ContributeQuery {
# -----------------------------------------------
type ContributeContributor {
company: String!
currency: String!
description: String!
id: Int!
image: String!
id: String!
source: String!
name: String!
profile: String!
tier: String!
totalDonated: Int!
twitter: String!
website: String!
joined: Date!
website: String
twitter: String
avatar: String
}

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save