GithubHelp home page GithubHelp logo

anydistro / bxt Goto Github PK

View Code? Open in Web Editor NEW
0.0 4.0 4.0 3.39 MB

Next generation repository maintenance tool (WIP)

License: GNU Affero General Public License v3.0

CMake 1.25% C++ 76.05% C 0.04% Dockerfile 0.82% HTML 0.41% CSS 0.30% TypeScript 20.95% JavaScript 0.18%
alpm linux package-repository

bxt's People

Watchers

 avatar  avatar  avatar

bxt's Issues

Implement CLI-friendly authentication

First time authentication is done with username and password, but the result is set as if the it is a webbrowser action - using a token.

Not all scripting tools are capable of reading the content of a cookiejar or setting the content on subsequent requests - but they can all read and parse the response body.

Credentials should be returned as a json response body which can be immediately understood by the machine.

Please see the examples in #54 (comment)

(from @fhdk)

Add CI/CD pipeline

To streamline the development process, CI (via GitHub Actions) should be added at some point.

Test coverage

Sadly the application lacks any testing which is quite crucial for the application of such size. My initial idea was to cover the application with tests after the first "functional" release when all the architecture details will be stabilized.

The daemon part is written in domain-driven design which should in theory make various testing strategies (e.g. Unit, BDD, etc) not that hard to implement.

Make it possible to continue sync if it's errored out

This is more crucial for the first sync but anyway would be a good feature to have. If synchronization breaks up for some error (e.g. network outage or a list of packages have changed during the sync) it would be cool to make bxt pick up already downloaded packages from the last sync and download only missing ones.

Show progress of long operations

Operations (requests) that take a long time are not indicated in the web ui. Sometimes it makes sense to indicate that operations so user will understand something's happening.

Compare request

Related to #22

When a compare request is posted - the request contains a json body with a list of boxes to compare.

[
  {
    "branch": "unstable",
    "repository": "core",
    "architecture": "x86_64"
  },
  {
    "branch": "testing",
    "repository": "core",
    "architecture": "x86_64"
  }
]

The answer only contains boxes known to the database. A short excerpt

{
    "sections":
    [
        {
            "branch": "unstable",
            "repository": "core",
            "architecture": "x86_64"
        }
    ],
    "compareTable":
    {
        "flex":
        {
            "unstable/core/x86_64":
            {
                "sync": "2.6.4-5"
            }
        },
        "logrotate":
        {
            "unstable/core/x86_64":
            {
                "sync": "3.21.0-2"
            }
        }
    }
}

Is this result to be expected if a requested box does not exist?

Would it be an empty list if none of the boxes exist?

[
  {
    "branch": "stable",
    "repository": "core",
    "architecture": "x86_64"
  },
  {
    "branch": "testing",
    "repository": "core",
    "architecture": "x86_64"
  }
]

That one answered itself 😁

{
    "message": "No compare data found (all sections are empty)",
    "status": "error"
}

Make permissions configurable via UI

Permissions should be implement as a part of users configuration.

The permissions scheme is quite advanced to make it configurable in a fancy way. The easiest way to implement it would be a plain text editing with validation, we can revisit this later.

Migrate to NextJS

The frontend was made using the "Create React App" tool by Facebook which enables an easy first start of the React application. Apparently CRA is not developed anymore and NextJS would be a good alternative. There is a plenty of guides describing the migration process.

Document folders/components

This project follows DDD and for better understanding/developers onboarding it makes sense to describe components it uses and add proper references

Verification endpoint

Verifying a token using /api/verify endpoint returns 401.

The expected result on a valid token

{
  "status": "ok"
}

Already in pool case

We should decide on what we should do if package in pool already exists but it's a different file. Possible solutions:

  1. Ignore, warn user about that
  2. Error out
  3. Overwrite

In my opinion the option 2 is the best one.

Logout on expired token

Right now it doesn't logout and just says that token is expired. Makes sense to have both.

De-hardcode security keys

There are some places in code where hardcoded security keys are used.

.allow_algorithm(jwt::algorithm::hs256 {"secret"})

jwt::algorithm::hs256 {"secret"});

.allow_algorithm(jwt::algorithm::hs256 {"secret"})

Use HTTP methods properly

The user management endpoints is using POST for all actions.

Best practise is to use the relevant verb for the associated action

verb action
POST Create
GET Read
PUT Update
DELETE Delete

Add Delete, Copy and Move package actions

By oversight bxt doesn't have an option to Delete already added packages

It would also be good to have a Copy option that is like Snap but for individual packages and Move for Copy+Delete

Log request

Related to #22

