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

Easily available custom package server #12

Merged
merged 54 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
a4fbe30
Begin docmenting Elm package server API
changlinli Mar 30, 2024
bbf9ae2
Some more notes on the server API
changlinli Mar 31, 2024
cc519e0
Rename file
changlinli Mar 31, 2024
de77e2a
Rough draft of a web service
changlinli Apr 10, 2024
25e0331
Get all packages endpoint working
changlinli Apr 12, 2024
06fec0b
Get inserts and gets of packages working
changlinli Apr 12, 2024
b2a0c12
Add in sqlar table
changlinli Apr 12, 2024
fd04fef
Get rid of global import statements
changlinli Apr 12, 2024
aa1a838
Change up some documentation notes
changlinli Apr 12, 2024
0ac6b55
Get file uploads working
changlinli Apr 13, 2024
e7e1ee8
Get fully working package persistence
changlinli Apr 15, 2024
1a06dbe
Add sqids
changlinli Apr 15, 2024
4328ff1
Revert "Add sqids"
changlinli Apr 15, 2024
b616573
Finish out core API
changlinli Apr 16, 2024
f14ee6f
Add in dashboard endpoints
changlinli Apr 19, 2024
6f8c484
Finish dashboard get endpoint
changlinli Apr 23, 2024
e417031
Add session tokens
changlinli May 3, 2024
b7f746b
Add login sessions
changlinli May 4, 2024
ecefcc6
Get the compiler compiling
changlinli May 10, 2024
99faa9a
Fix serialization issues
changlinli May 10, 2024
0d16b46
Finish up all major publish code
changlinli May 10, 2024
7a0d8b8
Get things working end-to-end
changlinli May 11, 2024
f6812f8
Undo accidental commit of optimization changes
changlinli May 13, 2024
0cc8798
Round out remaining security edges
changlinli May 14, 2024
2ae2e1b
Frontend commit
changlinli May 15, 2024
8622a61
Add full test that tests the server end to end
changlinli May 15, 2024
8f68d57
Add static files
changlinli May 15, 2024
d95f9a7
Add in latest changes to frontend
changlinli May 16, 2024
2d62fbf
Get frontend finally working for packages
changlinli May 17, 2024
08e229b
Finish out the first rough iteration
changlinli May 19, 2024
5d11d6a
Build custom package server
changlinli May 19, 2024
dd87160
Update release.yaml to also build the package server
changlinli May 19, 2024
a8b3146
Upgrade from GHC 9.2 to 9.4
changlinli May 19, 2024
ea282ef
Add freeze file
changlinli May 19, 2024
3a6e258
Update CUSTOM_PACKAGE_SERVER_REFERENCE_NOTES.md
changlinli May 25, 2024
b57b804
Flesh out more design notes
changlinli May 25, 2024
6a266ba
Change to actual login screen
changlinli May 25, 2024
bca6f8e
Update workflow file to produce binaries
changlinli May 28, 2024
e8703e7
Add python to GitHub actions file
changlinli May 28, 2024
6ee406f
Change to python 3
changlinli May 28, 2024
bccac97
Change to explicit python3 binary
changlinli May 28, 2024
6aa498d
Try to really make sure python3 gets installed
changlinli May 28, 2024
a419c3b
Try using python3-dev instead
changlinli May 28, 2024
9c1f15b
More informative messages for frontend
changlinli May 28, 2024
60c5608
Add npx dependency
changlinli May 28, 2024
8537805
Make sure to add dependencies in latter section
changlinli May 28, 2024
d31f0d7
ls to see what's going on
changlinli May 28, 2024
dfb00bf
Change to top level output
changlinli May 28, 2024
1d4124c
Remove intermediate output
changlinli May 28, 2024
6cf6b1b
Use cabal build instead of install
changlinli May 28, 2024
f6756a9
Add in building of the Elm files for the frontend
changlinli May 28, 2024
a38f3d8
Fix more build configuration
changlinli May 28, 2024
0389684
Fix bug with deletions
changlinli May 28, 2024
8dae97e
Skip initial cabal build
changlinli May 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
More informative messages for frontend
  • Loading branch information
