2021-01-12 16:25

Issues when using with Gitea

I've set up a gitpitch instance on my server which is pointing to my Gitea-instance. When I try to view a presentation with Gitpitch (on my server), it just shows an errormessage saying Presentation 404 - PITCHME.md not found in repo on Gitea. but it is in the repository.

In the panel on the left (in gitpitch) I get all correct information about the repository (url, owner, etc) but when I click on "Slides: PITCHME.md" I get a 404 error on my Gitea instance. Gitpitch redirects me to an url like {gitserver}/{user}/{repo}/blob/master/PITCHME.md. The detailed view of the file is under {gitserver}/{user}/{repo}/src/branch/master/PITCHME.md, I think this could be the issue. (Is this the standard Url scheme github uses?)

After searching a bit, I think the error (returning the wrong url for PITCHME.md) may be in this function.

I'm using the latest stable Gitea, 1.3.0


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • weixin_39886841 weixin_39886841 4月前

    The config part:

    git {
        repo {
            services = [
                    name        = "Gitea"
                    type        = "gitea"
                    site        = "https://git.mowie.cc/"
                    apibase     = "https://git.mowie.cc/api/v1/"
                    // apibase     = "https://try.gitea.io/api/v1/"
                    apitoken    = "xxx"
                    apitokenheader    = "Authorization"
                    rawbase     = "https://git.mowie.cc/"
                    branchdelim = "~"
                    default     = "true"

    (masked token)

    点赞 评论 复制链接分享
  • weixin_39886841 weixin_39886841 4月前

    The Repo I tested with is https://git.mowie.cc/konrad/presentation/

    点赞 评论 复制链接分享
  • weixin_39692245 weixin_39692245 4月前

    It looks like the Gitea Raw API has changed since I implemented the initial integration. I don't remember what version Gitea was at at the time. You can test and hopefully verify a patch by making the following single-line change in the file indicated.

    $ git diff app/com/gitpitch/git/vendors/Gitea.java 
    diff --git a/app/com/gitpitch/git/vendors/Gitea.java b/app/com/gitpitch/git/vendors/Gitea.java
    index 79a1554..501bd2b 100644
    --- a/app/com/gitpitch/git/vendors/Gitea.java
    +++ b/app/com/gitpitch/git/vendors/Gitea.java
    @@ -78,5 +78,5 @@ public class Gitea extends GRSService {
         public static final String TYPE = "gitea";
         private static final String GITEA_REPO_API = "repos/";
    -    private static final String GITEA_RAW = "/raw/";
    +    private static final String GITEA_RAW = "/raw/branch/";

    Just build your server again and re-run your tests. I believe this patch will resolve the 404 issue you reported.

    Once we you can confirm this primary issue has been resolved we can move on to the secondary issue, the failure when opening the PITCHME.md from the side-menu.

    点赞 评论 复制链接分享
  • weixin_39886841 weixin_39886841 4月前

    Yes, works like a charm! Should I submit a PR? Or will you include the changes directly?

    Where is the link in the sidepanel created?

    点赞 评论 复制链接分享
  • weixin_39692245 weixin_39692245 4月前

    That's good, thanks for confirming the patch.

    No, I don't need you to submit a PR. I need to contact the Gitea team to find out if/when they introduced a break change on their API. Then once I understand what happened, I need to decide how to gracefully handle those changes within GitPitch. I'll update this thread once I know more.

    点赞 评论 复制链接分享
  • weixin_39692245 weixin_39692245 4月前

    FYI, I just found the following issue on the Gitea repo. Clearly the Gitea authors have introduced a breaking change on their API as can be verified by their 1.3.0 release notes.

    Now I understand the issue. I need to give it some thought to decide how best to support these incompatible Gitea APIs. I'll update this thread in due course.

    点赞 评论 复制链接分享
  • weixin_39692245 weixin_39692245 4月前

    A full patch has been integrated, f7b28182af615c5a7c281d00c65508e2ee575587, to support the new Gitea 1.3.x API. The GitPitch Wiki has also been updated to reflect changes in support for Gitea, see here.

    can I ask you to please update and test using this latest patch in master and let me know how it goes. This patch should resolve the main problem (opening presentation) and also the problem opening links to the repo, branch, and slides from the side menu. Thanks.

    点赞 评论 复制链接分享
  • weixin_39692245 weixin_39692245 4月前

    Closing issue as resolved.

    点赞 评论 复制链接分享
  • weixin_39692245 weixin_39692245 4月前

    Hi thanks for getting in touch. So the function you found would not be the involved in the 404 outcome so we will need to look elsewhere.

    The first thing I need to know is what your production.conf looks like, specifically the gitpitch.git.repo.services property. This will tell me exactly how your Gitea server is configured for GitPitch. Once I have that information I will have more questions for you. But let's start there.

    点赞 评论 复制链接分享