Skip to content
This repository has been archived by the owner on May 12, 2020. It is now read-only.

Commit

Permalink
resolve confilict
Browse files Browse the repository at this point in the history
  • Loading branch information
lvxianchao committed Jun 7, 2019
2 parents 7988486 6e1e4ab commit 4590569
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 24 deletions.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 2,7 @@

A Chrome browser extension. View starred repositories, organizing stars, searching stars and searching repositories online for Github.

**点击图片观看 Youtube 视频介绍👇**
**[中文说明](https://coderlxc.com/2019/04/14/The-Fucking-Github/) | 点击图片观看 Youtube 视频介绍👇**

[![【自由编码】CE01 - 使用 Chrome 扩展高效管理 Github Stars](https://images.coderlxc.com/blog/vtw0z.jpg)](https://youtu.be/HigSAh31xEc)

Expand Down Expand Up @@ -31,18 31,20 @@ Use [The Fucking Github](<https://chrome.google.com/webstore/detail/the-fucking-

## Install

[Chrome Web Store](<https://chrome.google.com/webstore/detail/the-fucking-github/agajobpbaphiohkbkjigcalebbfmofdo>)
[Chrome Web Store](https://chrome.google.com/webstore/detail/the-fucking-github/agajobpbaphiohkbkjigcalebbfmofdo)

## Usage

After you installed and started The Fucking Github, it will ask for your [Github personal access token](<https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line>), like this.
After you installed and started The Fucking Github, it will ask for your [Github personal access token](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line), like this.

![Github Access Token](https://user-images.githubusercontent.com/22412818/56089555-6d7e3000-5ec7-11e9-9ccb-b342d6eebfe3.png)

If you don't already have one, [create one](<https://github.com/settings/tokens/new?scopes=notifications,user&description=The Fucking Github browser extension>), then copy and paste it into the token textbox in the screen. Note that the minimal scopes that should be granted are `notifications` and `user`.
If you don't already have one, [create one](https://github.com/settings/tokens/new?scopes=repo,notifications,user&description=The Fucking Github browser extension), then copy and paste it into the token text box in the screen. Note that the minimal scopes that should be granted are `repo`, `notifications` and `user`.

![Create the Access Token](https://user-images.githubusercontent.com/22412818/56089654-e5992580-5ec8-11e9-9bc9-7efa33715852.png)
**Warning**

**Nothing else, enjoy it.**
If you have already started using it before version 1.3.1, please delete the TOKEN in use directly at the [personal access tokens page](https://github.com/settings/tokens) and regenerate it. See [#12](https://github.com/lvxianchao/the-fucking-github/issues/13#issuecomment-499945875)

😘 Looking forward to your praise, thank you.
![Create the Access Token](https://user-images.githubusercontent.com/22412818/59117257-e8bc0980-897f-11e9-8830-7bc40d65085a.png)

**Nothing else, enjoy it😘 .**
2 changes: 2 additions & 0 deletions src/js/components/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 427,8 @@
.el-card__body {
padding: 10px 20px;
max-height: 60px;
overflow: hidden;
.logo {
float: left;
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/Followers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 57,7 @@
float: left;
.following-and-followers {
margin-left: 30px;
margin-left: 20px;
}
}
</style>
2 changes: 1 addition & 1 deletion src/js/components/Search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 247,7 @@
// 获取处于各种标签状态的项目数量
starredCount() {
this.tagStatus[0].count = this.starredCount;
this.tagStatus[2].count = db.get('tagsAndRepositories').value().length;
this.tagStatus[2].count = _.uniq(db.get('tagsAndRepositories').map('repositoryId').value()).length;
this.tagStatus[1].count = this.starredCount - this.tagStatus[2].count;
}
}
Expand Down
61 changes: 47 additions & 14 deletions src/js/components/Star.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 5,7 @@
</template>

<script>
import Github from 'github-api';
import axios from 'axios';
export default {
name: "Star",
Expand All @@ -26,27 26,60 @@
star() {
let owner = this.repository.repo.owner.login;
let repo = this.repository.repo.name;
let api = `https://api.github.com/user/starred/${owner}/${repo}`;
let token = db.get('token').value();
let repository = new Github({token: token}).getRepo(owner, repo);
let options = {
headers: {
Authorization: `token ${token}`,
},
};
let message = {
type: 'error',
showClose: true,
dangerouslyUseHTMLString: true,
duration: 0,
message: 'An error has occurred, please check if the Github Access Token authorizes the repo scope. <a target="_blank" href="https://github.com/lvxianchao/the-fucking-github#usage">See here</a>',
};
if (this.isStarred) {
repository.unstar();
axios.delete(api, options).then(response => {
if (response.status === 204) {
this.$message.success('Unstarred success.');
let repositories = db.get('repositories').value();
_.remove(repositories, repository => {
return repository.repo.id === this.repository.repo.id;
});
let repositories = db.get('repositories').value();
_.remove(repositories, repository => {
return repository.repo.id === this.repository.repo.id;
});
db.set('repositories', repositories).write();
db.set('repositories', repositories).write();
this.isStarred = !this.isStarred;
}
}).catch(error => {
// 如果响应 404 应该是 TOKEN 没有 REPO 权限造成的
if (error.response.status === 404) {
this.$message(message);
}
});
} else {
repository.star();
options.headers['Content-Length'] = 0;
axios.put(api, [], options).then(response => {
if (response.status === 204) {
this.$message.success('Starred success.');
let obj = this.repository;
Object.assign(obj, {starred_at: ''});
db.get('repositories').push(obj).write();
}
let obj = this.repository;
Object.assign(obj, {starred_at: ''});
db.get('repositories').push(obj).write();
this.isStarred = !this.isStarred;
this.isStarred = !this.isStarred;
}
}).catch(error => {
// 如果响应 404 应该是 TOKEN 没有 REPO 权限造成的
if (error.response.status === 404) {
this.$message(message);
}
});
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 1,7 @@
{
"manifest_version": 2,
"name": "The Fucking Github",
"version": "1.3.0",
"version": "1.3.1",
"description": "View starred repositories, organizing stars, searching stars for Github.",
"homepage_url": "https://github.com/lvxianchao/the-fucking-github",
"icons": {
Expand Down

0 comments on commit 4590569

Please sign in to comment.