Skip to content

Commit

Permalink
Revert "feat: Add enterprise mode support (#141)"
Browse files Browse the repository at this point in the history
This reverts commit 42f9f19.
  • Loading branch information
fortenforge committed Feb 8, 2024
1 parent 42f9f19 commit 85f195f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 50 deletions.
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ your browser and pasting it into API token request.
- `api`: information about the API server to use:
- `host`: the hostname
- `port`: the port
- `path`: the path prefix to the API server
- `portal_url`: the portal URL to use (for enterprise mode)
- `enterprise_mode`: enable enterprise mode
- `detect_proxy`: enable or disable proxy detection
- `tools`: paths to binaries used by the plugin:

- `uname`: not needed on Windows, defaults given.
Expand Down Expand Up @@ -105,8 +101,6 @@ cmp.setup({
})
```

If you are seeing the `codeium` source as unused in `:CmpStatus`, make sure that `nvim-cmp` setup happens before the `codeium.nvim` setup.

To set a symbol for codeium using lspkind, use the `Codeium` keyword. Example:

```lua
Expand Down
44 changes: 5 additions & 39 deletions lua/codeium/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,7 @@ end
function Server.authenticate()
local attempts = 0
local uuid = io.generate_uuid()
local url = "https://"
.. config.api.host
.. ":"
.. config.api.port
.. "/profile?response_type=token&redirect_uri=vim-show-auth-token&state="
local url = "https://www.codeium.com/profile?response_type=token&redirect_uri=vim-show-auth-token&state="
.. uuid
.. "&scope=openid%20profile%20email&redirect_parameters_type=query"

Expand All @@ -81,17 +77,7 @@ function Server.authenticate()
return
end

local endpoint = "https://api.codeium.com/register_user/"

if config.options.enterprise_mode then
endpoint = "https://" .. config.options.api.host .. ":" .. config.options.api.port
if config.options.api.path then
endpoint = endpoint .. "/" .. config.options.api.path:gsub("^/", "")
end
endpoint = endpoint .. "/exa.seat_management_pb.SeatManagementService/RegisterUser"
end

io.post(endpoint, {
io.post("https://api.codeium.com/register_user/", {
headers = {
accept = "application/json",
},
Expand Down Expand Up @@ -210,13 +196,8 @@ function Server:new()
log.debug(j.pid .. ": " .. v)
end

local api_server_url = "https://"
.. config.options.api.host
.. ":"
.. config.options.api.port
.. (config.options.api.path and "/" .. config.options.api.path:gsub("^/", "") or "")

local job_args = {
local api_server_url = "https://" .. config.options.api.host .. ":" .. config.options.api.port
job = io.job({
update.get_bin_info().bin,
"--api_server_url",
api_server_url,
Expand All @@ -227,22 +208,7 @@ function Server:new()
on_exit = on_exit,
on_stdout = on_output,
on_stderr = on_output,
}

if config.options.api.portal_url then
table.insert(job_args, "--portal_url")
table.insert(job_args, config.options.api.portal_url)
end

if config.options.enterprise_mode then
table.insert(job_args, "--enterprise_mode")
end

if config.options.detect_proxy ~= nil then
table.insert(job_args, "--detect_proxy=" .. tostring(config.options.detect_proxy))
end

local job = io.job(job_args)
})
job:start()

local function start_heartbeat()
Expand Down
4 changes: 0 additions & 4 deletions lua/codeium/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ function M.defaults()
api = {
host = "server.codeium.com",
port = "443",
path = "/",
portal_url = nil,
},
enterprise_mode = nil,
detect_proxy = nil,
tools = {},
wrapper = nil,
}
Expand Down
2 changes: 1 addition & 1 deletion lua/codeium/log.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local p_debug = vim.env.DEBUG_CODEIUM

return require("plenary.log").new({
plugin = "codeium/codeium.log",
plugin = "codeium",
level = p_debug or "info",
})

0 comments on commit 85f195f

Please sign in to comment.