Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for gitea/forgejo backed #198

Open
nakibrayan3 opened this issue Sep 11, 2024 · 7 comments
Open

Add support for gitea/forgejo backed #198

nakibrayan3 opened this issue Sep 11, 2024 · 7 comments
Labels
enhancement New feature or request

Comments

@nakibrayan3
Copy link

nakibrayan3 commented Sep 11, 2024

this is the only thing holding me back from switching to svelita-cms

@kyoshino
Copy link
Member

As mentioned in the README, we have no plans to support Gitea/Forgejo at this time for performance reasons. Basically, there is no way to get multiple files at once, requiring 100 requests to fetch 100 files, which is a non-starter. We will reconsider it if/when their API improves in the future.

@kyoshino kyoshino closed this as not planned Won't fix, can't repro, duplicate, stale Sep 11, 2024
@oliverpool
Copy link

For anyone interested in implementing it on the Forgejo/Gitea side

The forge would need to expose an API allowing efficient implementation of the BackendService api:

/**
* Backend service.
* @typedef {object} BackendService
* @property {string} name - Service name, e.g. `github`.
* @property {string} label - Service label, e.g. `GitHub`.
* @property {RepositoryInfo} [repository] - Basic repository info. Git and local backends only.
* @property {string} [statusDashboardURL] - URL of status dashboard page of the service. Git
* backends only.
* @property {() => Promise<BackendServiceStatus>} [checkStatus] - Function to check the backend
* service’s status. Git backends only.
* @property {() => RepositoryInfo} [getRepositoryInfo] - Function to get the configured
* repository’s basic information. Git backends only.
* @property {() => void} init - Function to initialize the backend.
* @property {(options: SignInOptions) => Promise<User | void>} signIn - Function to sign in.
* @property {() => Promise<void>} signOut - Function to sign out.
* @property {() => Promise<void>} fetchFiles - Function to fetch files.
* @property {(asset: Asset) => Promise<Blob>} [fetchBlob] - Function to fetch an asset as a Blob.
* Git backends only.
* @property {(changes: FileChange[], options: CommitChangesOptions) =>
* Promise<string | (?File)[] | void>} commitChanges - Function to save file changes, including
* additions and deletions, and return the commit URL (Git backends only) or created/updated files
* (local backend only).
* @property {() => Promise<Response>} [triggerDeployment] - Function to manually trigger a new
* deployment on any connected CI/CD provider. GitHub only.
*/

I think the main challenge would be fetchFiles, which usually calls the common fetchAndParseFiles function, which call the forge-specific fetchFileList function, which must return the whole tree of files (path + sha):

/**
* Fetch the repository’s complete file list, and return it in the canonical format.
* @returns {Promise<BaseFileListItem[]>} File list.
* @see https://docs.gitlab.com/ee/api/graphql/reference/index.html#repositorytree
* @see https://stackoverflow.com/questions/18952935/how-to-get-subfolders-and-files-using-gitlab-api
*/
const fetchFileList = async () => {

@nakibrayan3
Copy link
Author

I wish I had the experience to implement something like this.

@kyoshino
Copy link
Member

kyoshino commented Oct 2, 2024

Well, once Gitea/Forgejo is updated to provide a better API, I’m happy to implement it. I have seen discussions on the Forgejo forum, and oh, @oliverpool has left some comments there 🙂

@kyoshino
Copy link
Member

kyoshino commented Oct 2, 2024

Aside from Forgejo support, Sveltia CMS doesn’t yet support RTL, which is probably what @nakibrayan3 needs. Netlify/Decap CMS has an issue for this since 2019, and it’s also on my todo list, as Sveltia CMS has to offer first-class i18n support 😆 (and my native Japanese was also kinda RTL at some point in history.)

@nakibrayan3
Copy link
Author

Thanks to every one here helping :)

@kyoshino
Copy link
Member

I’ll keep this open for future possibilities. #31 has an interesting idea, btw.

@kyoshino kyoshino reopened this Oct 10, 2024
@kyoshino kyoshino added the enhancement New feature or request label Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants