Support forgejo and gitea

This commit is contained in:
Maximilian Friedersdorff 2024-10-21 14:50:15 +01:00
parent ecc741e424
commit b7959e5c4c

View file

@ -1,5 +1,6 @@
local remote_format = "%s/blob/%s/%s" local remote_format = "%s/blob/%s/%s"
local bb_remote_format = "%s/src/%s/%s" local bb_remote_format = "%s/src/%s/%s"
local forgejo_remote_format = "%s/src/%s/%s"
local utils = require("openingh.utils") local utils = require("openingh.utils")
local M = {} local M = {}
@ -69,6 +70,8 @@ function M.get_file_url(
if string.find(M.repo_url, "bitbucket") then if string.find(M.repo_url, "bitbucket") then
file_page_url = string.format(bb_remote_format, M.repo_url, rev, file_path) file_page_url = string.format(bb_remote_format, M.repo_url, rev, file_path)
elseif string.find(M.repo_url, "forgejo") or string.find(M.repo_url, "gitea") then
file_page_url = string.format(forgejo_remote_format, M.repo_url, rev, file_path)
else else
file_page_url = string.format(remote_format, M.repo_url, rev, file_path) file_page_url = string.format(remote_format, M.repo_url, rev, file_path)
end end