Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions community/team.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The PMC is also responsible for voting on releases of their project, to ensure t
UserData[0].users.map(u => {
return (
<div key={u.name} className="col-xl-3 col-lg-4 col-md-4 col-sm-6 col-12 d-flex mb-4">
<img src={u.avatar} width="48" height="48" className="rounded me-2 lh-normal" />
<img src={u.avatar_local} width="48" height="48" className="rounded me-2 lh-normal" />
<div>
<a href={u.github} target="_blank" className="d-block lh-base">{u.name}</a>
<div className="fs-14 text-secondary">{u.role}</div>
Expand All @@ -40,7 +40,7 @@ Committers have read-write access to the code repository, signed the CLA, and us
UserData[1].users.map(u => {
return (
<div key={u.name} className="col-xl-3 col-lg-4 col-md-4 col-sm-6 col-12 d-flex mb-4">
<img src={u.avatar} width="48" height="48" className="rounded me-2 lh-normal" />
<img src={u.avatar_local} width="48" height="48" className="rounded me-2 lh-normal" />
<div>
<a href={u.github} target="_blank" className="d-block lh-base">{u.name}</a>
<div className="fs-14 text-secondary">{u.role}</div>
Expand Down
63 changes: 62 additions & 1 deletion scripts/contributor.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var path = require('path');
var TeamJson = require('../static/data/team.json');

var outputFile = path.resolve(__dirname, '../static/data/team.json');
var teamAvatarDir = path.resolve(__dirname, '../static/img/team');

// ignore PMC and committers members
var ignoreList = [];
Expand Down Expand Up @@ -94,4 +95,64 @@ function fetchPagedContributors(url, index, page, currentResults) {
});
}

fetchContributors();
saveAvatars('pmc');
saveAvatars('committer');

// 根据 MIME 类型获取文件扩展名
function getExtensionFromMimeType(mimeType) {
var mimeToExtension = {
'image/jpeg': 'jpg',
'image/png': 'png',
'image/gif': 'gif',
'image/webp': 'webp',
'image/svg+xml': 'svg',
};

return mimeToExtension[mimeType] || 'jpg';
}

// save avatars
async function saveAvatars(type) {
const dataType = TeamJson.find((item) => item.type === type);
const users = dataType.users;
for (const user of users) {
try {
const avatarUrl = user.avatar;

const response = await fetch(avatarUrl);
if (!response.ok) {
throw new Error(`Failed to fetch ${avatarUrl}: ${response.statusText}`);
}
const contentType = response.headers.get('content-type');
// According to Content-Type to get extension
const extension = getExtensionFromMimeType(contentType);

const avatarName = `${user.name}.${extension}`;
const savePath = path.join(teamAvatarDir, avatarName);
const arrayBuffer = await response.arrayBuffer();
const buffer = Buffer.from(arrayBuffer);
fs.writeFileSync(savePath, buffer);
// 更新 avatar2 字段为相对路径
user.avatar_local = `/img/team/${avatarName}`;

console.log(`Saved avatar for ${user.name} to ${savePath}`);
} catch (error) {
console.error(`Failed to save avatar for ${user.name}:`, error.message);
}
}
TeamJson = TeamJson.map((item) => {
if (item.type === type) {
return {
...item,
users,
};
}
return item;
});
fs.writeFileSync(outputFile, JSON.stringify(TeamJson, null, 2));
}

saveAvatars('pmc');
saveAvatars('committer');

// fetchContributors();
54 changes: 36 additions & 18 deletions static/data/team.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,85 +7,99 @@
"name": "chrisdutz",
"avatar": "https://avatars.githubusercontent.com/u/651105",
"github": "https://github.com/chrisdutz",
"role": "Mentor"
"role": "Mentor",
"avatar_local": "/img/team/chrisdutz.jpg"
},
{
"name": "fenbox",
"avatar": "https://avatars.githubusercontent.com/u/360618",
"github": "https://github.com/fenbox",
"role": "Developer"
"role": "Developer",
"avatar_local": "/img/team/fenbox.png"
},
{
"name": "jiangbonadia",
"avatar": "https://avatars.githubusercontent.com/u/1227386",
"github": "https://github.com/jiangbonadia",
"role": "DevRel"
"role": "DevRel",
"avatar_local": "/img/team/jiangbonadia.jpg"
},
{
"name": "joyqi",
"avatar": "https://avatars.githubusercontent.com/u/59437",
"github": "https://github.com/joyqi",
"role": "Developer"
"role": "Developer",
"avatar_local": "/img/team/joyqi.png"
},
{
"name": "justinmclean",
"avatar": "https://avatars.githubusercontent.com/u/144504",
"github": "https://github.com/justinmclean",
"role": "Mentor"
"role": "Mentor",
"avatar_local": "/img/team/justinmclean.jpg"
},
{
"name": "kumfo",
"avatar": "https://avatars.githubusercontent.com/u/7692591",
"github": "https://github.com/kumfo",
"role": "Developer"
"role": "Developer",
"avatar_local": "/img/team/kumfo.jpg"
},
{
"name": "LinkinStars",
"avatar": "https://avatars.githubusercontent.com/u/19712692",
"github": "https://github.com/LinkinStars",
"role": "Developer"
"role": "Developer",
"avatar_local": "/img/team/LinkinStars.jpg"
},
{
"name": "mingcheng",
"avatar": "https://avatars.githubusercontent.com/u/21816",
"github": "https://github.com/mingcheng",
"role": "Developer"
"role": "Developer",
"avatar_local": "/img/team/mingcheng.png"
},
{
"name": "PrimmaAnna",
"avatar": "https://avatars.githubusercontent.com/u/131739771",
"github": "https://github.com/PrimmaAnna",
"role": "DevRel"
"role": "DevRel",
"avatar_local": "/img/team/PrimmaAnna.png"
},
{
"name": "robinv8",
"avatar": "https://avatars.githubusercontent.com/u/12277531",
"github": "https://github.com/robinv8",
"role": "Developer"
"role": "Developer",
"avatar_local": "/img/team/robinv8.jpg"
},
{
"name": "shuashuai",
"avatar": "https://avatars.githubusercontent.com/u/30591202",
"github": "https://github.com/shuashuai",
"role": "Developer"
"role": "Developer",
"avatar_local": "/img/team/shuashuai.jpg"
},
{
"name": "sy-records",
"github": "https://github.com/sy-records",
"avatar": "https://avatars.githubusercontent.com/u/33931153?v=4",
"role": "Developer"
"role": "Developer",
"avatar_local": "/img/team/sy-records.jpg"
},
{
"name": "tisonkun",
"avatar": "https://avatars.githubusercontent.com/u/18818196",
"github": "https://github.com/tisonkun",
"role": "Mentor"
"role": "Mentor",
"avatar_local": "/img/team/tisonkun.jpg"
},
{
"name": "WillemJiang",
"avatar": "https://avatars.githubusercontent.com/u/219644",
"github": "https://github.com/WillemJiang",
"role": "Mentor"
"role": "Mentor",
"avatar_local": "/img/team/WillemJiang.jpg"
}
]
},
Expand All @@ -97,25 +111,29 @@
"name": "aichy126",
"avatar": "https://avatars.githubusercontent.com/u/16996097",
"github": "https://github.com/aichy126",
"role": "Developer"
"role": "Developer",
"avatar_local": "/img/team/aichy126.jpg"
},
{
"name": "haitaojarvis",
"avatar": "https://avatars.githubusercontent.com/u/344142",
"github": "https://github.com/haitaojarvis",
"role": "Developer"
"role": "Developer",
"avatar_local": "/img/team/haitaojarvis.jpg"
},
{
"name": "hgaol",
"avatar": "https://avatars.githubusercontent.com/u/11908658?v=4",
"github": "https://github.com/hgaol",
"role": "Developer"
"role": "Developer",
"avatar_local": "/img/team/hgaol.jpg"
},
{
"name": "zahash",
"github": "https://github.com/zahash",
"avatar": "https://avatars.githubusercontent.com/u/36153955?v=4",
"role": "Developer"
"role": "Developer",
"avatar_local": "/img/team/zahash.png"
}
]
},
Expand Down
Binary file added static/img/team/LinkinStars.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/team/PrimmaAnna.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/team/WillemJiang.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/team/aichy126.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/team/chrisdutz.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/team/fenbox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/team/haitaojarvis.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/team/hgaol.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/team/jiangbonadia.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/team/joyqi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/team/justinmclean.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/team/kumfo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/team/mingcheng.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/team/robinv8.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/team/shuashuai.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/team/sy-records.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/team/tisonkun.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/team/zahash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.