jamonholmgren / qub

Qub is a CLI and QB64 web framework for building websites with QBasic. Star this repo!
https://qub.jamon.dev
Other
132 stars 4 forks source link

Better install method #1

Closed coolcoder613eb closed 3 months ago

coolcoder613eb commented 3 months ago

Using alias qub="source <(curl -sSL https://raw.githubusercontent.com/jamonholmgren/qub/main/src/cli.sh)" to install is a terrible idea. Although it allows for automatic updates, it means that it cannot be used without an internet connection, and means executing untrusted commands which could be modified at any time.

jamonholmgren commented 3 months ago

Hey @coolcoder613eb, thanks for the issue and interest in Qub!

This is a fun little side project and of course not meant for anything too serious. With that said, I agree that recommending a somewhat more trustworthy way to run the CLI would be a useful addition to the README / quick start.

I think for most developers it’s probably a fairly intuitive step to go from the curl command (which is similar to the command that homebrew uses to install) to downloading a copy of the script, verifying it, and then running it locally. But I agree that I can provide those steps in the quick start guide.

Let me know how your experience with Qub goes!

coolcoder613eb commented 3 months ago

Also, why is there a source in there? I personally use fish rather than bash, and I'm not sure if it's necessary. I also think you should probably be using QB64PE, as that seems to be maintained.

jamonholmgren commented 3 months ago

The source was so you could run it directly from the output of the curl command. If you have another way that works well, let me know.

Regarding QB64PE, you're probably right. So far this is working fine, but I'll take a look at that next time I work on this.

coolcoder613eb commented 3 months ago

Simply using bash. It would help running it with fish as well.

coolcoder613eb commented 3 months ago

Rereading the README, what difference does it make to me that the web server is written in QBasic? I thought this was something more akin to CGI. Can it be used to write custom interactive sites, like e.g. Flask? Or is it just basically static sites with a bit of templating?

jamonholmgren commented 3 months ago

@coolcoder613eb It's a webserver, router, and a bit of templating, yeah.

The reason for building Qub was mostly just the challenge, "Can I write my website in QBasic?" I was able to do it, and I put it out into the world for others to also enjoy if they wanted to. It's not really any more complicated than that.

It would be kind of fun to maybe build a templating language that uses QBasic too. Something like this:

DOCTYPE "html"
HTML "en"
  HEAD
    META "utf-8"
    TITLE "Welcome to My Enhanced Home Page"
    LINK "stylesheet", "styles.css"
  HEAD_END
  BODY
    HEADER
      H1 "Welcome to My Enhanced Home Page"
      NAV
        UL
          LI "Home"
          LI "About"
          LI "Contact"
        UL_END
      NAV_END
    HEADER_END
    MAIN
      SECTION "class='intro'", "id='about-us'"
        H2 "About Us"
        P "We are a company dedicated to creating innovative solutions."
      SECTION_END
      SECTION "class='services'", "id='our-services'"
        H2 "Our Services"
        DIV "class='service-item'", "id='web-development'"
          H3 "Web Development"
          P "We create stunning websites."
        DIV_END
        DIV "class='service-item'", "id='mobile-development'"
          H3 "Mobile Development"
          P "We develop user-friendly mobile applications."
        DIV_END
      SECTION_END
    MAIN_END
    FOOTER
      P "Contact us at email@example.com"
    FOOTER_END
  BODY_END
HTML_END
coolcoder613eb commented 3 months ago

@jamonholmgren What about having a qbasic file for each site, something like this:


FUNCTION NOT_FOUND$ (PAGE$,...)
    NOT_FOUND$ = "<html><head><title>"+PAGE$+"</title></head><body>You are in a maze of twisty little pages, all alike.</body></html>"
END FUNCTION

FUNCTION INDEX$ (PAGE$,...)
    INDEX$ = TEMPLATE$("index.html")
END FUNCTION

REGISTER_PAGE("/",INDEX$)
REGISTER_PAGE("/*.html",NOT_FOUND$)
jamonholmgren commented 3 months ago

Yeah that's a cool idea too!