@@ -21,7 +21,6 @@ local MC = setmetatable({}, {
2121local token_cache = nil
2222local unsaved_token_cache = {}
2323local function load_tokens ()
24- log .info (' load_tokens ...' )
2524 if token_cache then
2625 return token_cache
2726 end
6362--- Get the github token using device flow
6463--- @return string
6564local function github_device_flow (tag , client_id , scope )
66- log .info (' github_device_flow...' )
6765 local function request_device_code ()
6866 local res = utils .curl_post (' https://' .. MC .config .github_instance_url .. ' /login/device/code' , {
6967 body = {
116114--- Get the github copilot oauth cached token (gu_ token)
117115--- @return string
118116local function get_github_copilot_token (tag )
119- log .info (' get_github_copilot_token...' )
120-
121117 local function config_path ()
122118 local config = vim .fs .normalize (' $XDG_CONFIG_HOME' )
123119 if config and vim .uv .fs_stat (config ) then
@@ -136,23 +132,18 @@ local function get_github_copilot_token(tag)
136132 end
137133 end
138134
139- log .info (' check get_token ...' )
140135 local token = get_token (tag )
141136 if token then
142- log .info (" authentication provided by 'get_token': " .. token )
143137 return token
144138 end
145139
146140 -- loading token from the environment only in GitHub Codespaces
147- log .info (' search in env ...' )
148141 local codespaces = os.getenv (' CODESPACES' )
149142 token = os.getenv (' GITHUB_TOKEN' )
150143 if token and codespaces then
151- log .info (' authentication provided by env GITHUB_TOKEN: ' .. token )
152144 return set_token (tag , token , false )
153145 end
154146
155- log .info (' search in config files...' )
156147 -- loading token from the file
157148 local config_path = config_path ()
158149 if config_path then
@@ -169,7 +160,6 @@ local function get_github_copilot_token(tag)
169160 if parsed_data then
170161 for key , value in pairs (parsed_data ) do
171162 if string.find (key , MC .config .github_instance_url ) and value and value .oauth_token then
172- log .info (' authentication info found in ' + file_path + ' token: ' + value .oauth_token )
173163 return set_token (tag , value .oauth_token , false )
174164 end
175165 end
@@ -233,13 +223,12 @@ end
233223--- @type table<string , CopilotChat.config.providers.Provider>
234224local M = {}
235225
236-
237226M .copilot = {
238- endpoints_api = " " ,
227+ endpoints_api = ' ' ,
239228
240229 get_headers = function ()
241230 local url = ' https://' .. MC .config .github_instance_api_url .. ' /copilot_internal/v2/token'
242- log .debug (" get headers - get " .. url )
231+ log .debug (' get headers - get ' .. url )
243232 local response , err = utils .curl_get (url , {
244233 json_response = true ,
245234 headers = {
0 commit comments