changlinli committed May 28, 2024
commit 9c1f15bf45f9d00e79e3402a5bd6f366862d0cc4
2 changes: 1 addition & 1 deletion custom-package-server/elm-src/frontend/Page/Problem.elm
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ offline file =
[ text "Cannot find "
, code [] [ text file ]
]
, p [] [ text "Are you offline or something?" ]
, p [] [ text "Are you offline or something? If you have just logged in, you may want to refresh this page." ]
]


Expand Down
59 changes: 59 additions & 0 deletions custom-package-server/elm-src/frontend/Page/Search.elm
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,32 @@ viewAllRepositories query repositories = repositories
|> List.map (\repository -> div [] [ h2 [] [ text ("Repository:" ++ (RepositoryId.toString repository.id)) ], viewRepository query repository ])
|> div []

exampleConfigJsonFragment : RepositoryId -> String
exampleConfigJsonFragment repoId =
String.concat
[ "{\n"
, " \"repository-type\": \"package-server-with-personal-zokka-repo-v1.0-package-server-api\",\n"
, " \"repository-url\": \"http://zokka-custom-repos.igneousworkshop.com/api/" ++ RepositoryId.toString repoId ++ "\",\n"
, " \"repository-auth-token\": \"$FULL_TOKEN_VALUE\",\n"
, " \"repository-local-name\": \"$SOME_LOCAL_NAME\",\n"
, "}"
]

exampleConfigJson : String
exampleConfigJson =
"""{
"repositories": [
{
"repository-type": "package-server-with-standard-elm-v0.19-package-server-api",
"repository-url": "https://package.elm-lang.org",
"repository-local-name": "standard-elm-repository"
},
...
$INSERT_YOUR_JSON_FRAGMENT_HERE
],
"single-package-locations": []
}
"""

viewRepository : String -> Entry.Repository -> Html Msg
viewRepository query repository =
Expand All @@ -542,6 +568,39 @@ viewRepository query repository =
div
[]
[ details []
[ summary [] [ span [ style "font-weight" "bold" ] [ text "How to use this repository" ]]
, p
[]
[ text "Add the following JSON fragment to "
, code [] [ text "$ELM_HOME/0.19.1/zokka/custom-package-repository-config.json" ]
, text ". Usually that's the same as "
, code [] [ text "~/.elm/0.19.1/zokka/custom-package-repository-config.json" ]
, text ". "
]
, p
[]
[ pre [] [ text (exampleConfigJsonFragment repository.id) ]
]
, p
[]
[ code [] [ text "$FULL_TOKEN_VALUE" ]
, text " is given to you the first time you ever create an API auth token. You should keep this token stored somewhere safe! For security purposes we don't store tokens on our server and can't show you the full value ever again. "
, code [] [ text "$SOME_LOCAL_NAME" ]
, text " is the name you give to the repository that is used when you call "
, code [] [ text "zokka publish $SOME_LOCAL_NAME" ]
, text " to publish a package to this repository. Note that you can only publish a package if you have a Read/Write API auth token. If you have a Read Only token "
, code [] [ text "zokka make" ]
, text " can pull down packages as necessary from this repository to build a project, but "
, code [] [ text "zokka publish" ]
, text " cannot publish to this repository."
]
, p
[]
[ text "The above fragment is embedded into the configuration file as such (make sure you add a comma before this repository and don't have a comma at the end of the list of repositories!):"
, pre [] [ text exampleConfigJson ]
]
]
, details []
[ summary [] [ span [ style "font-weight" "bold" ] [ text "API Auth Tokens" ]]
, ul [] (List.map viewAuthToken repository.authTokens)
, button
Expand Down