Skip to content

Commit

Permalink
feat: 去掉加解密方法
Browse files Browse the repository at this point in the history
  • Loading branch information
fmdb committed Mar 28, 2024
1 parent b9b0c07 commit 1cb424c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/command/init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def run
refresh_token = ""
expires_in = 7879680
created_at = Time.now.to_i
encrypt_access_token = LUtils.encrypt(self.token, "AZMpxzVxzbo3sFDLRZMpxzVxzbo3sFDZ")
encrypt_access_token = self.token
hash = {"access_token": encrypt_access_token}
hash["token_type"] = "Bearer"
hash["expires_in"] = expires_in
Expand Down
7 changes: 3 additions & 4 deletions lib/lg_pod_plugin/git/gitlab_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ def self.get_gitlab_access_token(uri, user_id)
token_file = db_path.join("access_token.json")
return self.get_gitlab_access_token_input(uri, user_id, nil, nil) unless token_file.exist?
json = JSON.parse(File.read("#{token_file.to_path}"))
encrypt_access_token = json["access_token"]
return self.get_gitlab_access_token_input(uri, user_id, nil, nil) if encrypt_access_token.nil?
access_token = LUtils.decrypt(encrypt_access_token, "AZMpxzVxzbo3sFDLRZMpxzVxzbo3sFDZ")
access_token = json["access_token"]
return self.get_gitlab_access_token_input(uri, user_id, nil, nil) if access_token.nil?
token_vaild = GitLabAPI.request_user_emails(uri.hostname, access_token)
if token_vaild == "invalid token"
FileUtils.rm_rf token_file
return self.get_gitlab_access_token_input(uri, user_id, nil, nil) if encrypt_access_token.nil?
return self.get_gitlab_access_token_input(uri, user_id, nil, nil)
end
user_id = LUserAuthInfo.get_user_id(uri.hostname)
now_time = Time.now.to_i
Expand Down

0 comments on commit 1cb424c

Please sign in to comment.