Merge branch 'main' of https://git.sagev.space/sage/Pail
This commit is contained in:
commit
d68b13094b
|
@ -1,3 +1,4 @@
|
|||
*.swp
|
||||
*.zip
|
||||
.DS_Store
|
||||
node_modules
|
||||
|
|
7
Makefile
7
Makefile
|
@ -1,5 +1,8 @@
|
|||
all: *.json *.js img/* *.md *.txt
|
||||
zip -r bitbucket-fork-redirect.zip * -x .git/* -x img/screenshot.png -x .gitignore -x Makefile
|
||||
all:
|
||||
zip -r bitbucket-fork-redirect.zip * -x '.git/*' -x 'server/*' -x 'node_modules/*' -x img/screenshot.png -x .gitignore -x Makefile
|
||||
|
||||
lint:
|
||||
npm run lint
|
||||
|
||||
clean:
|
||||
rm *.zip
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
# Pail Bitbucket Extension
|
||||
|
||||
![logo](https://git.sagev.space/sage/Pail/raw/branch/main/img/icon48.png)
|
||||
|
||||
This is a small extension to add a few features to Bitbucket Server:
|
||||
* Filter forks out of search by default
|
||||
* Some simple syntax parsing in backticked comments
|
||||
* Scroll on file headers in the diff viewer to quickly flipped through changed
|
||||
* Scroll on file headers in the diff viewer to quickly flipped through changes
|
||||
* Sort base (unforked) and your own repos to the top of repo search on the dashboard
|
||||
* Click words in the differ to highlight all instances of that word
|
||||
|
||||
Currently only works for Firefox.
|
||||
Currently only works with Firefox.
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 437 KiB |
|
@ -26,7 +26,6 @@
|
|||
"matches": ["*://git.add123.com/*"],
|
||||
"js": [
|
||||
"utils.js",
|
||||
"all-ADD-repos.js",
|
||||
"backtick-comments.js",
|
||||
"csharp-quotes.js",
|
||||
"file-scroll.js",
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"name": "pail",
|
||||
"version": "1.0.0",
|
||||
"description": "An extension with a few convenience features for bitbucket server",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"lint": "make all && addons-linter --self-hosted bitbucket-fork-redirect.zip"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://git.sagev.space/sage/Pail.git"
|
||||
},
|
||||
"author": "Sage Vaillancourt",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"addons-linter": "^6.31.1"
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
target/
|
|
@ -0,0 +1,5 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/server.iml" filepath="$PROJECT_DIR$/.idea/server.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="EMPTY_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,12 @@
|
|||
[package]
|
||||
name = "pail-server"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
chrono = "0.4.38"
|
||||
rocket = { version = "0.5.1", features = ["json"] }
|
||||
regex = "1.10.5"
|
||||
serde = { version = "1.0", features = ["rc", "derive"] }
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,82 @@
|
|||
#[macro_use] extern crate rocket;
|
||||
extern crate chrono;
|
||||
|
||||
use rocket::serde::{Serialize, json::Json};
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
|
||||
use std::fs::{read_dir};
|
||||
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
use rocket::fs::FileServer;
|
||||
|
||||
use regex::Regex;
|
||||
|
||||
const UUID: &'static str = "16f4f9af-ad27-41b7-adae-b0b08bc17b43";
|
||||
const EMAIL: &'static str = "svaillancourt@add123.com";
|
||||
|
||||
#[get("/")]
|
||||
fn index() -> Json<AddonUpdateListing> {
|
||||
let mut result = AddonUpdateListing::new();
|
||||
let addon = Addon {
|
||||
updates: read_dir("public").unwrap()
|
||||
.map(|v| v.unwrap())
|
||||
.map(|v| Listing::from_file_name(v.path().to_str().unwrap()))
|
||||
.collect()
|
||||
};
|
||||
let addon = Rc::new(addon);
|
||||
result.addons.insert(UUID, Rc::clone(&addon));
|
||||
result.addons.insert(EMAIL, addon);
|
||||
|
||||
Json(result)
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(crate = "rocket::serde")]
|
||||
struct AddonUpdateListing {
|
||||
addons: HashMap<&'static str, Rc<Addon>>
|
||||
}
|
||||
|
||||
impl AddonUpdateListing {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
addons: HashMap::new()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(crate = "rocket::serde")]
|
||||
struct Addon {
|
||||
updates: Vec<Listing>
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(crate = "rocket::serde")]
|
||||
struct Listing {
|
||||
version: String,
|
||||
update_link: String
|
||||
}
|
||||
|
||||
impl Listing {
|
||||
pub fn from_file_name(file_name: &str) -> Self {
|
||||
let r = Regex::new(r#"public/([^0-9]+([0-9.]+)\..*)"#).unwrap();
|
||||
let name_match = r.captures(file_name).unwrap();
|
||||
let file_name = name_match.get(1).unwrap().as_str();
|
||||
Self {
|
||||
version: name_match.get(2).unwrap().as_str().to_string(),
|
||||
update_link: format!("https://bb-addon.sagev.space/{file_name}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[launch]
|
||||
fn rocket() -> _ {
|
||||
rocket::build()
|
||||
.mount("/updates.json", routes![index])
|
||||
.mount("/", FileServer::from("public"))
|
||||
}
|
||||
|
Loading…
Reference in New Issue