mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
core: add avatar provider API
This commit is contained in:
1 parent
2db1570d1b
commit
f1f956202f
42 files changed
+122
-80
No files matched your search
@@ -9,7 +9,7 @@ const Xss = require('xss');
|
||||
const { findFileSync } = require('@hydrooj/utils/lib/utils');
|
||||
const markdown = require('./markdown');
|
||||
|
||||
const { misc, buildContent } = global.Hydro.lib;
|
||||
const { misc, buildContent, avatar } = global.Hydro.lib;
|
||||
|
||||
const xss = new Xss.FilterXSS({
|
||||
whiteList: {
|
||||
@@ -187,7 +187,7 @@ env.addGlobal('typeof', (o) => typeof o);
|
||||
env.addGlobal('datetimeSpan', misc.datetimeSpan);
|
||||
env.addGlobal('paginate', misc.paginate);
|
||||
env.addGlobal('size', misc.size);
|
||||
env.addGlobal('gravatar', misc.gravatar);
|
||||
env.addGlobal('avatarUrl', avatar);
|
||||
env.addGlobal('formatSeconds', misc.formatSeconds);
|
||||
env.addGlobal('model', global.Hydro.model);
|
||||
env.addGlobal('ui', global.Hydro.ui);
|
||||
|
||||
@@ -16,7 +16,7 @@ function renderItem(domain) {
|
||||
return tpl`
|
||||
<div class="media">
|
||||
<div class="media__left medium">
|
||||
<img class="small domain-profile-avatar" src="${domain.gravatar}" width="30" height="30">
|
||||
<img class="small domain-profile-avatar" src="${domain.avatarUrl}" width="30" height="30">
|
||||
</div>
|
||||
<div class="media__body medium">
|
||||
<div class="domain-select__name">${domain.name}</div>
|
||||
|
||||
@@ -16,7 +16,7 @@ function renderItem(user) {
|
||||
return tpl`
|
||||
<div class="media">
|
||||
<div class="media__left medium">
|
||||
<img class="small user-profile-avatar" src="${user.gravatar}" width="30" height="30">
|
||||
<img class="small user-profile-avatar" src="${user.avatarUrl}" width="30" height="30">
|
||||
</div>
|
||||
<div class="media__body medium">
|
||||
<div class="user-select__uname">${user.uname}</div>
|
||||
|
||||
@@ -23,7 +23,7 @@ const messagePage = new AutoloadPage('messagePage', () => {
|
||||
console.log('Received message', msg);
|
||||
if (msg.mdoc.flag & FLAG_ALERT) {
|
||||
// Is alert
|
||||
new InfoDialog({
|
||||
new InfoDialog({
|
||||
$body: tpl`
|
||||
<div class="typo">
|
||||
<p>${i18n('Message from {0}:', msg.mdoc.from)}</p>
|
||||
@@ -34,7 +34,7 @@ const messagePage = new AutoloadPage('messagePage', () => {
|
||||
// Is message
|
||||
new Notification({
|
||||
title: msg.udoc.uname,
|
||||
avatar: msg.udoc.gravatar_url,
|
||||
avatar: msg.udoc.avatarUrl,
|
||||
message: msg.mdoc.content,
|
||||
duration: 15000,
|
||||
action: () => window.open(`/home/messages?uid=${msg.udoc._id}`, '_blank'),
|
||||
|
||||
@@ -52,8 +52,8 @@ export default connect(mapStateToProps, null)(class MessagePadDialogueContentCon
|
||||
isSelf={reply.from === UserContext._id}
|
||||
faceUrl={
|
||||
reply.from === UserContext._id
|
||||
? UserContext.gravatar
|
||||
: this.props.item.udoc.gravatar
|
||||
? UserContext.avatarUrl
|
||||
: this.props.item.udoc.avatarUrl
|
||||
}
|
||||
>
|
||||
<div>{reply.content}</div>
|
||||
|
||||
@@ -39,7 +39,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(class MessagePadDial
|
||||
key={dialogue._id}
|
||||
userName={dialogue.udoc.uname}
|
||||
summary={(_.last(dialogue.messages)?.content) || ''}
|
||||
faceUrl={dialogue.udoc.gravatar}
|
||||
faceUrl={dialogue.udoc.avatarUrl}
|
||||
active={dialogue._id === this.props.activeId}
|
||||
onClick={() => this.props.handleClick(dialogue._id)}
|
||||
/>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
{
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"experimentalDecorators": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
|
||||
@@ -34,7 +34,6 @@ __langname: 简体中文
|
||||
'Role {1} already exists in domain {0}.': '域 {0} 中已存在角色 {1}。'
|
||||
'Solved {0} problems, RP: {1} (No. {2})': '解决了 {0} 道题目,RP: {1} (No. {2})'
|
||||
'The value `{1}` of {0} already exists.': '{0} 的值 `{1}` 已经存在。'
|
||||
'We use <a href="https://en.gravatar.com/" target="_blank">Gravatar</a> to present your avatar icon.': '我们使用 <a href="https://cn.gravatar.com/" target="_blank">Gravatar</a> 服务来呈现您的头像。'
|
||||
'Yes': 是
|
||||
"Effects only when Difficulty is not 'Use algorithm calculated'.": 仅当难度不为“使用算法计算”时才起效。
|
||||
"Split by ', '.": 由“, ”或“,”分隔。
|
||||
@@ -317,7 +316,6 @@ Formula blocks: 公式区块
|
||||
fs_upload: 上传文件
|
||||
Gender Visibility: 性别可见性
|
||||
Gender: 性别
|
||||
Gravatar Email: Gravatar Email 地址
|
||||
Hard Deadline: 最终截止时间
|
||||
Hash: 散列
|
||||
Have ALL PERMISSIONS in this domain: 在此域中拥有全部权限
|
||||
|
||||
@@ -194,7 +194,6 @@ Forgot password or username?: 忘記密碼或者使用者名?
|
||||
Formula blocks: 公式區塊
|
||||
Gender Visibility: 性別可見性
|
||||
Gender: 性別
|
||||
Gravatar Email: Gravatar Email 地址
|
||||
Hard Deadline: 最終截止時間
|
||||
Have ALL PERMISSIONS in this domain: 在此域中擁有全部許可權
|
||||
Help: 幫助
|
||||
@@ -538,7 +537,6 @@ Visible to registered users: 對註冊使用者可見
|
||||
Visit: 檢視
|
||||
Vote problem solutions: 為題解投票
|
||||
Vote: 投票
|
||||
We use Gravatar to present your avatar icon.: 我們使用 Gravatar 服務來呈現您的頭像。
|
||||
We will check code similarity after this contest.: 我們會在賽後檢查程式碼相似度。
|
||||
WeChat Visibility: 微信可見性
|
||||
WeChat: 微信
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.6.6",
|
||||
"version": "4.6.7",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "hydro.js",
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<li class="dczcomments__item">
|
||||
<div class="media">
|
||||
<div class="media__left top">
|
||||
<img src="{{ gravatar(handler.user.gravatar, 60) }}" width="60" height="60" class="medium user-profile-avatar">
|
||||
<img src="{{ avatarUrl(handler.user.avatar, 60) }}" width="60" height="60" class="medium user-profile-avatar">
|
||||
</div>
|
||||
<div class="media__body top no-heading">
|
||||
<div class="hasjs--hide">
|
||||
@@ -55,7 +55,7 @@
|
||||
<li class="dczcomments__reply commentbox-container">
|
||||
<div class="media">
|
||||
<div class="media__left top">
|
||||
<img src="{{ gravatar(handler.user.gravatar, 50) }}" width="50" height="50" class="medium user-profile-avatar">
|
||||
<img src="{{ avatarUrl(handler.user.avatar, 50) }}" width="50" height="50" class="medium user-profile-avatar">
|
||||
</div>
|
||||
<div class="media__body top no-heading">
|
||||
<div class="commentbox-placeholder"></div>
|
||||
@@ -72,7 +72,7 @@
|
||||
<li class="dczcomments__item">
|
||||
<div class="media">
|
||||
<div class="media__left top">
|
||||
<img src="{{ gravatar(udoc.gravatar, 60) }}" width="60" height="60" class="medium user-profile-avatar">
|
||||
<img src="{{ avatarUrl(udoc.avatar, 60) }}" width="60" height="60" class="medium user-profile-avatar">
|
||||
</div>
|
||||
<div class="media__body top no-heading">
|
||||
<div class="clearfix">
|
||||
@@ -108,7 +108,7 @@
|
||||
<li class="dczcomments__reply{% if mode_create %} commentbox-container{% endif %}">
|
||||
<div class="media">
|
||||
<div class="media__left top">
|
||||
<img src="{{ gravatar(udoc.gravatar, 50) }}" width="50" height="50" class="medium user-profile-avatar">
|
||||
<img src="{{ avatarUrl(udoc.avatar, 50) }}" width="50" height="50" class="medium user-profile-avatar">
|
||||
</div>
|
||||
<div class="media__body top no-heading">
|
||||
<div class="clearfix">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{% if udoc %}
|
||||
<span class="user-profile-link">
|
||||
{% if avatar %}
|
||||
<img class="small user-profile-avatar v-center" src="{{ gravatar(udoc.gravatar|default('')) }}" width="20" height="20">
|
||||
<img class="small user-profile-avatar v-center" src="{{ avatarUrl(udoc.avatar|default('')) }}" width="20" height="20">
|
||||
{% endif %}
|
||||
<a class="user-profile-name" href="{{ url('user_detail', uid=udoc._id) }}">
|
||||
{% if udoc.displayName %}
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
<div class="section__body">
|
||||
<div class="media sidebar-user-profile">
|
||||
<div class="media__left">
|
||||
<img src="{{ gravatar(udoc.gravatar, 80) }}" width="80" height="80" class="medium user-profile-avatar">
|
||||
<img src="{{ avatarUrl(udoc.avatar, 80) }}" width="80" height="80" class="medium user-profile-avatar">
|
||||
</div>
|
||||
<div class="media__body">
|
||||
<p>
|
||||
|
||||
@@ -36,8 +36,8 @@
|
||||
required:true
|
||||
}) }}
|
||||
{{ form.form_text({
|
||||
label:'Gravatar',
|
||||
name:'gravatar'
|
||||
label:'Avatar',
|
||||
name:'avatar'
|
||||
}) }}
|
||||
<div class="row"><div class="columns">
|
||||
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</div>
|
||||
<div class="section__body typo">
|
||||
<dl class="large horizontal">
|
||||
<dt>{{ _('Gravatar') }}</dt><dd><img src="{{ gravatar(domain.gravatar) }}" width="32" height="32"></dd>
|
||||
<dt>{{ _('Avatar') }}</dt><dd><img src="{{ avatarUrl(domain.avatar) }}" width="32" height="32"></dd>
|
||||
<dt>{{ _('Name') }}</dt><dd>{{ domain.name }}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
{%- for ddoc in ddocs -%}
|
||||
<tr>
|
||||
<td class="col--icon">
|
||||
<img src="{{ gravatar(ddoc.gravatar) }}" width="32" height="32">
|
||||
<img src="{{ avatarUrl(ddoc.avatar, 32) }}" width="32" height="32">
|
||||
</td>
|
||||
<td class="col--name">
|
||||
{{ ddoc['name'] }} ({{ ddoc['_id'] }})
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
</div>
|
||||
<div class="section__body typo">
|
||||
<dl class="large horizontal">
|
||||
<dt>{{ _('Gravatar') }}</dt><dd><img src="{{ gravatar(domain.gravatar) }}" width="32" height="32"></dd>
|
||||
<dt>{{ _('Avatar') }}</dt><dd><img src="{{ avatarUrl(domain.avatar) }}" width="32" height="32"></dd>
|
||||
<dt>{{ _('Name') }}</dt><dd>{{ domain.name }}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<div class="profile-header__content">
|
||||
<div class="media">
|
||||
<div class="media__left">
|
||||
<img src="{{ gravatar(udoc.gravatar, 120) }}" width="120" height="120" class="large user-profile-avatar">
|
||||
<img src="{{ avatarUrl(udoc.avatar, 120) }}" width="120" height="120" class="large user-profile-avatar">
|
||||
</div>
|
||||
<div class="media__body profile-header__main">
|
||||
<h1>
|
||||
|
||||
@@ -10,7 +10,7 @@ const name = process.argv[2];
|
||||
|
||||
const IGNORE_CHECK = ['en'];
|
||||
const IGNORE_MISSING = [
|
||||
'?', 'AC', 'Gravatar', 'ID', 'MD5', 'URL',
|
||||
'?', 'AC', 'ID', 'MD5', 'URL',
|
||||
];
|
||||
const RE_TEMPLATE = /_\(['"]([\s\S])*?['"]\)/gmi;
|
||||
const RE_UI = /i18n\(['"]([\s\S])*?['"](,.*?)?\)/gmi;
|
||||
|
||||
Reference in new issue
Block a user