I did a snap from unstable to testing

{
  "source": {
    "branch": "unstable",
    "repository": "core",
    "architecture": "x86_64"
  },
  "target": {
    "branch": "testing",
    "repository": "core",
    "architecture": "x86_64"
  }
}

Getting OK as expected

{
    "status": "ok"
}

Then retry compare thus getting the expected result

{
    "sections":
    [
        {
            "branch": "testing",
            "repository": "core",
            "architecture": "x86_64"
        },
        {
            "branch": "unstable",
            "repository": "core",
            "architecture": "x86_64"
        }
    ],
    "compareTable":
    {
        "lib32-glibc":
        {
            "testing/core/x86_64":
            {
                "sync": "2.39+r52+gf8e4623421-1"
            },
            "unstable/core/x86_64":
            {
                "sync": "2.39+r52+gf8e4623421-1"
            }
        },
        "libsecret":
        {
            "unstable/core/x86_64":
            {
                "sync": "0.21.4-1"
            },
            "testing/core/x86_64":
            {
                "sync": "0.21.4-1"
            }
        },

[....]

Then I pulled the package log - and I was expecting to see the snap I made appear in the log - but the log appears the same - the timestamps are from 11years ago

One example is a linux-firmware-whence where the filename is from May 10. 2024 but the timestamp is quite off

    {
        "id": "df2a78a5-7d42-4849-92b9-ee124cdb7117",
        "time": -1355047995,
        "type": "Add",
        "package":
        {
            "name": "linux-firmware-whence",
            "section":
            {
                "branch": "unstable",
                "repository": "core",
                "architecture": "x86_64"
            },
            "poolEntries":
            {
                "sync":
                {
                    "version": "20240510.b9d2bf23-1",
                    "hasSignature": true
                }
            },
            "preferredLocation": "sync"
        }
    }
 $ date -d @-1355047995
sΓΈn 23 jan 14:46:45 CET 1927
 $ date -d @1355047995
sΓΈn  9 dec 11:13:15 CET 2012

Extend Transaction support

Right now transactions are very limited and in fact every single addition of entity creates a separate underlying LMDB transaction. It's much more preferable to abstract the transaction out and allow application services/repositories to manage them.

Make pool path configurable

Pool path in bxt uses a different structure than BoxIt by default to allow more straightforward way to work with architectures.

old one is:

.
β”œβ”€β”€ overlay-arm
β”œβ”€β”€ overlay
β”œβ”€β”€ sync-arm
└── sync

while the new one is:

.
β”œβ”€β”€ automated
β”‚Β Β  β”œβ”€β”€ aarch64
β”‚Β Β  └── x86_64
β”œβ”€β”€ overlay
β”‚Β Β  β”œβ”€β”€ aarch64
β”‚Β Β  └── x86_64
└── sync
    β”œβ”€β”€ aarch64
    └── x86_64

We might want to make this structure more flexible though to support legacy structure and potentially more. The best solution in my opinion is to put box.pool setting into the box.yml scheme file like this:

branches: [unstable, testing, stable]
repositories:
  [core]:
    architecture: x86_64
    (box.pool):
      template: "/{location}/"

  [core]:
    architecture: aarch64
    (box.pool):
      template: "/{location}-arm/"

Fix/improve logs

Logs are still half-baked

  • Only sync is being logged
  • Logs web page is pretty limited in functionality

Detailed sync progress in UI

Right now sync being a "lengthy operation" shows an indication that it's going on. It would be nice to have a detailed sync info available in a web ui (maybe a full sync log but actually can be just a realtime progression). That's pretty much easily implementable as websockets support this type of work.

CLI version

While web UI is pretty convenient, we might need to have a CLI version for scripting and other use cases when ui is too excessive

Check for disk space before the sync

Right now the sync doesn't check if the device has the required disk space, it would be good to check if we can successfully finish the sync.

Revamp manual uploading/commiting ui

Now the manual uploading ui works very weird and doesn't really do what it means to, i.e. allow to upload multiple packages into different sections. The fix is relatively easy though.

Research possibilities to avoid hand-crafting the DI map

Dependency injection is actually a good way to decouple things but in C++ it requires either some template magic or, as in case with Kangaru framework used in bxt, static mapping. For now it's handcrafted in di.h and it really should not work like that.

Possible solutions:

  1. Research the ability to use Kangaru's autowire feature. It doesn't play nice with abstract services though on which bxt highly relies and is intrusive, e.g. needs injection of function into the classes.
  2. Create a code-generation tool for this using libclang and it's Python bindings.
  3. Switch DI framework to something like boost-di.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.