hannah-eee/forjero-docs huggingface dataset:
File: docs\user\packages\pub.md

---
title: 'Pub Package Registry'
license: 'Apache-2.0'
origin_url: 'https://github.com/go-gitea/gitea/blob/e865de1e9d65dc09797d165a51c8e705d2a86030/docs/content/usage/packages/pub.en-us.md'
---

Publish [Pub](https://dart.dev/guides/packages) packages for your user or organization.

## Requirements

To work with the Pub package registry, you need to use the tools [dart](https://dart.dev/tools/dart-tool) and/or [flutter](https://docs.flutter.dev/reference/flutter-cli).

The following examples use dart.

## Configuring the package registry

To register the package registry and provide credentials, execute:

```shell
dart pub token add https://forgejo.example.com/api/packages/{owner}/pub
```

| Placeholder | Description               |
| ----------- | ------------------------- |
| `owner`     | The owner of the package. |

You need to provide your [personal access token](../../api-usage/#authentication).

## Publish a package

To publish a package, edit the `pubspec.yaml` and add the following line:

```yaml
publish_to: https://forgejo.example.com/api/packages/{owner}/pub
```

| Placeholder | Description               |
| ----------- | ------------------------- |
| `owner`     | The owner of the package. |

Now you can publish the package by running the following command:

```shell
dart pub publish
```

You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first.

## Install a package

To install a Pub package from the package registry, execute the following command:

```shell
dart pub add {package_name} --hosted-url=https://forgejo.example.com/api/packages/{owner}/pub/
```

| Parameter      | Description               |
| -------------- | ------------------------- |
| `owner`        | The owner of the package. |
| `package_name` | The package name.         |

For example:

```shell
# use latest version
dart pub add mypackage --hosted-url=https://forgejo.example.com/api/packages/testuser/pub/
# specify version
dart pub add mypackage:1.0.8 --hosted-url=https://forgejo.example.com/api/packages/testuser/pub/
```
File: docs\user\packages\pypi.md

---
title: 'PyPI Package Registry'
license: 'Apache-2.0'
origin_url: 'https://github.com/go-gitea/gitea/blob/e865de1e9d65dc09797d165a51c8e705d2a86030/docs/content/usage/packages/pypi.en-us.md'
---

Publish [PyPI](https://pypi.org/) packages for your user or organization.

## Requirements

To work with the PyPI package registry, you need to use the tools [pip](https://pypi.org/project/pip/) to consume and [twine](https://pypi.org/project/twine/) to publish packages.

## Configuring the package registry

To register the package registry you need to edit your local `~/.pypirc` file. Add

```ini
[distutils]
index-servers = forgejo

[forgejo]
repository = https://forgejo.example.com/api/packages/{owner}/pypi
username = {username}
password = {password}
```

| Placeholder | Description                                                                                                                                  |
| ----------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `owner`     | The owner of the package.                                                                                                                    |
| `username`  | Your Forgejo username.                                                                                                                       |
| `password`  | Your Forgejo password. If you are using 2FA or OAuth use a [personal access token](../../api-usage/#authentication) instead of the password. |

## Publish a package

Publish a package by running the following command:

```shell
python3 -m twine upload --repository forgejo /path/to/files/*
```

The package files have the extensions `.tar.gz` and `.whl`.

You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first.

## Install a package

To install a PyPI package from the package registry, execute the following command:

```shell
pip install --index-url https://{username}:{password}@forgejo.example.com/api/packages/{owner}/pypi/simple --no-deps {package_name}
```

| Parameter      | Description                                       |
| -------------- | ------------------------------------------------- |
| `username`     | Your Forgejo username.                            |
| `password`     | Your Forgejo password or a personal access token. |
| `owner`        | The owner of the package.                         |
| `package_name` | The package name.                                 |

For example:

```shell
pip install --index-url https://testuser:password123@forgejo.example.com/api/packages/testuser/pypi/simple --no-deps test_package
```

You can use `--extra-index-url` instead of `--index-url` but that makes you vulnerable to dependency confusion attacks because `pip` checks the official PyPi repository for the package before it checks the specified custom repository. Read the `pip` docs for more information.

## Supported commands

```
pip install
twine upload
```
File: docs\user\packages\rubygems.md

---
title: 'RubyGems Packages Repository'
license: 'Apache-2.0'
origin_url: 'https://github.com/go-gitea/gitea/blob/e865de1e9d65dc09797d165a51c8e705d2a86030/docs/content/usage/packages/rubygems.en-us.md'
---

Publish [RubyGems](https://guides.rubygems.org/) packages for your user or organization.

## Requirements

To work with the RubyGems package registry, you need to use the [gem](https://guides.rubygems.org/command-reference/) command line tool to consume and publish packages.

## Configuring the package registry

To register the package registry edit the `~/.gem/credentials` file and add:

```ini
---
https://forgejo.example.com/api/packages/{owner}/rubygems: Bearer {token}
```

| Parameter | Description                                                    |
| --------- | -------------------------------------------------------------- |
| `owner`   | The owner of the package.                                      |
| `token`   | Your [personal access token](../../api-usage/#authentication). |

For example:

```
---
https://forgejo.example.com/api/packages/testuser/rubygems: Bearer 3bd626f84b01cd26b873931eace1e430a5773cc4
```

## Publish a package

Publish a package by running the following command:

```shell
gem push --host {host} {package_file}
```

| Parameter      | Description                      |
| -------------- | -------------------------------- |
| `host`         | URL to the package registry.     |
| `package_file` | Path to the package `.gem` file. |

For example:

```shell
gem push --host https://forgejo.example.com/api/packages/testuser/rubygems test_package-1.0.0.gem
```

You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first.

## Install a package

To install a package from the package registry you can use [Bundler](https://bundler.io) or `gem`.

### Bundler

Add a new `source` block to your `Gemfile`:

```
source "https://forgejo.example.com/api/packages/{owner}/rubygems" do
  gem "{package_name}"
end
```

| Parameter      | Description               |
| -------------- | ------------------------- |
| `owner`        | The owner of the package. |
| `package_name` | The package name.         |

For example:

```
source "https://forgejo.example.com/api/packages/testuser/rubygems" do
  gem "test_package"
end
```

Afterwards run the following command:

```shell
bundle install
```

### gem

Execute the following command:

```shell
gem install --host https://forgejo.example.com/api/packages/{owner}/rubygems {package_name}
```

| Parameter      | Description               |
| -------------- | ------------------------- |
| `owner`        | The owner of the package. |
| `package_name` | The package name.         |

For example:

```shell
gem install --host https://forgejo.example.com/api/packages/testuser/rubygems test_package
```

## Supported commands

```
gem install
bundle install
gem push
```
File: docs\user\packages\vagrant.md

---
title: 'Vagrant Packages Repository'
license: 'Apache-2.0'
origin_url: 'https://github.com/go-gitea/gitea/blob/e865de1e9d65dc09797d165a51c8e705d2a86030/docs/content/usage/packages/vagrant.en-us.md'
---

Publish [Vagrant](https://www.vagrantup.com/) packages for your user or organization.

## Requirements

To work with the Vagrant package registry, you need [Vagrant](https://www.vagrantup.com/downloads) and a tool to make HTTP requests like `curl`.

## Publish a package

Publish a Vagrant box by performing a HTTP PUT request to the registry:

```
PUT https://forgejo.example.com/api/packages/{owner}/vagrant/{package_name}/{package_version}/{provider}.box
```

| Parameter         | Description                                                                      |
| ----------------- | -------------------------------------------------------------------------------- |
| `owner`           | The owner of the package.                                                        |
| `package_name`    | The package name.                                                                |
| `package_version` | The package version, semver compatible.                                          |
| `provider`        | One of the [supported provider names](https://www.vagrantup.com/docs/providers). |

Example for uploading a Hyper-V box:

```shell
curl --user your_username:your_password_or_token \
     --upload-file path/to/your/vagrant.box \
     https://forgejo.example.com/api/packages/testuser/vagrant/test_system/1.0.0/hyperv.box
```

If you are using 2FA or OAuth, use a personal access token instead of the password.

You cannot publish a box if a box of the same name, version and provider already exists. You must delete the existing package first.

The server responds with the following HTTP Status codes.

| HTTP Status Code  | Meaning                                                           |
| ----------------- | ----------------------------------------------------------------- |
| `201 Created`     | The package has been published.                                   |
| `400 Bad Request` | The package is invalid.                                           |
| `409 Conflict`    | A package with the same combination of parameters exists already. |

## Install a package

To install a box from the package registry, execute the following command:

```shell
vagrant box add "https://forgejo.example.com/api/packages/{owner}/vagrant/{package_name}"
```

| Parameter      | Description               |
| -------------- | ------------------------- |
| `owner`        | The owner of the package. |
| `package_name` | The package name.         |

For example:

```shell
vagrant box add "https://forgejo.example.com/api/packages/testuser/vagrant/test_system"
```

This will install the latest version of the package. To add a specific version, use the `--box-version` parameter.
If the registry is private you can pass your [personal access token](../../api-usage/#authentication) in the `VAGRANT_CLOUD_TOKEN` environment variable.

## Supported commands

```
vagrant box add
```
File: docs\_mermaid\developer\repo-migration-issue-index.md

```mermaid
sequenceDiagram
    participant migrations/migrate.go
    participant github.go
    participant gitea_uploader.go

    migrations/migrate.go->>migrations/migrate.go: migrateRepository(..., downloader, uploader, ...)
    migrations/migrate.go->>github.go: downloader.SupportGetRepoComments()
    github.go-->>migrations/migrate.go: 'true'
    alt opts.Issues - similar for opts.PullRequests
        migrations/migrate.go->>github.go: downloader.GetIssues()
        migrations/migrate.go->>gitea_uploader.go: uploader.CreateIssues()
    end

    alt opts.Comments && supportAllComments
        migrations/migrate.go->>github.go: downloader.GetPullRequests()
        loop i
            migrations/migrate.go->>github.go: downloader.GetAllComments(i, commentBatchSize)
            github.go->>github.go: g.getClient().Issues.ListComments(...)
            alt check if only PRs or Issues should be migrated
                github.go->>github.go: g.filterPRComments(comments) // Case no PRComments should be present
            end
            migrations/migrate.go->>gitea_uploader.go: uploader.CreateComments(comments...)
        end
    end
```
File: docs\_mermaid\developer\threat-analysis\threat-analysis-remote-login-propagation.md

```mermaid
sequenceDiagram
    participant fs as foreign_repository_server
    participant os as our_repository_server

    fs ->> os: post /api/activitypub/repository-id/1/inbox {Like-Activity}
    activate os
    os ->> repository: load "1"
    os ->> os: validate actor id inputs
    activate os
    os ->> FederationInfo: get by Host
    os ->> os: if FederatonInfo not found
    activate os
    os ->> fs: get .well-known/nodeinfo
    os ->> NodeInfoWellKnown: create & validate
    os ->> fs: get api/v1/nodeinfo
    os ->> NodeInfo: create & validate
    os ->> FederationInfo: create
    deactivate os
    os ->> ForgeLike: validate
    deactivate os

    os ->> user: search for user with actor-id
    os ->> os: create user if not found
    activate os
    os ->> fs: get /api/activitypub/user-id/{id from actor}
    os ->> ForgePerson: validate
    os ->> user: create user from ForgePerson
    deactivate os
    os ->> repository: execute star
    os ->> FederationInfo: update latest activity
    os -->> fs: 200 ok
    deactivate os
```

```mermaid
flowchart TD
    A(User) --> |stars a federated repository| B(foreign repository server)
    B --> |Like Activity| C(our repository server)
    C --> |get NodeInfoWellKnown| B
    C --> |get NodeInfo| B
    C --> |get Person Actor| B
    C --> |cache/create federated user locally| D(our database)
    C --> |cache/create NodeInfo locally| D(our database)
    C --> |add star to repo locally| D
```
File: docs\_mermaid\user\actions\open-id-connect-flow.md

```mermaid
sequenceDiagram
    autonumber
    participant Workflow Run
    participant Forgejo
    participant External Platform

    Workflow Run->>Forgejo: Request OIDC ID token
    activate Forgejo
        Forgejo-->>Workflow Run: Generate and return OIDC ID token
    deactivate Forgejo
  Workflow Run->>External Platform: Exchange OIDC ID token for external credentials
    activate External Platform
        External Platform-->>Forgejo: Request OIDC metadata and signing keys
        activate Forgejo
            Forgejo-->>External Platform: Respond with OIDC metadata and signing keys
        deactivate Forgejo
        External Platform-->>External Platform: Verify OIDC ID token signature and claims
        External Platform-->>Workflow Run: Return credentials
    deactivate External Platform
```