mirror of
https://github.com/AmintaCCCP/GithubStarsManager.git
synced 2025-11-25 02:34:54 +08:00
0.1.2
This commit is contained in:
1
dist/assets/index-Q1ssxN3K.css
vendored
1
dist/assets/index-Q1ssxN3K.css
vendored
File diff suppressed because one or more lines are too long
527
dist/assets/index-zzBFbG-r.js
vendored
527
dist/assets/index-zzBFbG-r.js
vendored
File diff suppressed because one or more lines are too long
4
dist/index.html
vendored
4
dist/index.html
vendored
@@ -10,8 +10,8 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
||||
<!-- Material Icons CDN -->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
|
||||
<script type="module" crossorigin src="/assets/index-zzBFbG-r.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-Q1ssxN3K.css">
|
||||
<script type="module" crossorigin src="/assets/index-C4_nDMjb.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-QDhJtCXh.css">
|
||||
</head>
|
||||
<body class="bg-gray-50 dark:bg-gray-900">
|
||||
<div id="root"></div>
|
||||
|
||||
@@ -168,6 +168,10 @@ export const SearchBar: React.FC = () => {
|
||||
aValue = a.name.toLowerCase();
|
||||
bValue = b.name.toLowerCase();
|
||||
break;
|
||||
case 'starred':
|
||||
aValue = a.starred_at ? new Date(a.starred_at).getTime() : 0;
|
||||
bValue = b.starred_at ? new Date(b.starred_at).getTime() : 0;
|
||||
break;
|
||||
default:
|
||||
aValue = new Date(a.updated_at).getTime();
|
||||
bValue = new Date(b.updated_at).getTime();
|
||||
@@ -361,13 +365,14 @@ export const SearchBar: React.FC = () => {
|
||||
<select
|
||||
value={searchFilters.sortBy}
|
||||
onChange={(e) => setSearchFilters({
|
||||
sortBy: e.target.value as 'stars' | 'updated' | 'name' | 'created'
|
||||
sortBy: e.target.value as 'stars' | 'updated' | 'name' | 'starred'
|
||||
})}
|
||||
className="px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white text-sm"
|
||||
>
|
||||
<option value="stars">{t('按星标排序', 'Sort by Stars')}</option>
|
||||
<option value="updated">{t('按更新排序', 'Sort by Updated')}</option>
|
||||
<option value="name">{t('按名称排序', 'Sort by Name')}</option>
|
||||
<option value="starred">{t('按加星时间排序', 'Sort by Starred Time')}</option>
|
||||
</select>
|
||||
<button
|
||||
onClick={() => setSearchFilters({
|
||||
|
||||
@@ -27,7 +27,23 @@ export class GitHubApiService {
|
||||
throw new Error(`GitHub API error: ${response.status} ${response.statusText}`);
|
||||
}
|
||||
|
||||
return response.json();
|
||||
const data = await response.json();
|
||||
|
||||
// 如果是starred repositories的响应,需要处理特殊格式
|
||||
if (endpoint.includes('/user/starred') && Array.isArray(data)) {
|
||||
return data.map((item: any) => {
|
||||
// 如果使用了star+json格式,数据结构会不同
|
||||
if (item.starred_at && item.repo) {
|
||||
return {
|
||||
...item.repo,
|
||||
starred_at: item.starred_at
|
||||
};
|
||||
}
|
||||
return item;
|
||||
}) as T;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
async getCurrentUser(): Promise<GitHubUser> {
|
||||
@@ -36,7 +52,12 @@ export class GitHubApiService {
|
||||
|
||||
async getStarredRepositories(page = 1, perPage = 100): Promise<Repository[]> {
|
||||
const repos = await this.makeRequest<Repository[]>(
|
||||
`/user/starred?page=${page}&per_page=${perPage}&sort=updated`
|
||||
`/user/starred?page=${page}&per_page=${perPage}&sort=updated`,
|
||||
{
|
||||
headers: {
|
||||
'Accept': 'application/vnd.github.star+json'
|
||||
}
|
||||
}
|
||||
);
|
||||
return repos;
|
||||
}
|
||||
|
||||
@@ -6,8 +6,10 @@ export interface Repository {
|
||||
html_url: string;
|
||||
stargazers_count: number;
|
||||
language: string | null;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
pushed_at: string;
|
||||
starred_at?: string; // 新增:加入星标的时间
|
||||
owner: {
|
||||
login: string;
|
||||
avatar_url: string;
|
||||
@@ -89,7 +91,7 @@ export interface SearchFilters {
|
||||
tags: string[];
|
||||
languages: string[];
|
||||
platforms: string[]; // 新增:平台过滤
|
||||
sortBy: 'stars' | 'updated' | 'name' | 'created';
|
||||
sortBy: 'stars' | 'updated' | 'name' | 'starred';
|
||||
sortOrder: 'desc' | 'asc';
|
||||
minStars?: number;
|
||||
maxStars?: number;
|
||||
|
||||
Reference in New Issue
Block a user