├── Deploy ├── config │ ├── nginx │ │ └── cert │ │ │ └── .gitignore │ └── jobservice │ │ └── app.conf ├── templates │ ├── db │ │ └── env │ ├── ui │ │ ├── app.conf │ │ └── env │ ├── jobservice │ │ └── env │ └── registry │ │ └── config.yml ├── kubernetes │ ├── dockerfiles │ │ ├── proxy-dockerfile │ │ ├── ui-dockerfile │ │ ├── registry-dockerfile │ │ └── registry-config.yml │ ├── ui-svc.yaml │ ├── mysql-svc.yaml │ ├── registry-svc.yaml │ ├── proxy-svc.yaml │ ├── proxy-rc.yaml │ ├── registry-rc.yaml │ └── mysql-rc.yaml ├── log │ ├── logrotate_docker.conf │ ├── rsyslog_docker.conf │ ├── Dockerfile │ ├── Dockerfile.log.photon │ └── logrotate.conf.photon ├── db │ └── Dockerfile ├── jobservice │ ├── Dockerfile.jobservice.photon │ └── Dockerfile └── ui │ ├── Dockerfile.ui.photon │ └── Dockerfile ├── contrib ├── sdk │ └── harbor-py │ │ ├── harborclient │ │ ├── __init__.py │ │ └── test_harborclient.py │ │ ├── requirements.txt │ │ ├── format_code.sh │ │ ├── uninstall.sh │ │ └── examples │ │ ├── test_harborclient.py │ │ ├── get_statistics.py │ │ ├── get_logs.py │ │ ├── get_users.py │ │ ├── get_projects.py │ │ ├── delete_user.py │ │ ├── promote_as_admin.py │ │ ├── search.py │ │ ├── get_repositories.py │ │ ├── delete_repository.py │ │ ├── get_repository_tags.py │ │ ├── check_project_exist.py │ │ ├── create_project.py │ │ ├── get_project_id_from_name.py │ │ ├── set_project_publicity.py │ │ ├── get_repository_manifests.py │ │ ├── change_password.py │ │ ├── update_user_profile.py │ │ ├── get_top_accessed_repositories.py │ │ └── create_user.py ├── README.md ├── prebuild-install │ └── README.md └── Configure_mirror.md ├── favicon.ico ├── vendor └── github.com │ ├── docker │ ├── distribution │ │ ├── manifest │ │ │ ├── doc.go │ │ │ ├── versioned.go │ │ │ └── schema1 │ │ │ │ └── verify.go │ │ ├── doc.go │ │ ├── coverpkg.sh │ │ ├── registry │ │ │ ├── api │ │ │ │ ├── v2 │ │ │ │ │ └── doc.go │ │ │ │ └── errcode │ │ │ │ │ └── handler.go │ │ │ ├── auth │ │ │ │ └── token │ │ │ │ │ └── stringset.go │ │ │ └── storage │ │ │ │ └── cache │ │ │ │ └── cache.go │ │ ├── Dockerfile │ │ ├── context │ │ │ ├── version.go │ │ │ └── util.go │ │ ├── tags.go │ │ ├── CHANGELOG.md │ │ └── digest │ │ │ └── verifiers.go │ └── libtrust │ │ ├── MAINTAINERS │ │ ├── doc.go │ │ ├── CONTRIBUTING.md │ │ ├── README.md │ │ └── filter.go │ ├── beego │ └── i18n │ │ └── README.md │ ├── Sirupsen │ └── logrus │ │ ├── terminal_bsd.go │ │ ├── terminal_solaris.go │ │ ├── terminal_linux.go │ │ ├── terminal_notwindows.go │ │ ├── doc.go │ │ ├── terminal_windows.go │ │ ├── json_formatter.go │ │ ├── LICENSE │ │ └── hooks.go │ ├── gorilla │ ├── context │ │ └── README.md │ └── mux │ │ ├── context_native.go │ │ └── context_gorilla.go │ ├── astaxie │ └── beego │ │ ├── grace │ │ ├── conn.go │ │ └── listener.go │ │ ├── doc.go │ │ ├── LICENSE │ │ ├── utils │ │ └── caller.go │ │ └── docs.go │ ├── go-sql-driver │ └── mysql │ │ ├── appengine.go │ │ ├── result.go │ │ ├── transaction.go │ │ └── AUTHORS │ └── mqu │ └── openldap │ └── LICENCE.txt ├── docs ├── img │ ├── dataman.png │ ├── dianrong.png │ ├── search.png │ ├── UserMaDai.jpg │ ├── add_member.png │ ├── beegoLogo.png │ ├── new_search.png │ ├── harbor_logo.png │ ├── project_log.png │ ├── slamteclogo.png │ ├── swaggerEditor.png │ ├── browse_project.png │ ├── caicloudLogoWeb.png │ ├── create_project.png │ ├── new_add_member.png │ ├── new_policy_list.png │ ├── new_project_log.png │ ├── renderedSwagger.png │ ├── new_browse_project.png │ ├── new_create_policy.png │ ├── new_create_project.png │ ├── remove_update_member.png │ ├── new_delete_repository.png │ ├── new_manage_destination.png │ ├── new_manage_replication.png │ ├── set_admin_remove_user.png │ ├── new_remove_update_member.png │ └── new_set_admin_remove_user.png ├── image_pulling_chinese_user.md └── prepare-swagger.sh ├── views ├── sections │ ├── script-min-include.htm │ ├── footer-include.htm │ └── footer-content.htm ├── mail.tpl ├── reset-password-mail.tpl ├── layout.htm └── navigation-header.htm ├── migration ├── prepare.sh ├── migration.cfg ├── alembic.sql ├── Dockerfile ├── migration_harbor │ └── script.py.mako └── changelog.md ├── static ├── resources │ ├── img │ │ ├── Step1.png │ │ ├── Step2.png │ │ ├── Step3.png │ │ ├── loading.gif │ │ ├── Harbor_Logo_rec.png │ │ └── magnitude-glass.jpg │ ├── js │ │ ├── components │ │ │ ├── repository │ │ │ │ ├── popup-details.directive.html │ │ │ │ ├── pull-command.directive.html │ │ │ │ └── repository.module.js │ │ │ ├── log │ │ │ │ ├── log.config.js │ │ │ │ └── log.module.js │ │ │ ├── inline-help │ │ │ │ ├── inline-help.module.js │ │ │ │ └── inline-help.directive.html │ │ │ ├── modal-dialog │ │ │ │ └── modal-dialog.module.js │ │ │ ├── search │ │ │ │ ├── search.module.js │ │ │ │ ├── search-input.directive.html │ │ │ │ └── search.directive.html │ │ │ ├── user │ │ │ │ ├── user.module.js │ │ │ │ └── toggle-admin.directive.html │ │ │ ├── dismissable-alerts │ │ │ │ ├── dismissable-alerts.module.js │ │ │ │ └── dismissable-alerts.directive.html │ │ │ ├── element-height │ │ │ │ └── element-height.module.js │ │ │ ├── loading-progress │ │ │ │ └── loading-progress.module.js │ │ │ ├── system-management │ │ │ │ ├── system-management.module.js │ │ │ │ └── system-management.directive.html │ │ │ ├── sign-in │ │ │ │ └── sign-in.module.js │ │ │ ├── summary │ │ │ │ ├── summary.module.js │ │ │ │ └── summary.directive.html │ │ │ ├── validator │ │ │ │ ├── validator.module.js │ │ │ │ └── validator.config.js │ │ │ ├── user-log │ │ │ │ └── user-log.module.js │ │ │ ├── project │ │ │ │ ├── project.module.js │ │ │ │ └── publicity-button.directive.html │ │ │ ├── top-repository │ │ │ │ └── top-repository.module.js │ │ │ ├── optional-menu │ │ │ │ └── optional-menu.module.js │ │ │ ├── project-member │ │ │ │ ├── project-member.module.js │ │ │ │ └── switch-role.directive.html │ │ │ ├── replication │ │ │ │ └── replication.module.js │ │ │ └── details │ │ │ │ └── switch-pane-projects.directive.html │ │ ├── harbor.constants.js │ │ ├── harbor.initialize.js │ │ ├── layout │ │ │ ├── footer │ │ │ │ ├── footer.module.js │ │ │ │ └── footer.controller.js │ │ │ ├── index │ │ │ │ └── index.module.js │ │ │ ├── add-new │ │ │ │ ├── add-new.module.js │ │ │ │ └── add-new.controller.js │ │ │ ├── navigation │ │ │ │ ├── navigation.module.js │ │ │ │ └── navigation-admin-options.directive.html │ │ │ ├── search │ │ │ │ └── search.module.js │ │ │ ├── admin-option │ │ │ │ ├── admin-option.config.js │ │ │ │ └── admin-option.module.js │ │ │ ├── sign-up │ │ │ │ └── sign-up.module.js │ │ │ ├── account-setting │ │ │ │ └── account-setting.module.js │ │ │ ├── change-password │ │ │ │ └── change-password.module.js │ │ │ ├── dashboard │ │ │ │ └── dashboard.module.js │ │ │ ├── header │ │ │ │ └── header.module.js │ │ │ ├── reset-password │ │ │ │ └── reset-password.module.js │ │ │ ├── forgot-password │ │ │ │ └── forgot-password.module.js │ │ │ ├── details │ │ │ │ └── details.module.js │ │ │ └── project │ │ │ │ └── project.module.js │ │ ├── services │ │ │ ├── log │ │ │ │ └── services.log.module.js │ │ │ ├── i18n │ │ │ │ └── services.i18n.module.js │ │ │ ├── project │ │ │ │ ├── services.project.module.js │ │ │ │ ├── services.get-project-by-id.js │ │ │ │ ├── services.stat-project.js │ │ │ │ ├── services.edit-project.js │ │ │ │ └── services.add-project.js │ │ │ ├── user │ │ │ │ ├── services.user.module.js │ │ │ │ ├── services.log-out.js │ │ │ │ ├── services.current-user.js │ │ │ │ ├── services.delete-user.js │ │ │ │ ├── services.list-user.js │ │ │ │ ├── services.send-mail.js │ │ │ │ ├── services.toggle-admin.js │ │ │ │ └── services.user-exist.js │ │ │ ├── search │ │ │ │ ├── services.search.module.js │ │ │ │ └── services.search.js │ │ │ ├── repository │ │ │ │ ├── services.repository.module.js │ │ │ │ └── services.list-tag.js │ │ │ ├── destination │ │ │ │ ├── services.destination.module.js │ │ │ │ ├── services.delete-destination.js │ │ │ │ └── services.list-destination-policy.js │ │ │ ├── project-member │ │ │ │ ├── services.project-member.module.js │ │ │ │ └── services.current-project-member.js │ │ │ ├── replication-job │ │ │ │ └── services.replication-job.module.js │ │ │ └── replication-policy │ │ │ │ └── services.replication-policy.module.js │ │ └── session │ │ │ └── session.module.js │ └── css │ │ ├── account-settings.css │ │ ├── destination.css │ │ ├── search.css │ │ ├── dashboard.css │ │ ├── admin-options.css │ │ └── footer.css ├── vendors │ └── bootstrap-3.3.6 │ │ └── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 ├── package.json └── i18n │ ├── locale_zh-CN.ini │ └── locale_en-US.ini ├── tests ├── hostcfg.sh ├── apitests │ ├── apilib │ │ ├── roleparam.go │ │ ├── role.go │ │ ├── search.go │ │ ├── projecttemp4search.go │ │ ├── harborlogout.go │ │ ├── repositorytemp4search.go │ │ ├── user.go │ │ ├── project.go │ │ ├── repository.go │ │ ├── harlogin.go │ │ └── accesslog.go │ └── hbapisearch_test.go ├── testprepare.sh └── startuptest.go ├── .gitignore ├── controllers ├── index.go ├── search.go ├── project.go ├── dashboard.go ├── adminoption.go ├── accountsetting.go ├── changepassword.go ├── repository.go ├── signup.go ├── addnew.go ├── navigationdetail.go ├── signin.go └── navigationheader.go ├── .github └── ISSUE_TEMPLATE ├── NOTICE ├── models ├── authmodel.go ├── toprepo.go ├── base.go └── role.go ├── utils ├── log │ ├── formatter.go │ └── record.go └── registry │ ├── modifier.go │ ├── manifest.go │ ├── auth │ └── challenge.go │ └── error │ └── error.go ├── jobservice └── router.go ├── job ├── replication │ └── error.go └── scheduler.go ├── AUTHORS ├── service └── utils │ └── utils.go └── auth └── db └── db.go /Deploy/config/nginx/cert/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /contrib/sdk/harbor-py/harborclient/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /contrib/sdk/harbor-py/requirements.txt: -------------------------------------------------------------------------------- 1 | requests>2.2.0 2 | -------------------------------------------------------------------------------- /Deploy/templates/db/env: -------------------------------------------------------------------------------- 1 | MYSQL_ROOT_PASSWORD=$db_password 2 | -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/favicon.ico -------------------------------------------------------------------------------- /vendor/github.com/docker/distribution/manifest/doc.go: -------------------------------------------------------------------------------- 1 | package manifest 2 | -------------------------------------------------------------------------------- /docs/img/dataman.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/docs/img/dataman.png -------------------------------------------------------------------------------- /docs/img/dianrong.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/docs/img/dianrong.png -------------------------------------------------------------------------------- /docs/img/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/docs/img/search.png -------------------------------------------------------------------------------- /docs/img/UserMaDai.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/docs/img/UserMaDai.jpg -------------------------------------------------------------------------------- /docs/img/add_member.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/docs/img/add_member.png -------------------------------------------------------------------------------- /docs/img/beegoLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/docs/img/beegoLogo.png -------------------------------------------------------------------------------- /docs/img/new_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/docs/img/new_search.png -------------------------------------------------------------------------------- /views/sections/script-min-include.htm: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/img/harbor_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/docs/img/harbor_logo.png -------------------------------------------------------------------------------- /docs/img/project_log.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/docs/img/project_log.png -------------------------------------------------------------------------------- /docs/img/slamteclogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/docs/img/slamteclogo.png -------------------------------------------------------------------------------- /docs/img/swaggerEditor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/docs/img/swaggerEditor.png -------------------------------------------------------------------------------- /migration/prepare.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | source ./migration.cfg 3 | source ./alembic.tpl > ./alembic.ini 4 | -------------------------------------------------------------------------------- /Deploy/config/jobservice/app.conf: -------------------------------------------------------------------------------- 1 | appname = jobservice 2 | runmode = dev 3 | 4 | [dev] 5 | httpport = 80 6 | -------------------------------------------------------------------------------- /Deploy/kubernetes/dockerfiles/proxy-dockerfile: -------------------------------------------------------------------------------- 1 | FROM library/nginx:1.9 2 | 3 | ADD ./config/nginx /etc/nginx 4 | -------------------------------------------------------------------------------- /contrib/sdk/harbor-py/harborclient/test_harborclient.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import harborclient 4 | -------------------------------------------------------------------------------- /docs/img/browse_project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/docs/img/browse_project.png -------------------------------------------------------------------------------- /docs/img/caicloudLogoWeb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/docs/img/caicloudLogoWeb.png -------------------------------------------------------------------------------- /docs/img/create_project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/docs/img/create_project.png -------------------------------------------------------------------------------- /docs/img/new_add_member.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/docs/img/new_add_member.png -------------------------------------------------------------------------------- /docs/img/new_policy_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/docs/img/new_policy_list.png -------------------------------------------------------------------------------- /docs/img/new_project_log.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/docs/img/new_project_log.png -------------------------------------------------------------------------------- /docs/img/renderedSwagger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/docs/img/renderedSwagger.png -------------------------------------------------------------------------------- /contrib/sdk/harbor-py/format_code.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -x 4 | 5 | find ./ -name "*.py" |xargs sudo yapf -i 6 | -------------------------------------------------------------------------------- /docs/img/new_browse_project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/docs/img/new_browse_project.png -------------------------------------------------------------------------------- /docs/img/new_create_policy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/docs/img/new_create_policy.png -------------------------------------------------------------------------------- /docs/img/new_create_project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/docs/img/new_create_project.png -------------------------------------------------------------------------------- /migration/migration.cfg: -------------------------------------------------------------------------------- 1 | db_username="root" 2 | db_password="root123" 3 | db_port="3306" 4 | db_name="registry" 5 | -------------------------------------------------------------------------------- /static/resources/img/Step1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/static/resources/img/Step1.png -------------------------------------------------------------------------------- /static/resources/img/Step2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/static/resources/img/Step2.png -------------------------------------------------------------------------------- /static/resources/img/Step3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/static/resources/img/Step3.png -------------------------------------------------------------------------------- /docs/img/remove_update_member.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/docs/img/remove_update_member.png -------------------------------------------------------------------------------- /static/resources/img/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/static/resources/img/loading.gif -------------------------------------------------------------------------------- /docs/img/new_delete_repository.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/docs/img/new_delete_repository.png -------------------------------------------------------------------------------- /docs/img/new_manage_destination.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/docs/img/new_manage_destination.png -------------------------------------------------------------------------------- /docs/img/new_manage_replication.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/docs/img/new_manage_replication.png -------------------------------------------------------------------------------- /docs/img/set_admin_remove_user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/docs/img/set_admin_remove_user.png -------------------------------------------------------------------------------- /docs/img/new_remove_update_member.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/docs/img/new_remove_update_member.png -------------------------------------------------------------------------------- /docs/img/new_set_admin_remove_user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/docs/img/new_set_admin_remove_user.png -------------------------------------------------------------------------------- /static/resources/img/Harbor_Logo_rec.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/static/resources/img/Harbor_Logo_rec.png -------------------------------------------------------------------------------- /static/resources/img/magnitude-glass.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/static/resources/img/magnitude-glass.jpg -------------------------------------------------------------------------------- /contrib/README.md: -------------------------------------------------------------------------------- 1 | The `contrib` directory contains documents, scripts, and other helpful things which are contributed by the community. 2 | -------------------------------------------------------------------------------- /contrib/sdk/harbor-py/uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -x 4 | set -e 5 | 6 | python setup.py install --record files.txt 7 | cat files.txt | xargs rm -rf 8 | -------------------------------------------------------------------------------- /views/mail.tpl: -------------------------------------------------------------------------------- 1 | From: {{.From}} 2 | To: {{.To}} 3 | Subject: {{.Subject}} 4 | MIME-version: 1.0; 5 | Content-Type: text/html; charset="UTF-8" 6 | 7 | {{.Message}} -------------------------------------------------------------------------------- /Deploy/log/logrotate_docker.conf: -------------------------------------------------------------------------------- 1 | # Logrotate configuartion file for docker. 2 | 3 | /var/log/docker/*/*.log { 4 | rotate 100 5 | size 10M 6 | copytruncate 7 | } 8 | -------------------------------------------------------------------------------- /Deploy/kubernetes/dockerfiles/ui-dockerfile: -------------------------------------------------------------------------------- 1 | FROM deploy_ui 2 | 3 | ADD ./config/ui/app.conf /etc/ui/app.conf 4 | ADD ./config/ui/private_key.pem /etc/ui/private_key.pem 5 | -------------------------------------------------------------------------------- /Deploy/db/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mysql:5.6 2 | 3 | WORKDIR /tmp 4 | 5 | ADD registry.sql r.sql 6 | 7 | ADD docker-entrypoint.sh /entrypoint.sh 8 | RUN chmod u+x /entrypoint.sh 9 | -------------------------------------------------------------------------------- /migration/alembic.sql: -------------------------------------------------------------------------------- 1 | use `registry`; 2 | CREATE TABLE IF NOT EXISTS `alembic_version` ( 3 | `version_num` varchar(32) NOT NULL 4 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 5 | -------------------------------------------------------------------------------- /tests/hostcfg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | IP=`ip addr s eth0 |grep "inet "|awk '{print $2}' |awk -F "/" '{print $1}'` 3 | #echo $IP 4 | sudo sed "s/reg.mydomain.com/$IP/" -i Deploy/harbor.cfg 5 | -------------------------------------------------------------------------------- /vendor/github.com/beego/i18n/README.md: -------------------------------------------------------------------------------- 1 | i18n 2 | ==== 3 | 4 | Package i18n is for app Internationalization and Localization. 5 | 6 | [Documentation](http://beego.me/docs/module/i18n.md) -------------------------------------------------------------------------------- /tests/apitests/apilib/roleparam.go: -------------------------------------------------------------------------------- 1 | package HarborAPI 2 | 3 | type RoleParam struct { 4 | Roles []int32 `json:"roles,omitempty"` 5 | UserName string `json:"user_name,omitempty"` 6 | } 7 | -------------------------------------------------------------------------------- /vendor/github.com/docker/libtrust/MAINTAINERS: -------------------------------------------------------------------------------- 1 | Solomon Hykes 2 | Josh Hawn (github: jlhawn) 3 | Derek McGowan (github: dmcgowan) 4 | -------------------------------------------------------------------------------- /static/vendors/bootstrap-3.3.6/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/static/vendors/bootstrap-3.3.6/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /static/vendors/bootstrap-3.3.6/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/static/vendors/bootstrap-3.3.6/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /static/vendors/bootstrap-3.3.6/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/static/vendors/bootstrap-3.3.6/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /static/vendors/bootstrap-3.3.6/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoping378/harbor/master/static/vendors/bootstrap-3.3.6/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /Deploy/kubernetes/ui-svc.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: ui 5 | labels: 6 | name: ui 7 | spec: 8 | ports: 9 | - port: 80 10 | selector: 11 | name: ui 12 | -------------------------------------------------------------------------------- /Deploy/kubernetes/mysql-svc.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: mysql 5 | labels: 6 | name: mysql 7 | spec: 8 | ports: 9 | - port: 3306 10 | selector: 11 | name: mysql 12 | -------------------------------------------------------------------------------- /tests/apitests/apilib/role.go: -------------------------------------------------------------------------------- 1 | package HarborAPI 2 | 3 | type Role struct { 4 | RoleId int32 `json:"role_id,omitempty"` 5 | RoleCode string `json:"role_code,omitempty"` 6 | RoleName string `json:"role_name,omitempty"` 7 | } 8 | -------------------------------------------------------------------------------- /static/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "engines": { 3 | "node": ">= 0.10.0" 4 | }, 5 | "devDependencies": { 6 | "grunt": "~0.4.5", 7 | "grunt-contrib-jshint": "~0.10.0", 8 | "grunt-contrib-watch": "~0.6.1" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /tests/apitests/apilib/search.go: -------------------------------------------------------------------------------- 1 | package HarborAPI 2 | 3 | import () 4 | 5 | type Search struct { 6 | Projects []Project4Search `json:"project,omitempty"` 7 | Repositories []Repository4Search `json:"repository,omitempty"` 8 | } 9 | -------------------------------------------------------------------------------- /Deploy/kubernetes/dockerfiles/registry-dockerfile: -------------------------------------------------------------------------------- 1 | FROM library/registry:2.3.0 2 | 3 | ADD ./config/registry/ /etc/registry/ 4 | ADD ./kubernetes/dockerfiles/registry-config.yml /etc/registry/config.yml 5 | 6 | CMD ["/etc/registry/config.yml"] 7 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/terminal_bsd.go: -------------------------------------------------------------------------------- 1 | // +build darwin freebsd openbsd netbsd dragonfly 2 | 3 | package logrus 4 | 5 | import "syscall" 6 | 7 | const ioctlReadTermios = syscall.TIOCGETA 8 | 9 | type Termios syscall.Termios 10 | -------------------------------------------------------------------------------- /static/resources/js/components/repository/popup-details.directive.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Deploy/jobservice/Dockerfile.jobservice.photon: -------------------------------------------------------------------------------- 1 | FROM library/photon:latest 2 | 3 | RUN mkdir /harbor/ 4 | COPY ./Deploy/jobservice/harbor_jobservice /harbor/ 5 | 6 | RUN chmod u+x /harbor/harbor_jobservice 7 | WORKDIR /harbor/ 8 | ENTRYPOINT ["/harbor/harbor_jobservice"] 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | harbor 2 | Deploy/config/registry/config.yml 3 | Deploy/config/ui/env 4 | Deploy/config/ui/app.conf 5 | Deploy/config/db/env 6 | Deploy/config/jobservice/env 7 | Deploy/ui/harbor_ui 8 | Deploy/jobservice/harbor_jobservice 9 | ui/ui 10 | *.pyc 11 | jobservice/test 12 | -------------------------------------------------------------------------------- /tests/apitests/apilib/projecttemp4search.go: -------------------------------------------------------------------------------- 1 | package HarborAPI 2 | 3 | import () 4 | 5 | type Project4Search struct { 6 | ProjectId int32 `json:"id,omitempty"` 7 | ProjectName string `json:"name,omitempty"` 8 | Public int32 `json:"public,omitempty"` 9 | } 10 | -------------------------------------------------------------------------------- /controllers/index.go: -------------------------------------------------------------------------------- 1 | package controllers 2 | 3 | // IndexController handles request to / 4 | type IndexController struct { 5 | BaseController 6 | } 7 | 8 | // Get renders the index page 9 | func (ic *IndexController) Get() { 10 | ic.Forward("page_title_index", "index.htm") 11 | } 12 | -------------------------------------------------------------------------------- /controllers/search.go: -------------------------------------------------------------------------------- 1 | package controllers 2 | 3 | // SearchController handles request to /search 4 | type SearchController struct { 5 | BaseController 6 | } 7 | 8 | // Get rendlers search bar 9 | func (sc *SearchController) Get() { 10 | sc.Forward("page_title_search", "search.htm") 11 | } 12 | -------------------------------------------------------------------------------- /Deploy/kubernetes/registry-svc.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: registry 5 | labels: 6 | name: registry 7 | spec: 8 | ports: 9 | - name: internal 10 | port: 5000 11 | - name: external 12 | port: 5001 13 | selector: 14 | name: registry 15 | -------------------------------------------------------------------------------- /Deploy/kubernetes/proxy-svc.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: proxy 5 | labels: 6 | name: proxy 7 | spec: 8 | type: LoadBalancer 9 | ports: 10 | - name: http 11 | port: 80 12 | - name: https 13 | port: 443 14 | selector: 15 | name: proxy 16 | -------------------------------------------------------------------------------- /controllers/project.go: -------------------------------------------------------------------------------- 1 | package controllers 2 | 3 | // ProjectController handles requests to /project 4 | type ProjectController struct { 5 | BaseController 6 | } 7 | 8 | // Get renders project page 9 | func (pc *ProjectController) Get() { 10 | pc.Forward("page_title_project", "project.htm") 11 | } 12 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE: -------------------------------------------------------------------------------- 1 | If you are reporting a problem, please make sure the following information are provided: 2 | 1)Version of docker engine and docker-compose 3 | 2)Config files of harbor, you can get them by packaging "Deploy/config" directory 4 | 3)Log files, you can get them by package the /var/log/harbor/ 5 | 6 | -------------------------------------------------------------------------------- /Deploy/log/rsyslog_docker.conf: -------------------------------------------------------------------------------- 1 | # Rsyslog configuration file for docker. 2 | 3 | template(name="DynaFile" type="string" 4 | string="/var/log/docker/%$now%/%syslogtag:R,ERE,0,DFLT:[^[]*--end:secpath-replace%.log" 5 | ) 6 | #if $programname == "docker" then ?DynaFile 7 | if $programname != "rsyslogd" then -?DynaFile 8 | 9 | -------------------------------------------------------------------------------- /contrib/sdk/harbor-py/examples/test_harborclient.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | sys.path.append("../") 5 | 6 | from harborclient import harborclient 7 | 8 | host = "127.0.0.1" 9 | user = "admin" 10 | password = "Harbor12345" 11 | 12 | client = harborclient.HarborClient(host, user, password) 13 | -------------------------------------------------------------------------------- /controllers/dashboard.go: -------------------------------------------------------------------------------- 1 | package controllers 2 | 3 | // DashboardController handles requests to /dashboard 4 | type DashboardController struct { 5 | BaseController 6 | } 7 | 8 | // Get renders the dashboard page 9 | func (dc *DashboardController) Get() { 10 | dc.Forward("page_title_dashboard", "dashboard.htm") 11 | } 12 | -------------------------------------------------------------------------------- /tests/apitests/apilib/harborlogout.go: -------------------------------------------------------------------------------- 1 | // HarborLogout.go 2 | package HarborAPI 3 | 4 | import ( 5 | "net/http" 6 | ) 7 | 8 | func (a HarborAPI) HarborLogout() (int, error) { 9 | 10 | response, err := http.Get(a.basePath + "/logout") 11 | 12 | defer response.Body.Close() 13 | 14 | return response.StatusCode, err 15 | } 16 | -------------------------------------------------------------------------------- /tests/testprepare.sh: -------------------------------------------------------------------------------- 1 | docker pull hello-world 2 | docker pull docker 3 | docker login -u admin -p Harbor12345 127.0.0.1 4 | 5 | docker tag hello-world 127.0.0.1/library/hello-world 6 | docker push 127.0.0.1/library/hello-world 7 | 8 | docker tag docker 127.0.0.1/library/docker 9 | docker push 127.0.0.1/library/docker 10 | 11 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/context/README.md: -------------------------------------------------------------------------------- 1 | context 2 | ======= 3 | [![Build Status](https://travis-ci.org/gorilla/context.png?branch=master)](https://travis-ci.org/gorilla/context) 4 | 5 | gorilla/context is a general purpose registry for global request variables. 6 | 7 | Read the full documentation here: http://www.gorillatoolkit.org/pkg/context 8 | -------------------------------------------------------------------------------- /Deploy/templates/ui/app.conf: -------------------------------------------------------------------------------- 1 | appname = registry 2 | runmode = dev 3 | 4 | [lang] 5 | types = en-US|zh-CN 6 | names = en-US|zh-CN 7 | 8 | [dev] 9 | httpport = 80 10 | 11 | [mail] 12 | host = $email_server 13 | port = $email_server_port 14 | username = $email_username 15 | password = $email_password 16 | from = $email_from 17 | ssl = $email_ssl 18 | -------------------------------------------------------------------------------- /contrib/sdk/harbor-py/examples/get_statistics.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | sys.path.append("../") 5 | 6 | from harborclient import harborclient 7 | 8 | host = "127.0.0.1" 9 | user = "admin" 10 | password = "Harbor12345" 11 | 12 | client = harborclient.HarborClient(host, user, password) 13 | print(client.get_statistics()) 14 | -------------------------------------------------------------------------------- /controllers/adminoption.go: -------------------------------------------------------------------------------- 1 | package controllers 2 | 3 | // AdminOptionController handles requests to /admin_option 4 | type AdminOptionController struct { 5 | BaseController 6 | } 7 | 8 | // Get renders the admin options page 9 | func (aoc *AdminOptionController) Get() { 10 | aoc.Forward("page_title_admin_option", "admin-options.htm") 11 | } 12 | -------------------------------------------------------------------------------- /contrib/sdk/harbor-py/examples/get_logs.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | sys.path.append("../") 5 | 6 | from harborclient import harborclient 7 | 8 | host = "127.0.0.1" 9 | user = "admin" 10 | password = "Harbor12345" 11 | 12 | client = harborclient.HarborClient(host, user, password) 13 | 14 | # Get logs 15 | print(client.get_logs()) 16 | -------------------------------------------------------------------------------- /contrib/sdk/harbor-py/examples/get_users.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | sys.path.append("../") 5 | 6 | from harborclient import harborclient 7 | 8 | host = "127.0.0.1" 9 | user = "admin" 10 | password = "Harbor12345" 11 | 12 | client = harborclient.HarborClient(host, user, password) 13 | 14 | # Get all users 15 | print(client.get_users()) 16 | -------------------------------------------------------------------------------- /tests/apitests/apilib/repositorytemp4search.go: -------------------------------------------------------------------------------- 1 | package HarborAPI 2 | 3 | type Repository4Search struct { 4 | ProjectId int32 `json:"project_id,omitempty"` 5 | ProjectName string `json:"project_name,omitempty"` 6 | ProjectPublic int32 `json:"project_public,omitempty"` 7 | RepoName string `json:"repository_name,omitempty"` 8 | } 9 | 10 | -------------------------------------------------------------------------------- /controllers/accountsetting.go: -------------------------------------------------------------------------------- 1 | package controllers 2 | 3 | // AccountSettingController handles request to /account_setting 4 | type AccountSettingController struct { 5 | BaseController 6 | } 7 | 8 | // Get renders the account settings page 9 | func (asc *AccountSettingController) Get() { 10 | asc.Forward("page_title_account_setting", "account-settings.htm") 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/docker/distribution/doc.go: -------------------------------------------------------------------------------- 1 | // Package distribution will define the interfaces for the components of 2 | // docker distribution. The goal is to allow users to reliably package, ship 3 | // and store content related to docker images. 4 | // 5 | // This is currently a work in progress. More details are available in the 6 | // README.md. 7 | package distribution 8 | -------------------------------------------------------------------------------- /contrib/sdk/harbor-py/examples/get_projects.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | sys.path.append("../") 5 | 6 | from harborclient import harborclient 7 | 8 | host = "127.0.0.1" 9 | user = "admin" 10 | password = "Harbor12345" 11 | 12 | client = harborclient.HarborClient(host, user, password) 13 | 14 | # Get all projects 15 | print(client.get_projects()) 16 | -------------------------------------------------------------------------------- /controllers/changepassword.go: -------------------------------------------------------------------------------- 1 | package controllers 2 | 3 | // ChangePasswordController handles request to /change_password 4 | type ChangePasswordController struct { 5 | BaseController 6 | } 7 | 8 | // Get renders the change password page 9 | func (asc *ChangePasswordController) Get() { 10 | asc.Forward("page_title_change_password", "change-password.htm") 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/terminal_solaris.go: -------------------------------------------------------------------------------- 1 | // +build solaris 2 | 3 | package logrus 4 | 5 | import ( 6 | "os" 7 | 8 | "golang.org/x/sys/unix" 9 | ) 10 | 11 | // IsTerminal returns true if the given file descriptor is a terminal. 12 | func IsTerminal() bool { 13 | _, err := unix.IoctlGetTermios(int(os.Stdout.Fd()), unix.TCGETA) 14 | return err == nil 15 | } 16 | -------------------------------------------------------------------------------- /contrib/sdk/harbor-py/examples/delete_user.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | sys.path.append("../") 5 | 6 | from harborclient import harborclient 7 | 8 | host = "127.0.0.1" 9 | user = "admin" 10 | password = "Harbor12345" 11 | 12 | client = harborclient.HarborClient(host, user, password) 13 | 14 | # Delete user 15 | user_id = 2 16 | print(client.delete_user(user_id)) 17 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/terminal_linux.go: -------------------------------------------------------------------------------- 1 | // Based on ssh/terminal: 2 | // Copyright 2013 The Go Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | package logrus 7 | 8 | import "syscall" 9 | 10 | const ioctlReadTermios = syscall.TCGETS 11 | 12 | type Termios syscall.Termios 13 | -------------------------------------------------------------------------------- /contrib/sdk/harbor-py/examples/promote_as_admin.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | sys.path.append("../") 5 | 6 | from harborclient import harborclient 7 | 8 | host = "127.0.0.1" 9 | user = "admin" 10 | password = "Harbor12345" 11 | 12 | client = harborclient.HarborClient(host, user, password) 13 | 14 | # Promote as admin 15 | user_id = 2 16 | client.promote_as_admin(user_id) 17 | -------------------------------------------------------------------------------- /contrib/sdk/harbor-py/examples/search.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | sys.path.append("../") 5 | 6 | from harborclient import harborclient 7 | 8 | host = "127.0.0.1" 9 | user = "admin" 10 | password = "Harbor12345" 11 | 12 | client = harborclient.HarborClient(host, user, password) 13 | 14 | # Search with query string 15 | query_string = "library" 16 | print(client.search(query_string)) 17 | -------------------------------------------------------------------------------- /controllers/repository.go: -------------------------------------------------------------------------------- 1 | package controllers 2 | 3 | import "os" 4 | 5 | // RepositoryController handles request to /repository 6 | type RepositoryController struct { 7 | BaseController 8 | } 9 | 10 | // Get renders repository page 11 | func (rc *RepositoryController) Get() { 12 | rc.Data["HarborRegUrl"] = os.Getenv("HARBOR_REG_URL") 13 | rc.Forward("page_title_repository", "repository.htm") 14 | } 15 | -------------------------------------------------------------------------------- /contrib/sdk/harbor-py/examples/get_repositories.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | sys.path.append("../") 5 | 6 | from harborclient import harborclient 7 | 8 | host = "127.0.0.1" 9 | user = "admin" 10 | password = "Harbor12345" 11 | 12 | client = harborclient.HarborClient(host, user, password) 13 | 14 | # Get all repositories 15 | project_id = 1 16 | print(client.get_repositories(project_id)) 17 | -------------------------------------------------------------------------------- /contrib/sdk/harbor-py/examples/delete_repository.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | sys.path.append("../") 5 | 6 | from harborclient import harborclient 7 | 8 | host = "127.0.0.1" 9 | user = "admin" 10 | password = "Harbor12345" 11 | 12 | client = harborclient.HarborClient(host, user, password) 13 | 14 | # Delete repository 15 | repo_name = "library/cirros" 16 | client.delete_repository(repo_name) 17 | -------------------------------------------------------------------------------- /contrib/sdk/harbor-py/examples/get_repository_tags.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | sys.path.append("../") 5 | 6 | from harborclient import harborclient 7 | 8 | host = "127.0.0.1" 9 | user = "admin" 10 | password = "Harbor12345" 11 | 12 | client = harborclient.HarborClient(host, user, password) 13 | 14 | # Get repository tags 15 | repo_name = "library/cirros" 16 | client.get_repository_tags(repo_name) 17 | -------------------------------------------------------------------------------- /tests/apitests/apilib/user.go: -------------------------------------------------------------------------------- 1 | package HarborAPI 2 | 3 | type User struct { 4 | UserId int32 `json:"user_id,omitempty"` 5 | Username string `json:"username,omitempty"` 6 | Email string `json:"email,omitempty"` 7 | Password string `json:"password,omitempty"` 8 | Realname string `json:"realname,omitempty"` 9 | Comment string `json:"comment,omitempty"` 10 | Deleted int32 `json:"deleted,omitempty"` 11 | } 12 | -------------------------------------------------------------------------------- /Deploy/templates/jobservice/env: -------------------------------------------------------------------------------- 1 | MYSQL_HOST=mysql 2 | MYSQL_PORT=3306 3 | MYSQL_USR=root 4 | MYSQL_PWD=$db_password 5 | UI_SECRET=$ui_secret 6 | CONFIG_PATH=/etc/jobservice/app.conf 7 | REGISTRY_URL=http://registry:5000 8 | VERIFY_REMOTE_CERT=$verify_remote_cert 9 | MAX_JOB_WORKERS=$max_job_workers 10 | LOG_LEVEL=$log_level 11 | LOG_DIR=/var/log/jobs 12 | GODEBUG=netdns=cgo 13 | EXT_ENDPOINT=$ui_url 14 | TOKEN_URL=http://ui 15 | -------------------------------------------------------------------------------- /contrib/sdk/harbor-py/examples/check_project_exist.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | sys.path.append("../") 5 | 6 | from harborclient import harborclient 7 | 8 | host = "127.0.0.1" 9 | user = "admin" 10 | password = "Harbor12345" 11 | 12 | client = harborclient.HarborClient(host, user, password) 13 | 14 | # Check if project exists 15 | project_name = "test-project" 16 | print(client.check_project_exist(project_name)) 17 | -------------------------------------------------------------------------------- /contrib/sdk/harbor-py/examples/create_project.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | sys.path.append("../") 5 | 6 | from harborclient import harborclient 7 | 8 | host = "127.0.0.1" 9 | user = "admin" 10 | password = "Harbor12345" 11 | 12 | client = harborclient.HarborClient(host, user, password) 13 | 14 | # Create project 15 | project_name = "test-project" 16 | is_public = True 17 | client.create_project(project_name, is_public) 18 | -------------------------------------------------------------------------------- /contrib/sdk/harbor-py/examples/get_project_id_from_name.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | sys.path.append("../") 5 | 6 | from harborclient import harborclient 7 | 8 | host = "127.0.0.1" 9 | user = "admin" 10 | password = "Harbor12345" 11 | 12 | client = harborclient.HarborClient(host, user, password) 13 | 14 | # Get project id from name 15 | project_name = "library" 16 | print(client.get_project_id_from_name(project_name)) 17 | -------------------------------------------------------------------------------- /contrib/sdk/harbor-py/examples/set_project_publicity.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | sys.path.append("../") 5 | 6 | from harborclient import harborclient 7 | 8 | host = "127.0.0.1" 9 | user = "admin" 10 | password = "Harbor12345" 11 | 12 | client = harborclient.HarborClient(host, user, password) 13 | 14 | # Set project publicity 15 | project_id = 1 16 | is_public = True 17 | client.set_project_publicity(project_id, is_public) 18 | -------------------------------------------------------------------------------- /contrib/sdk/harbor-py/examples/get_repository_manifests.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | sys.path.append("../") 5 | 6 | from harborclient import harborclient 7 | 8 | host = "127.0.0.1" 9 | user = "admin" 10 | password = "Harbor12345" 11 | 12 | client = harborclient.HarborClient(host, user, password) 13 | 14 | # Get repository manifests 15 | repo_name = "library/cirros" 16 | tag = "latest" 17 | client.get_repository_manifests(repo_name, tag) 18 | -------------------------------------------------------------------------------- /migration/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mysql:5.6 2 | 3 | MAINTAINER bhe@vmware.com 4 | 5 | RUN sed -i -e 's/us.archive.ubuntu.com/archive.ubuntu.com/g' /etc/apt/sources.list 6 | 7 | RUN apt-get update 8 | 9 | RUN apt-get install -y curl python python-pip git python-mysqldb 10 | 11 | RUN pip install alembic 12 | 13 | RUN mkdir -p /harbor-migration 14 | 15 | WORKDIR /harbor-migration 16 | 17 | COPY ./ ./ 18 | 19 | RUN ./prepare.sh 20 | 21 | ENTRYPOINT ["./run.sh"] 22 | -------------------------------------------------------------------------------- /Deploy/jobservice/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.6.2 2 | 3 | MAINTAINER jiangd@vmware.com 4 | 5 | RUN apt-get update \ 6 | && apt-get install -y libldap2-dev \ 7 | && rm -r /var/lib/apt/lists/* 8 | 9 | COPY . /go/src/github.com/vmware/harbor 10 | 11 | WORKDIR /go/src/github.com/vmware/harbor/jobservice 12 | 13 | RUN go build -v -a -o /go/bin/harbor_jobservice \ 14 | && chmod u+x /go/bin/harbor_jobservice 15 | WORKDIR /go/bin/ 16 | ENTRYPOINT ["/go/bin/harbor_jobservice"] 17 | -------------------------------------------------------------------------------- /contrib/sdk/harbor-py/examples/change_password.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | sys.path.append("../") 5 | 6 | from harborclient import harborclient 7 | 8 | host = "127.0.0.1" 9 | user = "admin" 10 | password = "Harbor12345" 11 | 12 | client = harborclient.HarborClient(host, user, password) 13 | 14 | # Change password 15 | user_id = 2 16 | old_password = "test-password" 17 | new_password = "new-password" 18 | client.change_password(user_id, old_password, new_password) 19 | -------------------------------------------------------------------------------- /vendor/github.com/docker/libtrust/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package libtrust provides an interface for managing authentication and 3 | authorization using public key cryptography. Authentication is handled 4 | using the identity attached to the public key and verified through TLS 5 | x509 certificates, a key challenge, or signature. Authorization and 6 | access control is managed through a trust graph distributed between 7 | both remote trust servers and locally cached and managed data. 8 | */ 9 | package libtrust 10 | -------------------------------------------------------------------------------- /controllers/signup.go: -------------------------------------------------------------------------------- 1 | package controllers 2 | 3 | import ( 4 | "net/http" 5 | ) 6 | 7 | // SignUpController handles requests to /sign_up 8 | type SignUpController struct { 9 | BaseController 10 | } 11 | 12 | // Get renders sign up page 13 | func (suc *SignUpController) Get() { 14 | if suc.AuthMode != "db_auth" || !suc.SelfRegistration { 15 | suc.CustomAbort(http.StatusUnauthorized, "Status unauthorized.") 16 | } 17 | suc.Data["AddNew"] = false 18 | suc.Forward("page_title_sign_up", "sign-up.htm") 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/docker/distribution/coverpkg.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Given a subpackage and the containing package, figures out which packages 3 | # need to be passed to `go test -coverpkg`: this includes all of the 4 | # subpackage's dependencies within the containing package, as well as the 5 | # subpackage itself. 6 | DEPENDENCIES="$(go list -f $'{{range $f := .Deps}}{{$f}}\n{{end}}' ${1} | grep ${2} | grep -v github.com/docker/distribution/vendor)" 7 | echo "${1} ${DEPENDENCIES}" | xargs echo -n | tr ' ' ',' 8 | -------------------------------------------------------------------------------- /contrib/sdk/harbor-py/examples/update_user_profile.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | sys.path.append("../") 5 | 6 | from harborclient import harborclient 7 | 8 | host = "127.0.0.1" 9 | user = "admin" 10 | password = "Harbor12345" 11 | 12 | client = harborclient.HarborClient(host, user, password) 13 | 14 | # Update user profile 15 | user_id = 2 16 | email = "new@gmail.com" 17 | realname = "new_realname" 18 | comment = "new_comment" 19 | client.update_user_profile(user_id, email, realname, comment) 20 | -------------------------------------------------------------------------------- /Deploy/kubernetes/proxy-rc.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ReplicationController 3 | metadata: 4 | name: proxy 5 | labels: 6 | name: proxy 7 | spec: 8 | replicas: 1 9 | selector: 10 | name: proxy 11 | template: 12 | metadata: 13 | labels: 14 | name: proxy 15 | spec: 16 | containers: 17 | - name: proxy 18 | image: caicloud/harbor_proxy:latest 19 | imagePullPolicy: Always 20 | ports: 21 | - containerPort: 80 22 | - containerPort: 443 23 | -------------------------------------------------------------------------------- /static/resources/js/components/repository/pull-command.directive.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 |
6 | 7 |
8 |
9 |
10 |
-------------------------------------------------------------------------------- /vendor/github.com/gorilla/mux/context_native.go: -------------------------------------------------------------------------------- 1 | // +build go1.7 2 | 3 | package mux 4 | 5 | import ( 6 | "context" 7 | "net/http" 8 | ) 9 | 10 | func contextGet(r *http.Request, key interface{}) interface{} { 11 | return r.Context().Value(key) 12 | } 13 | 14 | func contextSet(r *http.Request, key, val interface{}) *http.Request { 15 | if val == nil { 16 | return r 17 | } 18 | 19 | return r.WithContext(context.WithValue(r.Context(), key, val)) 20 | } 21 | 22 | func contextClear(r *http.Request) { 23 | return 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/docker/distribution/manifest/versioned.go: -------------------------------------------------------------------------------- 1 | package manifest 2 | 3 | // Versioned provides a struct with the manifest schemaVersion and . Incoming 4 | // content with unknown schema version can be decoded against this struct to 5 | // check the version. 6 | type Versioned struct { 7 | // SchemaVersion is the image manifest schema that this image follows 8 | SchemaVersion int `json:"schemaVersion"` 9 | 10 | // MediaType is the media type of this schema. 11 | MediaType string `json:"mediaType,omitempty"` 12 | } 13 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Harbor 0.1.0 Beta 2 | 3 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 4 | 5 | This product is licensed to you under the Apache License, Version 2.0 (the "License"). 6 | You may not use this product except in compliance with the License. 7 | 8 | This product may include a number of subcomponents with 9 | separate copyright notices and license terms. Your use of the source 10 | code for the these subcomponents is subject to the terms and 11 | conditions of the subcomponent's license, as noted in the LICENSE file. -------------------------------------------------------------------------------- /vendor/github.com/docker/libtrust/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to libtrust 2 | 3 | Want to hack on libtrust? Awesome! Here are instructions to get you 4 | started. 5 | 6 | libtrust is a part of the [Docker](https://www.docker.com) project, and follows 7 | the same rules and principles. If you're already familiar with the way 8 | Docker does things, you'll feel right at home. 9 | 10 | Otherwise, go read 11 | [Docker's contributions guidelines](https://github.com/docker/docker/blob/master/CONTRIBUTING.md). 12 | 13 | Happy hacking! 14 | -------------------------------------------------------------------------------- /contrib/sdk/harbor-py/examples/get_top_accessed_repositories.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | sys.path.append("../") 5 | 6 | from harborclient import harborclient 7 | 8 | host = "127.0.0.1" 9 | user = "admin" 10 | password = "Harbor12345" 11 | 12 | client = harborclient.HarborClient(host, user, password) 13 | 14 | # Get top accessed respositories 15 | print(client.get_top_accessed_repositories()) 16 | 17 | # Get top accessed respositories with count 18 | count = 1 19 | print(client.get_top_accessed_repositories(count)) 20 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/mux/context_gorilla.go: -------------------------------------------------------------------------------- 1 | // +build !go1.7 2 | 3 | package mux 4 | 5 | import ( 6 | "net/http" 7 | 8 | "github.com/gorilla/context" 9 | ) 10 | 11 | func contextGet(r *http.Request, key interface{}) interface{} { 12 | return context.Get(r, key) 13 | } 14 | 15 | func contextSet(r *http.Request, key, val interface{}) *http.Request { 16 | if val == nil { 17 | return r 18 | } 19 | 20 | context.Set(r, key, val) 21 | return r 22 | } 23 | 24 | func contextClear(r *http.Request) { 25 | context.Clear(r) 26 | } 27 | -------------------------------------------------------------------------------- /contrib/sdk/harbor-py/examples/create_user.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | sys.path.append("../") 5 | 6 | from harborclient import harborclient 7 | 8 | host = "127.0.0.1" 9 | user = "admin" 10 | password = "Harbor12345" 11 | 12 | client = harborclient.HarborClient(host, user, password) 13 | 14 | # Create user 15 | username = "test-username" 16 | email = "test-email@gmail.com" 17 | password = "test-password" 18 | realname = "test-realname" 19 | comment = "test-comment" 20 | client.create_user(username, email, password, realname, comment) 21 | -------------------------------------------------------------------------------- /vendor/github.com/astaxie/beego/grace/conn.go: -------------------------------------------------------------------------------- 1 | package grace 2 | 3 | import ( 4 | "errors" 5 | "net" 6 | ) 7 | 8 | type graceConn struct { 9 | net.Conn 10 | server *Server 11 | } 12 | 13 | func (c graceConn) Close() (err error) { 14 | defer func() { 15 | if r := recover(); r != nil { 16 | switch x := r.(type) { 17 | case string: 18 | err = errors.New(x) 19 | case error: 20 | err = x 21 | default: 22 | err = errors.New("Unknown panic") 23 | } 24 | } 25 | }() 26 | c.server.wg.Done() 27 | return c.Conn.Close() 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/docker/distribution/registry/api/v2/doc.go: -------------------------------------------------------------------------------- 1 | // Package v2 describes routes, urls and the error codes used in the Docker 2 | // Registry JSON HTTP API V2. In addition to declarations, descriptors are 3 | // provided for routes and error codes that can be used for implementation and 4 | // automatically generating documentation. 5 | // 6 | // Definitions here are considered to be locked down for the V2 registry api. 7 | // Any changes must be considered carefully and should not proceed without a 8 | // change proposal in docker core. 9 | package v2 10 | -------------------------------------------------------------------------------- /vendor/github.com/docker/distribution/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.6-alpine 2 | 3 | ENV DISTRIBUTION_DIR /go/src/github.com/docker/distribution 4 | ENV DOCKER_BUILDTAGS include_oss include_gcs 5 | 6 | WORKDIR $DISTRIBUTION_DIR 7 | COPY . $DISTRIBUTION_DIR 8 | COPY cmd/registry/config-dev.yml /etc/docker/registry/config.yml 9 | 10 | RUN set -ex \ 11 | && apk add --no-cache make git 12 | 13 | RUN make PREFIX=/go clean binaries 14 | 15 | VOLUME ["/var/lib/registry"] 16 | EXPOSE 5000 17 | ENTRYPOINT ["registry"] 18 | CMD ["serve", "/etc/docker/registry/config.yml"] 19 | -------------------------------------------------------------------------------- /Deploy/log/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM library/ubuntu:14.04 2 | 3 | # run logrotate hourly, disable imklog model, provides TCP/UDP syslog reception 4 | RUN mv /etc/cron.daily/logrotate /etc/cron.hourly/ \ 5 | && rm /etc/rsyslog.d/* \ 6 | && rm /etc/rsyslog.conf 7 | ADD rsyslog.conf /etc/rsyslog.conf 8 | 9 | # logrotate configuration file for docker 10 | ADD logrotate_docker.conf /etc/logrotate.d/ 11 | 12 | # rsyslog configuration file for docker 13 | ADD rsyslog_docker.conf /etc/rsyslog.d/ 14 | 15 | VOLUME /var/log/docker/ 16 | 17 | EXPOSE 514 18 | 19 | CMD cron && rsyslogd -n 20 | -------------------------------------------------------------------------------- /tests/apitests/apilib/project.go: -------------------------------------------------------------------------------- 1 | package HarborAPI 2 | 3 | import () 4 | 5 | type Project struct { 6 | ProjectId int32 `json:"id,omitempty"` 7 | OwnerId int32 `json:"owner_id,omitempty"` 8 | ProjectName string `json:"project_name,omitempty"` 9 | CreationTime string `json:"creation_time,omitempty"` 10 | Deleted int32 `json:"deleted,omitempty"` 11 | UserId int32 `json:"user_id,omitempty"` 12 | OwnerName string `json:"owner_name,omitempty"` 13 | Public bool `json:"public,omitempty"` 14 | Togglable bool `json:"togglable,omitempty"` 15 | } 16 | -------------------------------------------------------------------------------- /tests/apitests/apilib/repository.go: -------------------------------------------------------------------------------- 1 | package HarborAPI 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | type Repository struct { 8 | Id string `json:"id,omitempty"` 9 | Parent string `json:"parent,omitempty"` 10 | Created time.Time `json:"created,omitempty"` 11 | DurationDays string `json:"duration_days,omitempty"` 12 | Author string `json:"author,omitempty"` 13 | Architecture string `json:"architecture,omitempty"` 14 | DockerVersion string `json:"docker_version,omitempty"` 15 | Os string `json:"os,omitempty"` 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/astaxie/beego/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package beego provide a MVC framework 3 | beego: an open-source, high-performance, modular, full-stack web framework 4 | 5 | It is used for rapid development of RESTful APIs, web apps and backend services in Go. 6 | beego is inspired by Tornado, Sinatra and Flask with the added benefit of some Go-specific features such as interfaces and struct embedding. 7 | 8 | package main 9 | import "github.com/astaxie/beego" 10 | 11 | func main() { 12 | beego.Run() 13 | } 14 | 15 | more information: http://beego.me 16 | */ 17 | package beego 18 | -------------------------------------------------------------------------------- /static/i18n/locale_zh-CN.ini: -------------------------------------------------------------------------------- 1 | reset_email_hint = 请点击下面的链接进行重置密码操作 2 | reset_email_subject = 重置您的 Harbor 密码 3 | 4 | page_title_index = Harbor 5 | page_title_dashboard = 控制面板 - Harbor 6 | page_title_account_setting = 账户设置 - Harbor 7 | page_title_reset_password = 重置密码 - Harbor 8 | page_title_change_password = 修改密码 - Harbor 9 | page_title_forgot_password = 忘记密码 - Harbor 10 | page_title_project = 项目 - Harbor 11 | page_title_repository = 项目明细 - Harbor 12 | page_title_search = 搜索 - Harbor 13 | page_title_sign_up = 注册 - Harbor 14 | page_title_add_new = 增加用户 - Harbor 15 | page_title_admin_option = 管理员选项 - Harbor -------------------------------------------------------------------------------- /vendor/github.com/go-sql-driver/mysql/appengine.go: -------------------------------------------------------------------------------- 1 | // Go MySQL Driver - A MySQL-Driver for Go's database/sql package 2 | // 3 | // Copyright 2013 The Go-MySQL-Driver Authors. All rights reserved. 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public 6 | // License, v. 2.0. If a copy of the MPL was not distributed with this file, 7 | // You can obtain one at http://mozilla.org/MPL/2.0/. 8 | 9 | // +build appengine 10 | 11 | package mysql 12 | 13 | import ( 14 | "appengine/cloudsql" 15 | ) 16 | 17 | func init() { 18 | RegisterDial("cloudsql", cloudsql.Dial) 19 | } 20 | -------------------------------------------------------------------------------- /Deploy/ui/Dockerfile.ui.photon: -------------------------------------------------------------------------------- 1 | FROM library/photon:latest 2 | 3 | RUN mkdir /harbor/ 4 | RUN tdnf install -y sed apr-util-ldap 5 | 6 | COPY ./Deploy/ui/harbor_ui /harbor/ 7 | 8 | COPY ./views /harbor/views 9 | COPY ./static /harbor/static 10 | COPY ./favicon.ico /harbor/favicon.ico 11 | COPY ./Deploy/jsminify.sh /tmp/jsminify.sh 12 | 13 | RUN chmod u+x /harbor/harbor_ui \ 14 | && tmp/jsminify.sh /harbor/views/sections/script-include.htm /harbor/static/resources/js/harbor.app.min.js /harbor/ \ 15 | && echo "TLS_REQCERT allow" >> /etc/openldap/ldap.conf 16 | WORKDIR /harbor/ 17 | ENTRYPOINT ["/harbor/harbor_ui"] 18 | -------------------------------------------------------------------------------- /vendor/github.com/astaxie/beego/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2014 astaxie 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /migration/migration_harbor/script.py.mako: -------------------------------------------------------------------------------- 1 | """${message} 2 | 3 | Revision ID: ${up_revision} 4 | Revises: ${down_revision | comma,n} 5 | Create Date: ${create_date} 6 | 7 | """ 8 | 9 | # revision identifiers, used by Alembic. 10 | revision = ${repr(up_revision)} 11 | down_revision = ${repr(down_revision)} 12 | branch_labels = ${repr(branch_labels)} 13 | depends_on = ${repr(depends_on)} 14 | 15 | from alembic import op 16 | import sqlalchemy as sa 17 | ${imports if imports else ""} 18 | 19 | def upgrade(): 20 | ${upgrades if upgrades else "pass"} 21 | 22 | 23 | def downgrade(): 24 | ${downgrades if downgrades else "pass"} 25 | -------------------------------------------------------------------------------- /Deploy/templates/ui/env: -------------------------------------------------------------------------------- 1 | MYSQL_HOST=mysql 2 | MYSQL_PORT=3306 3 | MYSQL_USR=root 4 | MYSQL_PWD=$db_password 5 | REGISTRY_URL=http://registry:5000 6 | UI_URL=http://ui 7 | CONFIG_PATH=/etc/ui/app.conf 8 | HARBOR_REG_URL=$hostname 9 | HARBOR_ADMIN_PASSWORD=$harbor_admin_password 10 | HARBOR_URL=$ui_url 11 | AUTH_MODE=$auth_mode 12 | LDAP_URL=$ldap_url 13 | LDAP_BASE_DN=$ldap_basedn 14 | UI_SECRET=$ui_secret 15 | SELF_REGISTRATION=$self_registration 16 | USE_COMPRESSED_JS=$use_compressed_js 17 | LOG_LEVEL=$log_level 18 | GODEBUG=netdns=cgo 19 | EXT_ENDPOINT=$ui_url 20 | TOKEN_URL=http://ui 21 | VERIFY_REMOTE_CERT=$verify_remote_cert 22 | TOKEN_EXPIRATION=$token_expiration 23 | VERSION=$version 24 | -------------------------------------------------------------------------------- /vendor/github.com/docker/distribution/context/version.go: -------------------------------------------------------------------------------- 1 | package context 2 | 3 | // WithVersion stores the application version in the context. The new context 4 | // gets a logger to ensure log messages are marked with the application 5 | // version. 6 | func WithVersion(ctx Context, version string) Context { 7 | ctx = WithValue(ctx, "version", version) 8 | // push a new logger onto the stack 9 | return WithLogger(ctx, GetLogger(ctx, "version")) 10 | } 11 | 12 | // GetVersion returns the application version from the context. An empty 13 | // string may returned if the version was not set on the context. 14 | func GetVersion(ctx Context) string { 15 | return GetStringValue(ctx, "version") 16 | } 17 | -------------------------------------------------------------------------------- /Deploy/kubernetes/registry-rc.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ReplicationController 3 | metadata: 4 | name: registry 5 | labels: 6 | name: registry 7 | spec: 8 | replicas: 1 9 | selector: 10 | name: registry 11 | template: 12 | metadata: 13 | labels: 14 | name: registry 15 | spec: 16 | containers: 17 | - name: registry 18 | image: caicloud/harbor_registry:2.3.0 19 | imagePullPolicy: Always 20 | ports: 21 | - containerPort: 5000 22 | - containerPort: 5001 23 | volumeMounts: 24 | - name: storage 25 | mountPath: /storage 26 | volumes: 27 | - name: storage 28 | emptyDir: {} 29 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/terminal_notwindows.go: -------------------------------------------------------------------------------- 1 | // Based on ssh/terminal: 2 | // Copyright 2011 The Go Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | // +build linux darwin freebsd openbsd netbsd dragonfly 7 | 8 | package logrus 9 | 10 | import ( 11 | "syscall" 12 | "unsafe" 13 | ) 14 | 15 | // IsTerminal returns true if stderr's file descriptor is a terminal. 16 | func IsTerminal() bool { 17 | fd := syscall.Stderr 18 | var termios Termios 19 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) 20 | return err == 0 21 | } 22 | -------------------------------------------------------------------------------- /views/sections/footer-include.htm: -------------------------------------------------------------------------------- 1 | 15 | -------------------------------------------------------------------------------- /static/resources/css/account-settings.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package logrus is a structured logger for Go, completely API compatible with the standard library logger. 3 | 4 | 5 | The simplest way to use Logrus is simply the package-level exported logger: 6 | 7 | package main 8 | 9 | import ( 10 | log "github.com/Sirupsen/logrus" 11 | ) 12 | 13 | func main() { 14 | log.WithFields(log.Fields{ 15 | "animal": "walrus", 16 | "number": 1, 17 | "size": 10, 18 | }).Info("A walrus appears") 19 | } 20 | 21 | Output: 22 | time="2015-09-07T08:48:33Z" level=info msg="A walrus appears" animal=walrus number=1 size=10 23 | 24 | For a full guide visit https://github.com/Sirupsen/logrus 25 | */ 26 | package logrus 27 | -------------------------------------------------------------------------------- /vendor/github.com/go-sql-driver/mysql/result.go: -------------------------------------------------------------------------------- 1 | // Go MySQL Driver - A MySQL-Driver for Go's database/sql package 2 | // 3 | // Copyright 2012 The Go-MySQL-Driver Authors. All rights reserved. 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public 6 | // License, v. 2.0. If a copy of the MPL was not distributed with this file, 7 | // You can obtain one at http://mozilla.org/MPL/2.0/. 8 | 9 | package mysql 10 | 11 | type mysqlResult struct { 12 | affectedRows int64 13 | insertId int64 14 | } 15 | 16 | func (res *mysqlResult) LastInsertId() (int64, error) { 17 | return res.insertId, nil 18 | } 19 | 20 | func (res *mysqlResult) RowsAffected() (int64, error) { 21 | return res.affectedRows, nil 22 | } 23 | -------------------------------------------------------------------------------- /static/i18n/locale_en-US.ini: -------------------------------------------------------------------------------- 1 | reset_email_hint = Please click this link to reset your password 2 | reset_email_subject = Reset your password of Harbor account 3 | 4 | page_title_index = Harbor 5 | page_title_dashboard = Dashboard - Harbor 6 | page_title_account_setting = Account Settings - Harbor 7 | page_title_reset_password = Reset Password - Harbor 8 | page_title_change_password = Change Password - Harbor 9 | page_title_forgot_password = Forgot Password - Harbor 10 | page_title_project = Project - Harbor 11 | page_title_repository = Project Details - Harbor 12 | page_title_search = Search - Harbor 13 | page_title_sign_up = Sign Up - Harbor 14 | page_title_add_new = Add New User - Harbor 15 | page_title_admin_option = Admin Options - Harbor -------------------------------------------------------------------------------- /Deploy/kubernetes/mysql-rc.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ReplicationController 3 | metadata: 4 | name: mysql 5 | labels: 6 | name: mysql 7 | spec: 8 | replicas: 1 9 | selector: 10 | name: mysql 11 | template: 12 | metadata: 13 | labels: 14 | name: mysql 15 | spec: 16 | containers: 17 | - name: mysql 18 | image: caicloud/harbor_deploy_mysql:latest 19 | imagePullPolicy: Always 20 | ports: 21 | - containerPort: 3306 22 | env: 23 | - name: MYSQL_ROOT_PASSWORD 24 | value: root123 25 | volumeMounts: 26 | - name: mysql-storage 27 | mountPath: /var/lib/mysql 28 | volumes: 29 | - name: mysql-storage 30 | emptyDir: {} 31 | -------------------------------------------------------------------------------- /static/resources/css/destination.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | .create-destination { 16 | height: 275px; 17 | } -------------------------------------------------------------------------------- /tests/apitests/apilib/harlogin.go: -------------------------------------------------------------------------------- 1 | // HarborLogon.go 2 | package HarborAPI 3 | 4 | import ( 5 | "io/ioutil" 6 | "net/http" 7 | "net/url" 8 | "strings" 9 | ) 10 | 11 | func (a HarborAPI) HarborLogin(user UsrInfo) (int, error) { 12 | 13 | v := url.Values{} 14 | v.Set("principal", user.Name) 15 | v.Set("password", user.Passwd) 16 | 17 | body := ioutil.NopCloser(strings.NewReader(v.Encode())) //endode v:[body struce] 18 | 19 | client := &http.Client{} 20 | reqest, err := http.NewRequest("POST", a.basePath+"/login", body) 21 | 22 | reqest.Header.Set("Content-Type", "application/x-www-form-urlencoded;param=value") //setting post head 23 | 24 | resp, err := client.Do(reqest) 25 | defer resp.Body.Close() //close resp.Body 26 | 27 | return resp.StatusCode, err 28 | } 29 | -------------------------------------------------------------------------------- /Deploy/log/Dockerfile.log.photon: -------------------------------------------------------------------------------- 1 | FROM library/photon:latest 2 | 3 | # run logrotate hourly, disable imklog model, provides TCP/UDP syslog reception 4 | RUN tdnf install -y cronie rsyslog logrotate shadow\ 5 | && mv /etc/cron.daily/logrotate /etc/cron.hourly/ \ 6 | && mkdir /etc/rsyslog.d/ \ 7 | && mkdir /var/spool/rsyslog \ 8 | && groupadd syslog \ 9 | && useradd -g syslog syslog 10 | 11 | ADD rsyslog.conf /etc/rsyslog.conf 12 | 13 | COPY logrotate.conf.photon /etc/logrotate.conf 14 | 15 | # logrotate configuration file for docker 16 | ADD logrotate_docker.conf /etc/logrotate.d/ 17 | 18 | # rsyslog configuration file for docker 19 | ADD rsyslog_docker.conf /etc/rsyslog.d/ 20 | 21 | 22 | VOLUME /var/log/docker/ 23 | 24 | EXPOSE 514 25 | 26 | CMD crond && rsyslogd -n 27 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/terminal_windows.go: -------------------------------------------------------------------------------- 1 | // Based on ssh/terminal: 2 | // Copyright 2011 The Go Authors. All rights reserved. 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | // +build windows 7 | 8 | package logrus 9 | 10 | import ( 11 | "syscall" 12 | "unsafe" 13 | ) 14 | 15 | var kernel32 = syscall.NewLazyDLL("kernel32.dll") 16 | 17 | var ( 18 | procGetConsoleMode = kernel32.NewProc("GetConsoleMode") 19 | ) 20 | 21 | // IsTerminal returns true if stderr's file descriptor is a terminal. 22 | func IsTerminal() bool { 23 | fd := syscall.Stderr 24 | var st uint32 25 | r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0) 26 | return r != 0 && e == 0 27 | } 28 | -------------------------------------------------------------------------------- /static/resources/js/harbor.constants.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 'use strict'; 17 | 18 | angular 19 | .module('harbor.app'); 20 | 21 | })(); -------------------------------------------------------------------------------- /static/resources/js/harbor.initialize.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 'use strict'; 17 | 18 | angular 19 | .module('harbor.app'); 20 | 21 | })(); -------------------------------------------------------------------------------- /vendor/github.com/docker/distribution/context/util.go: -------------------------------------------------------------------------------- 1 | package context 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | // Since looks up key, which should be a time.Time, and returns the duration 8 | // since that time. If the key is not found, the value returned will be zero. 9 | // This is helpful when inferring metrics related to context execution times. 10 | func Since(ctx Context, key interface{}) time.Duration { 11 | if startedAt, ok := ctx.Value(key).(time.Time); ok { 12 | return time.Since(startedAt) 13 | } 14 | return 0 15 | } 16 | 17 | // GetStringValue returns a string value from the context. The empty string 18 | // will be returned if not found. 19 | func GetStringValue(ctx Context, key interface{}) (value string) { 20 | if valuev, ok := ctx.Value(key).(string); ok { 21 | value = valuev 22 | } 23 | return value 24 | } 25 | -------------------------------------------------------------------------------- /models/authmodel.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | 16 | package models 17 | 18 | // AuthModel holds information used to authenticate. 19 | type AuthModel struct { 20 | Principal string 21 | Password string 22 | } 23 | -------------------------------------------------------------------------------- /Deploy/log/logrotate.conf.photon: -------------------------------------------------------------------------------- 1 | # see "man logrotate" for details 2 | # rotate log files weekly 3 | weekly 4 | 5 | # keep 4 weeks worth of backlogs 6 | rotate 4 7 | 8 | # create new (empty) log files after rotating old ones 9 | create 10 | 11 | # use date as a suffix of the rotated file 12 | dateext 13 | 14 | # uncomment this if you want your log files compressed 15 | #compress 16 | 17 | # RPM packages drop log rotation information into this directory 18 | include /etc/logrotate.d 19 | 20 | # no packages own wtmp and btmp -- we'll rotate them here 21 | #/var/log/wtmp { 22 | # monthly 23 | # create 0664 root utmp 24 | # minsize 1M 25 | # rotate 1 26 | #} 27 | 28 | /var/log/btmp { 29 | missingok 30 | monthly 31 | create 0600 root utmp 32 | rotate 1 33 | } 34 | 35 | # system-specific logs may be also be configured here. 36 | -------------------------------------------------------------------------------- /utils/log/formatter.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | 16 | package log 17 | 18 | // Formatter formats records in different ways: text, json, etc. 19 | type Formatter interface { 20 | Format(*Record) ([]byte, error) 21 | } 22 | -------------------------------------------------------------------------------- /static/resources/js/components/log/log.config.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.log'); 21 | 22 | 23 | })(); -------------------------------------------------------------------------------- /static/resources/js/layout/footer/footer.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.layout.footer', []); 21 | 22 | })(); -------------------------------------------------------------------------------- /static/resources/js/layout/index/index.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.layout.index', []); 21 | 22 | })(); -------------------------------------------------------------------------------- /static/resources/js/services/log/services.log.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.services.log', []); 21 | 22 | })(); -------------------------------------------------------------------------------- /Deploy/kubernetes/dockerfiles/registry-config.yml: -------------------------------------------------------------------------------- 1 | version: 0.1 2 | log: 3 | level: debug 4 | fields: 5 | service: registry 6 | storage: 7 | cache: 8 | layerinfo: inmemory 9 | filesystem: 10 | rootdirectory: /storage 11 | maintenance: 12 | uploadpurging: 13 | enabled: false 14 | http: 15 | addr: :5000 16 | secret: placeholder 17 | debug: 18 | addr: localhost:5001 19 | auth: 20 | token: 21 | issuer: registry-token-issuer 22 | realm: http://harbor.caicloud.io/service/token 23 | rootcertbundle: /etc/registry/root.crt 24 | service: token-service 25 | 26 | notifications: 27 | endpoints: 28 | - name: harbor 29 | disabled: false 30 | url: http://harbor.caicloud.io/service/notifications 31 | timeout: 500 32 | threshold: 5 33 | backoff: 1000 34 | -------------------------------------------------------------------------------- /static/resources/js/layout/add-new/add-new.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.layout.add.new', []); 21 | 22 | })(); -------------------------------------------------------------------------------- /static/resources/js/services/i18n/services.i18n.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.services.i18n', []); 21 | 22 | })(); -------------------------------------------------------------------------------- /static/resources/js/services/project/services.project.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 'use strict'; 17 | 18 | angular 19 | .module('harbor.services.project', []); 20 | 21 | })(); -------------------------------------------------------------------------------- /static/resources/js/services/user/services.user.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.services.user', []); 21 | 22 | })(); -------------------------------------------------------------------------------- /utils/registry/modifier.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | 16 | package registry 17 | 18 | import ( 19 | "net/http" 20 | ) 21 | 22 | // Modifier modifies request 23 | type Modifier interface { 24 | Modify(*http.Request) error 25 | } 26 | -------------------------------------------------------------------------------- /Deploy/templates/registry/config.yml: -------------------------------------------------------------------------------- 1 | version: 0.1 2 | log: 3 | level: $log_level 4 | fields: 5 | service: registry 6 | storage: 7 | cache: 8 | layerinfo: inmemory 9 | filesystem: 10 | rootdirectory: /storage 11 | maintenance: 12 | uploadpurging: 13 | enabled: false 14 | delete: 15 | enabled: true 16 | http: 17 | addr: :5000 18 | secret: placeholder 19 | debug: 20 | addr: localhost:5001 21 | auth: 22 | token: 23 | issuer: registry-token-issuer 24 | realm: $ui_url/service/token 25 | rootcertbundle: /etc/registry/root.crt 26 | service: token-service 27 | 28 | notifications: 29 | endpoints: 30 | - name: harbor 31 | disabled: false 32 | url: http://ui/service/notifications 33 | timeout: 3000ms 34 | threshold: 5 35 | backoff: 1s 36 | -------------------------------------------------------------------------------- /static/resources/js/layout/navigation/navigation.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.layout.navigation', []); 21 | 22 | })(); -------------------------------------------------------------------------------- /static/resources/js/layout/search/search.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.layout.search', []); 21 | 22 | 23 | })(); -------------------------------------------------------------------------------- /static/resources/js/services/search/services.search.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.services.search', []); 21 | 22 | })(); -------------------------------------------------------------------------------- /static/resources/css/search.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | .search-result { 16 | min-height: 200px; 17 | max-height: 200px; 18 | overflow-y: auto; 19 | } 20 | 21 | .search-result li { 22 | margin-bottom: 15px; 23 | } -------------------------------------------------------------------------------- /static/resources/js/components/inline-help/inline-help.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.inline.help', []); 21 | 22 | })(); -------------------------------------------------------------------------------- /static/resources/js/components/modal-dialog/modal-dialog.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.modal.dialog', []); 21 | 22 | })(); -------------------------------------------------------------------------------- /static/resources/js/components/search/search.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 'use strict'; 17 | 18 | angular 19 | .module('harbor.search', [ 20 | 'harbor.services.search']); 21 | })(); -------------------------------------------------------------------------------- /static/resources/js/components/user/user.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.user', [ 21 | 'harbor.services.user']); 22 | })(); -------------------------------------------------------------------------------- /static/resources/js/layout/admin-option/admin-option.config.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.layout.admin.option'); 21 | 22 | })(); -------------------------------------------------------------------------------- /static/resources/js/layout/admin-option/admin-option.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.layout.admin.option', []); 21 | 22 | })(); -------------------------------------------------------------------------------- /static/resources/js/services/repository/services.repository.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 'use strict'; 17 | 18 | angular 19 | .module('harbor.services.repository', []); 20 | 21 | })(); -------------------------------------------------------------------------------- /static/resources/js/components/dismissable-alerts/dismissable-alerts.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular.module('harbor.dismissable.alerts', []); 20 | 21 | })(); -------------------------------------------------------------------------------- /static/resources/js/components/element-height/element-height.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.layout.element.height', []); 21 | 22 | })(); -------------------------------------------------------------------------------- /static/resources/js/components/loading-progress/loading-progress.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.loading.progress', []); 21 | 22 | })(); -------------------------------------------------------------------------------- /static/resources/js/components/log/log.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.log', [ 21 | 'harbor.services.log' 22 | ]); 23 | 24 | })(); -------------------------------------------------------------------------------- /static/resources/js/components/repository/repository.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 'use strict'; 17 | 18 | angular 19 | .module('harbor.repository', [ 20 | 'harbor.services.repository']); 21 | })(); -------------------------------------------------------------------------------- /static/resources/js/session/session.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.session', [ 21 | 'harbor.services.user' 22 | ]); 23 | 24 | })(); -------------------------------------------------------------------------------- /docs/image_pulling_chinese_user.md: -------------------------------------------------------------------------------- 1 | ### A faster way to pull images for Chinese Harbor users 2 | By default, Harbor not only build images according to Dockerfile but also pull images from Docker Hub. For the reason we all know, it is difficult for Chinese Harbor users to pull images from the Docker Hub. We put images on daocloud.io platform, we'll put images on other platforms later. If you have difficulty to pull images from Docker Hub, or you think it wastes too much time to build images. We recommend you to use the following way to accelerate the pulling procedure(make sure you're in the harbor diectory): 3 | ``` 4 | $ cd contrib 5 | $ cp docker-compose.yml.daocloud ../Deploy 6 | $ cd ../Deploy 7 | $ mv docker-compose.yml docker-compose.yml.bak 8 | $ mv docker-compose.yml.daocloud docker-compose.yml 9 | $ docker-compose up -d 10 | ``` 11 | Then you'll see docker pulling imges faster than before. 12 | -------------------------------------------------------------------------------- /static/resources/js/components/system-management/system-management.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.system.management', []); 21 | 22 | })(); -------------------------------------------------------------------------------- /static/resources/js/services/destination/services.destination.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.services.destination', []); 21 | 22 | })(); 23 | -------------------------------------------------------------------------------- /static/resources/js/services/project-member/services.project-member.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.services.project.member', []); 21 | 22 | })(); -------------------------------------------------------------------------------- /static/resources/js/layout/sign-up/sign-up.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.layout.sign.up', [ 21 | 'harbor.services.user']); 22 | 23 | })(); -------------------------------------------------------------------------------- /static/resources/js/services/replication-job/services.replication-job.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.services.replication.job', []); 21 | 22 | })(); -------------------------------------------------------------------------------- /static/resources/js/components/sign-in/sign-in.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.sign.in', [ 21 | 'harbor.services.user' 22 | ]); 23 | 24 | })(); -------------------------------------------------------------------------------- /static/resources/js/components/summary/summary.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.summary', [ 21 | 'harbor.services.project' 22 | ]); 23 | 24 | })(); -------------------------------------------------------------------------------- /static/resources/js/components/validator/validator.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.validator', [ 21 | 'harbor.services.user' 22 | ]); 23 | 24 | })(); -------------------------------------------------------------------------------- /vendor/github.com/go-sql-driver/mysql/transaction.go: -------------------------------------------------------------------------------- 1 | // Go MySQL Driver - A MySQL-Driver for Go's database/sql package 2 | // 3 | // Copyright 2012 The Go-MySQL-Driver Authors. All rights reserved. 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public 6 | // License, v. 2.0. If a copy of the MPL was not distributed with this file, 7 | // You can obtain one at http://mozilla.org/MPL/2.0/. 8 | 9 | package mysql 10 | 11 | type mysqlTx struct { 12 | mc *mysqlConn 13 | } 14 | 15 | func (tx *mysqlTx) Commit() (err error) { 16 | if tx.mc == nil || tx.mc.netConn == nil { 17 | return ErrInvalidConn 18 | } 19 | err = tx.mc.exec("COMMIT") 20 | tx.mc = nil 21 | return 22 | } 23 | 24 | func (tx *mysqlTx) Rollback() (err error) { 25 | if tx.mc == nil || tx.mc.netConn == nil { 26 | return ErrInvalidConn 27 | } 28 | err = tx.mc.exec("ROLLBACK") 29 | tx.mc = nil 30 | return 31 | } 32 | -------------------------------------------------------------------------------- /static/resources/js/components/user-log/user-log.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.user.log', [ 21 | 'harbor.services.log' 22 | ]); 23 | 24 | })(); -------------------------------------------------------------------------------- /static/resources/js/services/replication-policy/services.replication-policy.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.services.replication.policy', []); 21 | 22 | })(); -------------------------------------------------------------------------------- /static/resources/js/layout/account-setting/account-setting.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.layout.account.setting', [ 21 | 'harbor.services.user']); 22 | 23 | })(); -------------------------------------------------------------------------------- /static/resources/js/layout/change-password/change-password.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.layout.change.password', [ 21 | 'harbor.services.user']); 22 | 23 | })(); -------------------------------------------------------------------------------- /static/resources/js/layout/dashboard/dashboard.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.layout.dashboard', [ 21 | 'harbor.services.repository' 22 | ]); 23 | 24 | })(); -------------------------------------------------------------------------------- /tests/startuptest.go: -------------------------------------------------------------------------------- 1 | // Fetch prints the content found at a URL. 2 | package main 3 | 4 | import ( 5 | "fmt" 6 | "io/ioutil" 7 | "net/http" 8 | "os" 9 | "strings" 10 | "time" 11 | ) 12 | 13 | func main() { 14 | time.Sleep(60*time.Second) 15 | for _, url := range os.Args[1:] { 16 | resp, err := http.Get(url) 17 | if err != nil { 18 | fmt.Fprintf(os.Stderr, "fetch: %v\n", err) 19 | os.Exit(1) 20 | } 21 | b, err := ioutil.ReadAll(resp.Body) 22 | resp.Body.Close() 23 | if err != nil { 24 | fmt.Fprintf(os.Stderr, "fetch: reading %s: %v\n", url, err) 25 | os.Exit(1) 26 | } 27 | // fmt.Printf("%s", b) 28 | if strings.Contains(string(b), "Harbor") { 29 | fmt.Printf("sucess!\n") 30 | } else { 31 | os.Exit(1) 32 | } 33 | 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /views/reset-password-mail.tpl: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 |

{{.Hint}}:

19 | {{.URL}}/reset_password?reset_uuid={{.UUID}} 20 | 21 | -------------------------------------------------------------------------------- /static/resources/js/components/project/project.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 'use strict'; 17 | 18 | angular 19 | .module('harbor.project', [ 20 | 'harbor.services.project', 21 | 'harbor.services.user' 22 | ]); 23 | })(); -------------------------------------------------------------------------------- /static/resources/js/layout/header/header.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.layout.header', [ 21 | 'harbor.services.user', 22 | 'harbor.services.i18n' 23 | ]); 24 | })(); -------------------------------------------------------------------------------- /static/resources/js/layout/reset-password/reset-password.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.layout.reset.password', [ 21 | 'harbor.services.user' 22 | ]); 23 | 24 | })(); -------------------------------------------------------------------------------- /controllers/addnew.go: -------------------------------------------------------------------------------- 1 | package controllers 2 | 3 | import ( 4 | "net/http" 5 | 6 | "github.com/vmware/harbor/dao" 7 | "github.com/vmware/harbor/utils/log" 8 | ) 9 | 10 | // AddNewController handles requests to /add_new 11 | type AddNewController struct { 12 | BaseController 13 | } 14 | 15 | // Get renders the add new page 16 | func (anc *AddNewController) Get() { 17 | sessionUserID := anc.GetSession("userId") 18 | anc.Data["AddNew"] = false 19 | if sessionUserID != nil { 20 | isAdmin, err := dao.IsAdminRole(sessionUserID.(int)) 21 | if err != nil { 22 | log.Errorf("Error occurred in IsAdminRole: %v", err) 23 | anc.CustomAbort(http.StatusInternalServerError, "") 24 | } 25 | if isAdmin && anc.AuthMode == "db_auth" { 26 | anc.Data["AddNew"] = true 27 | anc.Forward("page_title_add_new", "sign-up.htm") 28 | return 29 | } 30 | } 31 | anc.CustomAbort(http.StatusUnauthorized, "Status Unauthorized.") 32 | } 33 | -------------------------------------------------------------------------------- /models/toprepo.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | 16 | package models 17 | 18 | // TopRepo holds information about repository that accessed most 19 | type TopRepo struct { 20 | RepoName string `json:"name"` 21 | AccessCount int64 `json:"count"` 22 | // Creator string `json:"creator"` 23 | } 24 | -------------------------------------------------------------------------------- /static/resources/js/layout/forgot-password/forgot-password.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.layout.forgot.password', [ 21 | 'harbor.services.user' 22 | ]); 23 | 24 | })(); -------------------------------------------------------------------------------- /migration/changelog.md: -------------------------------------------------------------------------------- 1 | # What's New in Harbor Database Schema 2 | Changelog for harbor database schema 3 | 4 | ## 0.1.0 5 | 6 | ## 0.1.1 7 | 8 | - create table `project_member` 9 | - create table `schema_version` 10 | - drop table `user_project_role` 11 | - drop table `project_role` 12 | - add column `creation_time` to table `user` 13 | - add column `sysadmin_flag` to table `user` 14 | - add column `update_time` to table `user` 15 | - add column `role_mask` to table `role` 16 | - add column `update_time` to table `project` 17 | - delete data `AMDRWS` from table `role` 18 | - delete data `A` from table `access` 19 | 20 | ## 0.2.0 21 | 22 | - create table `replication_policy` 23 | - create table `replication_target` 24 | - create table `replication_job` 25 | - add column `repo_tag` to table `access_log` 26 | - alter column `repo_name` on table `access_log` 27 | - alter column `email` on table `user` 28 | -------------------------------------------------------------------------------- /static/resources/js/components/top-repository/top-repository.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.top.repository', [ 21 | 'harbor.services.repository' 22 | ]); 23 | 24 | })(); -------------------------------------------------------------------------------- /static/resources/js/components/inline-help/inline-help.directive.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /static/resources/js/layout/details/details.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.details', [ 21 | 'harbor.services.project', 22 | 'harbor.services.project.member' 23 | ]); 24 | 25 | })(); -------------------------------------------------------------------------------- /vendor/github.com/astaxie/beego/utils/caller.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 beego Author. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package utils 16 | 17 | import ( 18 | "reflect" 19 | "runtime" 20 | ) 21 | 22 | // GetFuncName get function name 23 | func GetFuncName(i interface{}) string { 24 | return runtime.FuncForPC(reflect.ValueOf(i).Pointer()).Name() 25 | } 26 | -------------------------------------------------------------------------------- /static/resources/js/components/optional-menu/optional-menu.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.optional.menu', [ 21 | 'harbor.services.user', 22 | 'harbor.services.i18n' 23 | ]); 24 | 25 | })(); -------------------------------------------------------------------------------- /views/sections/footer-content.htm: -------------------------------------------------------------------------------- 1 | 15 | 16 | 19 | -------------------------------------------------------------------------------- /Deploy/ui/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.6.2 2 | 3 | MAINTAINER jiangd@vmware.com 4 | 5 | RUN apt-get update \ 6 | && apt-get install -y libldap2-dev \ 7 | && rm -r /var/lib/apt/lists/* 8 | 9 | COPY . /go/src/github.com/vmware/harbor 10 | WORKDIR /go/src/github.com/vmware/harbor/ui 11 | 12 | RUN go build -v -a -o /go/bin/harbor_ui 13 | 14 | ENV MYSQL_USR root \ 15 | MYSQL_PWD root \ 16 | REGISTRY_URL localhost:5000 17 | 18 | COPY views /go/bin/views 19 | COPY static /go/bin/static 20 | COPY favicon.ico /go/bin/favicon.ico 21 | COPY Deploy/jsminify.sh /tmp/jsminify.sh 22 | 23 | RUN chmod u+x /go/bin/harbor_ui \ 24 | && sed -i 's/TLS_CACERT/#TLS_CAERT/g' /etc/ldap/ldap.conf \ 25 | && sed -i '$a\TLS_REQCERT allow' /etc/ldap/ldap.conf \ 26 | && /tmp/jsminify.sh /go/bin/views/sections/script-include.htm /go/bin/static/resources/js/harbor.app.min.js 27 | 28 | WORKDIR /go/bin/ 29 | ENTRYPOINT ["/go/bin/harbor_ui"] 30 | 31 | EXPOSE 80 32 | 33 | -------------------------------------------------------------------------------- /static/resources/js/components/project-member/project-member.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.project.member', [ 21 | 'harbor.services.project.member', 22 | 'harbor.services.user' 23 | ]); 24 | 25 | })(); -------------------------------------------------------------------------------- /static/resources/js/components/project/publicity-button.directive.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | -------------------------------------------------------------------------------- /static/resources/js/components/replication/replication.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.replication', [ 21 | 'harbor.services.replication.policy', 22 | 'harbor.services.replication.job' 23 | ]); 24 | 25 | })(); -------------------------------------------------------------------------------- /static/resources/js/layout/project/project.module.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.layout.project', [ 21 | 'harbor.project.member', 22 | 'harbor.services.project', 23 | 'harbor.services.user' 24 | ]); 25 | 26 | })(); -------------------------------------------------------------------------------- /models/base.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | 16 | package models 17 | 18 | import ( 19 | "github.com/astaxie/beego/orm" 20 | ) 21 | 22 | func init() { 23 | orm.RegisterModel(new(RepTarget), 24 | new(RepPolicy), 25 | new(RepJob), 26 | new(User), 27 | new(Project), 28 | new(Role), 29 | new(AccessLog)) 30 | } 31 | -------------------------------------------------------------------------------- /tests/apitests/apilib/accesslog.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | 16 | package HarborAPI 17 | 18 | type AccessLog struct { 19 | Username string `json:"username,omitempty"` 20 | Keywords string `json:"keywords,omitempty"` 21 | BeginTimestamp int32 `json:"beginTimestamp,omitempty"` 22 | EndTimestamp int32 `json:"endTimestamp,omitempty"` 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/docker/distribution/registry/auth/token/stringset.go: -------------------------------------------------------------------------------- 1 | package token 2 | 3 | // StringSet is a useful type for looking up strings. 4 | type stringSet map[string]struct{} 5 | 6 | // NewStringSet creates a new StringSet with the given strings. 7 | func newStringSet(keys ...string) stringSet { 8 | ss := make(stringSet, len(keys)) 9 | ss.add(keys...) 10 | return ss 11 | } 12 | 13 | // Add inserts the given keys into this StringSet. 14 | func (ss stringSet) add(keys ...string) { 15 | for _, key := range keys { 16 | ss[key] = struct{}{} 17 | } 18 | } 19 | 20 | // Contains returns whether the given key is in this StringSet. 21 | func (ss stringSet) contains(key string) bool { 22 | _, ok := ss[key] 23 | return ok 24 | } 25 | 26 | // Keys returns a slice of all keys in this StringSet. 27 | func (ss stringSet) keys() []string { 28 | keys := make([]string, 0, len(ss)) 29 | 30 | for key := range ss { 31 | keys = append(keys, key) 32 | } 33 | 34 | return keys 35 | } 36 | -------------------------------------------------------------------------------- /static/resources/css/dashboard.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | .up-section .up-table-pane { 16 | overflow-y: auto; 17 | height: 220px; 18 | margin-top: -10px; 19 | } 20 | 21 | .up-section .dl-horizontal dt{ 22 | line-height: 25px; 23 | } 24 | 25 | .up-section .dl-horizontal dt { 26 | text-align: left; 27 | } 28 | 29 | -------------------------------------------------------------------------------- /static/resources/js/components/user/toggle-admin.directive.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | -------------------------------------------------------------------------------- /static/resources/js/layout/footer/footer.controller.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.layout.footer') 21 | .controller('FooterController', FooterController); 22 | 23 | function FooterController() { 24 | var vm = this; 25 | } 26 | 27 | })(); -------------------------------------------------------------------------------- /static/resources/js/components/search/search-input.directive.html: -------------------------------------------------------------------------------- 1 | 15 | -------------------------------------------------------------------------------- /utils/registry/manifest.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | 16 | package registry 17 | 18 | import ( 19 | "github.com/docker/distribution" 20 | ) 21 | 22 | // UnMarshal converts []byte to be distribution.Manifest 23 | func UnMarshal(mediaType string, data []byte) (distribution.Manifest, distribution.Descriptor, error) { 24 | return distribution.UnmarshalManifest(mediaType, data) 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/docker/libtrust/README.md: -------------------------------------------------------------------------------- 1 | # libtrust 2 | 3 | > **WARNING** this library is no longer actively developed, and will be integrated 4 | > in the [docker/distribution][https://www.github.com/docker/distribution] 5 | > repository in future. 6 | 7 | Libtrust is library for managing authentication and authorization using public key cryptography. 8 | 9 | Authentication is handled using the identity attached to the public key. 10 | Libtrust provides multiple methods to prove possession of the private key associated with an identity. 11 | - TLS x509 certificates 12 | - Signature verification 13 | - Key Challenge 14 | 15 | Authorization and access control is managed through a distributed trust graph. 16 | Trust servers are used as the authorities of the trust graph and allow caching portions of the graph for faster access. 17 | 18 | ## Copyright and license 19 | 20 | Code and documentation copyright 2014 Docker, inc. Code released under the Apache 2.0 license. 21 | Docs released under Creative commons. 22 | 23 | -------------------------------------------------------------------------------- /utils/registry/auth/challenge.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | 16 | package auth 17 | 18 | import ( 19 | "net/http" 20 | 21 | au "github.com/docker/distribution/registry/client/auth" 22 | ) 23 | 24 | // ParseChallengeFromResponse ... 25 | func ParseChallengeFromResponse(resp *http.Response) []au.Challenge { 26 | challenges := au.ResponseChallenges(resp) 27 | 28 | return challenges 29 | } 30 | -------------------------------------------------------------------------------- /static/resources/js/layout/add-new/add-new.controller.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.layout.add.new') 21 | .controller('AddNewController', AddNewController); 22 | 23 | AddNewController.$inject = []; 24 | 25 | function AddNewController() { 26 | var vm = this; 27 | } 28 | 29 | })(); -------------------------------------------------------------------------------- /static/resources/js/components/dismissable-alerts/dismissable-alerts.directive.html: -------------------------------------------------------------------------------- 1 | 15 | -------------------------------------------------------------------------------- /tests/apitests/hbapisearch_test.go: -------------------------------------------------------------------------------- 1 | package HarborAPItest 2 | 3 | import ( 4 | "fmt" 5 | "github.com/stretchr/testify/assert" 6 | "testing" 7 | "github.com/vmware/harbor/tests/apitests/apilib" 8 | ) 9 | 10 | func TestSearch(t *testing.T) { 11 | fmt.Println("Test for Search (SearchGet) API") 12 | assert := assert.New(t) 13 | 14 | apiTest := HarborAPI.NewHarborAPI() 15 | var resault HarborAPI.Search 16 | resault, err := apiTest.SearchGet("library") 17 | //fmt.Printf("%+v\n", resault) 18 | if err != nil { 19 | t.Error("Error while search project or repository", err.Error()) 20 | t.Log(err) 21 | } else { 22 | assert.Equal(resault.Projects[0].ProjectId, int32(1), "Project id should be equal") 23 | assert.Equal(resault.Projects[0].ProjectName, "library", "Project name should be library") 24 | assert.Equal(resault.Projects[0].Public, int32(1), "Project public status should be 1 (true)") 25 | //t.Log(resault) 26 | } 27 | //if resault.Response.StatusCode != 200 { 28 | // t.Log(resault.Response) 29 | //} 30 | 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/docker/distribution/manifest/schema1/verify.go: -------------------------------------------------------------------------------- 1 | package schema1 2 | 3 | import ( 4 | "crypto/x509" 5 | 6 | "github.com/Sirupsen/logrus" 7 | "github.com/docker/libtrust" 8 | ) 9 | 10 | // Verify verifies the signature of the signed manifest returning the public 11 | // keys used during signing. 12 | func Verify(sm *SignedManifest) ([]libtrust.PublicKey, error) { 13 | js, err := libtrust.ParsePrettySignature(sm.all, "signatures") 14 | if err != nil { 15 | logrus.WithField("err", err).Debugf("(*SignedManifest).Verify") 16 | return nil, err 17 | } 18 | 19 | return js.Verify() 20 | } 21 | 22 | // VerifyChains verifies the signature of the signed manifest against the 23 | // certificate pool returning the list of verified chains. Signatures without 24 | // an x509 chain are not checked. 25 | func VerifyChains(sm *SignedManifest, ca *x509.CertPool) ([][]*x509.Certificate, error) { 26 | js, err := libtrust.ParsePrettySignature(sm.all, "signatures") 27 | if err != nil { 28 | return nil, err 29 | } 30 | 31 | return js.VerifyChains(ca) 32 | } 33 | -------------------------------------------------------------------------------- /views/layout.htm: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | {{.HeaderInclude}} 19 | {{.HeaderScriptInclude}} 20 | {{.Title}} 21 | 22 | 23 | {{.HeaderContent}} 24 | {{.LayoutContent}} 25 | {{.FooterContent}} 26 | {{.FooterInclude}} 27 | 28 | -------------------------------------------------------------------------------- /docs/prepare-swagger.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | SCHEME=http 3 | SERVER_IP=reg.mydomain.com 4 | set -e 5 | echo "Doing some clean up..." 6 | rm -f *.tar.gz 7 | echo "Downloading Swagger UI release package..." 8 | wget https://github.com/swagger-api/swagger-ui/archive/v2.1.4.tar.gz -O swagger.tar.gz 9 | echo "Untarring Swagger UI package to the static file path..." 10 | tar -C ../static/vendors -zxf swagger.tar.gz swagger-ui-2.1.4/dist 11 | echo "Executing some processes..." 12 | sed -i.bak 's/http:\/\/petstore\.swagger\.io\/v2\/swagger\.json/'$SCHEME':\/\/'$SERVER_IP'\/static\/resources\/yaml\/swagger\.yaml/g' \ 13 | ../static/vendors/swagger-ui-2.1.4/dist/index.html 14 | sed -i.bak '/jsonEditor: false,/a\ validatorUrl: null,' ../static/vendors/swagger-ui-2.1.4/dist/index.html 15 | mkdir -p ../static/resources/yaml 16 | cp swagger.yaml ../static/resources/yaml 17 | sed -i.bak 's/host: localhost/host: '$SERVER_IP'/g' ../static/resources/yaml/swagger.yaml 18 | sed -i.bak 's/ \- http$/ \- '$SCHEME'/g' ../static/resources/yaml/swagger.yaml 19 | echo "Finish preparation for the Swagger UI." 20 | -------------------------------------------------------------------------------- /utils/registry/error/error.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | 16 | package error 17 | 18 | import ( 19 | "fmt" 20 | ) 21 | 22 | // Error : if response is returned but the status code is not 200, an Error instance will be returned 23 | type Error struct { 24 | StatusCode int 25 | Detail string 26 | } 27 | 28 | // Error returns the details as string 29 | func (e *Error) Error() string { 30 | return fmt.Sprintf("%d %s", e.StatusCode, e.Detail) 31 | } 32 | -------------------------------------------------------------------------------- /views/navigation-header.htm: -------------------------------------------------------------------------------- 1 | 15 | {{ if eq .HasLoggedIn true }} 16 | 23 | {{ end }} -------------------------------------------------------------------------------- /static/resources/js/components/validator/validator.config.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.validator') 21 | .constant('INVALID_CHARS', [",","~","#", "$", "%"]) 22 | .constant('PASSWORD_REGEXP', /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).{7,20}$/) 23 | .constant('PROJECT_REGEXP', /^[a-z0-9](?:-*[a-z0-9])*(?:[._][a-z0-9](?:-*[a-z0-9])*)*$/); 24 | })(); -------------------------------------------------------------------------------- /static/resources/js/components/summary/summary.directive.html: -------------------------------------------------------------------------------- 1 | 15 | 16 |
17 |
// key | tr //:
//value//
18 |
// key | tr //:
//value//
19 |
20 | -------------------------------------------------------------------------------- /vendor/github.com/docker/distribution/registry/storage/cache/cache.go: -------------------------------------------------------------------------------- 1 | // Package cache provides facilities to speed up access to the storage 2 | // backend. 3 | package cache 4 | 5 | import ( 6 | "fmt" 7 | 8 | "github.com/docker/distribution" 9 | ) 10 | 11 | // BlobDescriptorCacheProvider provides repository scoped 12 | // BlobDescriptorService cache instances and a global descriptor cache. 13 | type BlobDescriptorCacheProvider interface { 14 | distribution.BlobDescriptorService 15 | 16 | RepositoryScoped(repo string) (distribution.BlobDescriptorService, error) 17 | } 18 | 19 | // ValidateDescriptor provides a helper function to ensure that caches have 20 | // common criteria for admitting descriptors. 21 | func ValidateDescriptor(desc distribution.Descriptor) error { 22 | if err := desc.Digest.Validate(); err != nil { 23 | return err 24 | } 25 | 26 | if desc.Size < 0 { 27 | return fmt.Errorf("cache: invalid length in descriptor: %v < 0", desc.Size) 28 | } 29 | 30 | if desc.MediaType == "" { 31 | return fmt.Errorf("cache: empty mediatype on descriptor: %v", desc) 32 | } 33 | 34 | return nil 35 | } 36 | -------------------------------------------------------------------------------- /contrib/prebuild-install/README.md: -------------------------------------------------------------------------------- 1 | ## Make use of pre-built images of Harbor 2 | 3 | Community members have helped building Harbor's docker images. If you want to save time from building Harbor from source, please follow the below instructions to quickly pull Harbor's pre-built images for installation. 4 | 5 | ### Steps 6 | 7 | Run the command `update_compose.sh` : 8 | ``` 9 | $ ./update_compose.sh 10 | 11 | Please enter the registry service you want to pull the pre-built images from. 12 | Enter 1 for Docker Hub. 13 | Enter 2 for Daocloud.io (recommended for Chinese users). 14 | or enter other registry URL such as https://my_registry/harbor/ . 15 | The default is 1 (Docker Hub): 16 | ``` 17 | 18 | Enter **1** to pull images from Docker Hub, 19 | Enter **2** to pull image from Daocloud.io, recommended for Chinese users. 20 | or Enter other registry URL like `https://my_registry/harbor/` . Do not forget the "/" and the end. 21 | 22 | This command backs up and updates the file `Deploy/docker-compose.yml` . Next, just follow the [Harbor Installation Guide](../../docs/installation_guide.md) to install Harbor. 23 | 24 | -------------------------------------------------------------------------------- /jobservice/router.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | 16 | package main 17 | 18 | import ( 19 | api "github.com/vmware/harbor/api/jobs" 20 | 21 | "github.com/astaxie/beego" 22 | ) 23 | 24 | func initRouters() { 25 | beego.Router("/api/jobs/replication", &api.ReplicationJob{}) 26 | beego.Router("/api/jobs/replication/:id/log", &api.ReplicationJob{}, "get:GetLog") 27 | beego.Router("/api/jobs/replication/actions", &api.ReplicationJob{}, "post:HandleAction") 28 | } 29 | -------------------------------------------------------------------------------- /job/replication/error.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | 16 | package replication 17 | 18 | import ( 19 | "net" 20 | ) 21 | 22 | func retry(err error) bool { 23 | if err == nil { 24 | return false 25 | } 26 | return isNetworkErr(err) 27 | } 28 | 29 | func isTemporary(err error) bool { 30 | if netErr, ok := err.(net.Error); ok { 31 | return netErr.Temporary() 32 | } 33 | return false 34 | } 35 | 36 | func isNetworkErr(err error) bool { 37 | _, ok := err.(net.Error) 38 | return ok 39 | } 40 | -------------------------------------------------------------------------------- /static/resources/js/components/search/search.directive.html: -------------------------------------------------------------------------------- 1 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
// 'project_repo_name' | tr //// 'creation_time' | tr //// 'author' | tr //
//s.repository_name//N/AN/A
26 |
-------------------------------------------------------------------------------- /static/resources/js/services/user/services.log-out.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.services.user') 21 | .factory('LogOutService', LogOutService); 22 | 23 | LogOutService.$inject = ['$http']; 24 | 25 | function LogOutService($http) { 26 | return logOut; 27 | function logOut() { 28 | return $http 29 | .get('/log_out'); 30 | } 31 | } 32 | 33 | })(); -------------------------------------------------------------------------------- /static/resources/js/components/project-member/switch-role.directive.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | //vm.currentRole.name | tr// 17 | 19 | -------------------------------------------------------------------------------- /vendor/github.com/docker/distribution/tags.go: -------------------------------------------------------------------------------- 1 | package distribution 2 | 3 | import ( 4 | "github.com/docker/distribution/context" 5 | ) 6 | 7 | // TagService provides access to information about tagged objects. 8 | type TagService interface { 9 | // Get retrieves the descriptor identified by the tag. Some 10 | // implementations may differentiate between "trusted" tags and 11 | // "untrusted" tags. If a tag is "untrusted", the mapping will be returned 12 | // as an ErrTagUntrusted error, with the target descriptor. 13 | Get(ctx context.Context, tag string) (Descriptor, error) 14 | 15 | // Tag associates the tag with the provided descriptor, updating the 16 | // current association, if needed. 17 | Tag(ctx context.Context, tag string, desc Descriptor) error 18 | 19 | // Untag removes the given tag association 20 | Untag(ctx context.Context, tag string) error 21 | 22 | // All returns the set of tags managed by this tag service 23 | All(ctx context.Context) ([]string, error) 24 | 25 | // Lookup returns the set of tags referencing the given digest. 26 | Lookup(ctx context.Context, digest Descriptor) ([]string, error) 27 | } 28 | -------------------------------------------------------------------------------- /static/resources/css/admin-options.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | .switch-pane-admin-options { 16 | display: inline; 17 | width: 245px; 18 | float: right; 19 | list-style-type: none; 20 | } 21 | 22 | .switch-pane-admin-options a, .switch-pane-admin-options span { 23 | display: inline-block; 24 | text-decoration: none; 25 | float: left; 26 | } 27 | 28 | .switch-pane-admin-options li .active { 29 | border-bottom: 2px solid rgb(0, 84, 190); 30 | font-weight: bold; 31 | } -------------------------------------------------------------------------------- /static/resources/js/layout/navigation/navigation-admin-options.directive.html: -------------------------------------------------------------------------------- 1 | 15 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | # This file lists all individuals having contributed content to the repository. 2 | 3 | Alexander Zeitler 4 | Alexey Erkak 5 | Allen Heavey 6 | Amanda Zhang 7 | Benniu Ji 8 | Bin Liu 9 | Bobby Zhang 10 | Chaofeng Wu 11 | Daniel Jiang 12 | Deshi Xiao 13 | Guangping Fu 14 | Haining Henry Zhang 15 | Hao Xia 16 | Jack Liu 17 | Jessy Zhang 18 | Kun Wang 19 | Mahesh Paolini-Subramanya 20 | Meng Wei 21 | Nagarjun G 22 | Peng Zhao 23 | Robin Naundorf 24 | Shan Zhu 25 | Victoria Zheng 26 | Wenkai Yin 27 | Yahao He 28 | Yan Wang 29 | -------------------------------------------------------------------------------- /controllers/navigationdetail.go: -------------------------------------------------------------------------------- 1 | package controllers 2 | 3 | import ( 4 | "net/http" 5 | 6 | "github.com/vmware/harbor/dao" 7 | "github.com/vmware/harbor/models" 8 | "github.com/vmware/harbor/utils/log" 9 | ) 10 | 11 | // NavigationDetailController handles requests to /navigation_detail 12 | type NavigationDetailController struct { 13 | BaseController 14 | } 15 | 16 | // Get renders user's navigation details header 17 | func (ndc *NavigationDetailController) Get() { 18 | sessionUserID := ndc.GetSession("userId") 19 | var isAdmin int 20 | if sessionUserID != nil { 21 | userID := sessionUserID.(int) 22 | u, err := dao.GetUser(models.User{UserID: userID}) 23 | if err != nil { 24 | log.Errorf("Error occurred in GetUser, error: %v", err) 25 | ndc.CustomAbort(http.StatusInternalServerError, "Internal error.") 26 | } 27 | if u == nil { 28 | log.Warningf("User was deleted already, user id: %d, canceling request.", userID) 29 | ndc.CustomAbort(http.StatusUnauthorized, "") 30 | } 31 | isAdmin = u.HasAdminRole 32 | } 33 | ndc.Data["IsAdmin"] = isAdmin 34 | ndc.TplName = "navigation-detail.htm" 35 | ndc.Render() 36 | } 37 | -------------------------------------------------------------------------------- /static/resources/js/components/details/switch-pane-projects.directive.html: -------------------------------------------------------------------------------- 1 | 15 |
16 | //vm.projectName// 17 | 18 | 19 |
-------------------------------------------------------------------------------- /vendor/github.com/docker/distribution/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 2.5.0 (2016-06-14) 4 | 5 | ### Storage 6 | - Ensure uploads directory is cleaned after upload is commited 7 | - Add ability to cap concurrent operations in filesystem driver 8 | - S3: Add 'us-gov-west-1' to the valid region list 9 | - Swift: Handle ceph not returning Last-Modified header for HEAD requests 10 | - Add redirect middleware 11 | 12 | #### Registry 13 | - Add support for blobAccessController middleware 14 | - Add support for layers from foreign sources 15 | - Remove signature store 16 | - Add support for Let's Encrypt 17 | - Correct yaml key names in configuration 18 | 19 | #### Client 20 | - Add option to get content digest from manifest get 21 | 22 | #### Spec 23 | - Update the auth spec scope grammar to reflect the fact that hostnames are optionally supported 24 | - Clarify API documentation around catalog fetch behavior 25 | 26 | ### API 27 | - Support returning HTTP 429 (Too Many Requests) 28 | 29 | ### Documentation 30 | - Update auth documentation examples to show "expires in" as int 31 | 32 | ### Docker Image 33 | - Use Alpine Linux as base image 34 | 35 | 36 | -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/json_formatter.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | ) 7 | 8 | type JSONFormatter struct { 9 | // TimestampFormat sets the format used for marshaling timestamps. 10 | TimestampFormat string 11 | } 12 | 13 | func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) { 14 | data := make(Fields, len(entry.Data)+3) 15 | for k, v := range entry.Data { 16 | switch v := v.(type) { 17 | case error: 18 | // Otherwise errors are ignored by `encoding/json` 19 | // https://github.com/Sirupsen/logrus/issues/137 20 | data[k] = v.Error() 21 | default: 22 | data[k] = v 23 | } 24 | } 25 | prefixFieldClashes(data) 26 | 27 | timestampFormat := f.TimestampFormat 28 | if timestampFormat == "" { 29 | timestampFormat = DefaultTimestampFormat 30 | } 31 | 32 | data["time"] = entry.Time.Format(timestampFormat) 33 | data["msg"] = entry.Message 34 | data["level"] = entry.Level.String() 35 | 36 | serialized, err := json.Marshal(data) 37 | if err != nil { 38 | return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err) 39 | } 40 | return append(serialized, '\n'), nil 41 | } 42 | -------------------------------------------------------------------------------- /static/resources/js/components/system-management/system-management.directive.html: -------------------------------------------------------------------------------- 1 | 15 |
16 | 17 | 18 | 19 |
20 |
21 | 22 | 23 | 24 |
25 | -------------------------------------------------------------------------------- /models/role.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | 16 | package models 17 | 18 | const ( 19 | //PROJECTADMIN project administrator 20 | PROJECTADMIN = 1 21 | //DEVELOPER developer 22 | DEVELOPER = 2 23 | //GUEST guest 24 | GUEST = 3 25 | ) 26 | 27 | // Role holds the details of a role. 28 | type Role struct { 29 | RoleID int `orm:"pk;column(role_id)" json:"role_id"` 30 | RoleCode string `orm:"column(role_code)" json:"role_code"` 31 | Name string `orm:"column(name)" json:"role_name"` 32 | 33 | RoleMask int `orm:"role_mask" json:"role_mask"` 34 | } 35 | -------------------------------------------------------------------------------- /static/resources/css/footer.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | .footer-absolute { 16 | position: absolute; 17 | bottom: 0; 18 | left: 0; 19 | padding: 0; 20 | margin: 0; 21 | } 22 | 23 | .footer-static { 24 | position: static; 25 | 26 | } 27 | 28 | .footer{ 29 | width: 100%; 30 | clear: both; 31 | background-color: #A8A8A8; 32 | height: 44px; 33 | z-index: 10; 34 | } 35 | .footer p { 36 | padding-top: 8px; 37 | color: #FFFFFF; 38 | margin-left: auto; 39 | margin-right: auto; 40 | width: 385px; 41 | } 42 | -------------------------------------------------------------------------------- /static/resources/js/services/user/services.current-user.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.services.user') 21 | .factory('CurrentUserService', CurrentUserService); 22 | 23 | CurrentUserService.$inject = ['$http']; 24 | 25 | function CurrentUserService($http, $log) { 26 | 27 | return CurrentUser; 28 | 29 | function CurrentUser() { 30 | return $http 31 | .get('/api/users/current'); 32 | } 33 | } 34 | })(); -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Simon Eskildsen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /static/resources/js/services/project/services.get-project-by-id.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.services.project') 21 | .factory('GetProjectById', GetProjectById); 22 | 23 | GetProjectById.$inject = ['$http']; 24 | 25 | function GetProjectById($http) { 26 | 27 | return getProject; 28 | 29 | function getProject(id) { 30 | return $http 31 | .get('/api/projects/' + id); 32 | } 33 | 34 | } 35 | 36 | })(); -------------------------------------------------------------------------------- /controllers/signin.go: -------------------------------------------------------------------------------- 1 | package controllers 2 | 3 | import ( 4 | "net/http" 5 | 6 | "github.com/vmware/harbor/dao" 7 | "github.com/vmware/harbor/models" 8 | "github.com/vmware/harbor/utils/log" 9 | ) 10 | 11 | // SignInController handles requests to /sign_in 12 | type SignInController struct { 13 | BaseController 14 | } 15 | 16 | //Get renders sign_in page 17 | func (sic *SignInController) Get() { 18 | sessionUserID := sic.GetSession("userId") 19 | var hasLoggedIn bool 20 | var username string 21 | if sessionUserID != nil { 22 | hasLoggedIn = true 23 | userID := sessionUserID.(int) 24 | u, err := dao.GetUser(models.User{UserID: userID}) 25 | if err != nil { 26 | log.Errorf("Error occurred in GetUser, error: %v", err) 27 | sic.CustomAbort(http.StatusInternalServerError, "Internal error.") 28 | } 29 | if u == nil { 30 | log.Warningf("User was deleted already, user id: %d, canceling request.", userID) 31 | sic.CustomAbort(http.StatusUnauthorized, "") 32 | } 33 | username = u.Username 34 | } 35 | sic.Data["AuthMode"] = sic.AuthMode 36 | sic.Data["Username"] = username 37 | sic.Data["HasLoggedIn"] = hasLoggedIn 38 | sic.TplName = "sign-in.htm" 39 | sic.Render() 40 | } 41 | -------------------------------------------------------------------------------- /job/scheduler.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | 16 | package job 17 | 18 | import ( 19 | "github.com/vmware/harbor/utils/log" 20 | "time" 21 | ) 22 | 23 | var jobQueue = make(chan int64) 24 | 25 | // Schedule put a job id into job queue. 26 | func Schedule(jobID int64) { 27 | jobQueue <- jobID 28 | } 29 | 30 | // Reschedule is called by statemachine to retry a job 31 | func Reschedule(jobID int64) { 32 | log.Debugf("Job %d will be rescheduled in 5 minutes", jobID) 33 | time.Sleep(5 * time.Minute) 34 | log.Debugf("Rescheduling job %d", jobID) 35 | Schedule(jobID) 36 | } 37 | -------------------------------------------------------------------------------- /service/utils/utils.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | 16 | // Package utils contains methods to support security, cache, and webhook functions. 17 | package utils 18 | 19 | import ( 20 | "github.com/vmware/harbor/utils/log" 21 | "net/http" 22 | "os" 23 | ) 24 | 25 | // VerifySecret verifies the UI_SECRET cookie in a http request. 26 | func VerifySecret(r *http.Request) bool { 27 | secret := os.Getenv("UI_SECRET") 28 | c, err := r.Cookie("uisecret") 29 | if err != nil { 30 | log.Errorf("Failed to get secret cookie, error: %v", err) 31 | } 32 | return c != nil && c.Value == secret 33 | } 34 | -------------------------------------------------------------------------------- /static/resources/js/services/user/services.delete-user.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.services.user') 21 | .factory('DeleteUserService', DeleteUserService); 22 | 23 | DeleteUserService.$inject = ['$http', '$log']; 24 | 25 | function DeleteUserService($http, $log) { 26 | 27 | return DeleteUser; 28 | 29 | function DeleteUser(userId) { 30 | return $http 31 | .delete('/api/users/' + userId); 32 | } 33 | 34 | } 35 | 36 | })(); -------------------------------------------------------------------------------- /controllers/navigationheader.go: -------------------------------------------------------------------------------- 1 | package controllers 2 | 3 | import ( 4 | "net/http" 5 | 6 | "github.com/vmware/harbor/dao" 7 | "github.com/vmware/harbor/models" 8 | "github.com/vmware/harbor/utils/log" 9 | ) 10 | 11 | // NavigationHeaderController handles requests to /navigation_header 12 | type NavigationHeaderController struct { 13 | BaseController 14 | } 15 | 16 | // Get renders user's navigation header 17 | func (nhc *NavigationHeaderController) Get() { 18 | sessionUserID := nhc.GetSession("userId") 19 | var hasLoggedIn bool 20 | var isAdmin int 21 | if sessionUserID != nil { 22 | hasLoggedIn = true 23 | userID := sessionUserID.(int) 24 | u, err := dao.GetUser(models.User{UserID: userID}) 25 | if err != nil { 26 | log.Errorf("Error occurred in GetUser, error: %v", err) 27 | nhc.CustomAbort(http.StatusInternalServerError, "Internal error.") 28 | } 29 | if u == nil { 30 | log.Warningf("User was deleted already, user id: %d, canceling request.", userID) 31 | nhc.CustomAbort(http.StatusUnauthorized, "") 32 | } 33 | isAdmin = u.HasAdminRole 34 | } 35 | nhc.Data["HasLoggedIn"] = hasLoggedIn 36 | nhc.Data["IsAdmin"] = isAdmin 37 | nhc.TplName = "navigation-header.htm" 38 | nhc.Render() 39 | } 40 | -------------------------------------------------------------------------------- /static/resources/js/services/destination/services.delete-destination.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.services.destination') 21 | .factory('DeleteDestinationService', DeleteDestinationService); 22 | 23 | DeleteDestinationService.$inject = ['$http']; 24 | 25 | function DeleteDestinationService($http) { 26 | return deleteDestination; 27 | function deleteDestination(targetId) { 28 | return $http 29 | .delete('/api/targets/' + targetId); 30 | } 31 | } 32 | 33 | })(); -------------------------------------------------------------------------------- /vendor/github.com/docker/distribution/registry/api/errcode/handler.go: -------------------------------------------------------------------------------- 1 | package errcode 2 | 3 | import ( 4 | "encoding/json" 5 | "net/http" 6 | ) 7 | 8 | // ServeJSON attempts to serve the errcode in a JSON envelope. It marshals err 9 | // and sets the content-type header to 'application/json'. It will handle 10 | // ErrorCoder and Errors, and if necessary will create an envelope. 11 | func ServeJSON(w http.ResponseWriter, err error) error { 12 | w.Header().Set("Content-Type", "application/json; charset=utf-8") 13 | var sc int 14 | 15 | switch errs := err.(type) { 16 | case Errors: 17 | if len(errs) < 1 { 18 | break 19 | } 20 | 21 | if err, ok := errs[0].(ErrorCoder); ok { 22 | sc = err.ErrorCode().Descriptor().HTTPStatusCode 23 | } 24 | case ErrorCoder: 25 | sc = errs.ErrorCode().Descriptor().HTTPStatusCode 26 | err = Errors{err} // create an envelope. 27 | default: 28 | // We just have an unhandled error type, so just place in an envelope 29 | // and move along. 30 | err = Errors{err} 31 | } 32 | 33 | if sc == 0 { 34 | sc = http.StatusInternalServerError 35 | } 36 | 37 | w.WriteHeader(sc) 38 | 39 | if err := json.NewEncoder(w).Encode(err); err != nil { 40 | return err 41 | } 42 | 43 | return nil 44 | } 45 | -------------------------------------------------------------------------------- /auth/db/db.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | 16 | package db 17 | 18 | import ( 19 | "github.com/vmware/harbor/auth" 20 | "github.com/vmware/harbor/dao" 21 | "github.com/vmware/harbor/models" 22 | ) 23 | 24 | // Auth implements Authenticator interface to authenticate user against DB. 25 | type Auth struct{} 26 | 27 | // Authenticate calls dao to authenticate user. 28 | func (d *Auth) Authenticate(m models.AuthModel) (*models.User, error) { 29 | u, err := dao.LoginByDb(m) 30 | if err != nil { 31 | return nil, err 32 | } 33 | return u, nil 34 | } 35 | 36 | func init() { 37 | auth.Register("db_auth", &Auth{}) 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/docker/distribution/digest/verifiers.go: -------------------------------------------------------------------------------- 1 | package digest 2 | 3 | import ( 4 | "hash" 5 | "io" 6 | ) 7 | 8 | // Verifier presents a general verification interface to be used with message 9 | // digests and other byte stream verifications. Users instantiate a Verifier 10 | // from one of the various methods, write the data under test to it then check 11 | // the result with the Verified method. 12 | type Verifier interface { 13 | io.Writer 14 | 15 | // Verified will return true if the content written to Verifier matches 16 | // the digest. 17 | Verified() bool 18 | } 19 | 20 | // NewDigestVerifier returns a verifier that compares the written bytes 21 | // against a passed in digest. 22 | func NewDigestVerifier(d Digest) (Verifier, error) { 23 | if err := d.Validate(); err != nil { 24 | return nil, err 25 | } 26 | 27 | return hashVerifier{ 28 | hash: d.Algorithm().Hash(), 29 | digest: d, 30 | }, nil 31 | } 32 | 33 | type hashVerifier struct { 34 | digest Digest 35 | hash hash.Hash 36 | } 37 | 38 | func (hv hashVerifier) Write(p []byte) (n int, err error) { 39 | return hv.hash.Write(p) 40 | } 41 | 42 | func (hv hashVerifier) Verified() bool { 43 | return hv.digest == NewDigest(hv.digest.Algorithm(), hv.hash) 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/mqu/openldap/LICENCE.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2012 - Marc Quinton. 2 | 3 | Use of this source code is governed by the MIT Licence : 4 | http://opensource.org/licenses/mit-license.php 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | "Software"), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 21 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | -------------------------------------------------------------------------------- /static/resources/js/services/project/services.stat-project.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.services.project') 21 | .factory('StatProjectService', StatProjectService); 22 | 23 | StatProjectService.$inject = ['$http', '$log']; 24 | 25 | function StatProjectService($http, $log) { 26 | 27 | return StatProject; 28 | 29 | function StatProject() { 30 | $log.info('statistics projects and repositories'); 31 | return $http 32 | .get('/api/statistics'); 33 | } 34 | 35 | } 36 | 37 | })(); -------------------------------------------------------------------------------- /static/resources/js/services/search/services.search.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.services.search') 21 | .factory('SearchService', SearchService); 22 | 23 | SearchService.$inject = ['$http', '$log']; 24 | 25 | function SearchService($http, $log) { 26 | 27 | return search; 28 | 29 | function search(keywords) { 30 | return $http 31 | .get('/api/search',{ 32 | params: { 33 | 'q': keywords 34 | } 35 | }); 36 | } 37 | 38 | } 39 | 40 | })(); -------------------------------------------------------------------------------- /vendor/github.com/Sirupsen/logrus/hooks.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | // A hook to be fired when logging on the logging levels returned from 4 | // `Levels()` on your implementation of the interface. Note that this is not 5 | // fired in a goroutine or a channel with workers, you should handle such 6 | // functionality yourself if your call is non-blocking and you don't wish for 7 | // the logging calls for levels returned from `Levels()` to block. 8 | type Hook interface { 9 | Levels() []Level 10 | Fire(*Entry) error 11 | } 12 | 13 | // Internal type for storing the hooks on a logger instance. 14 | type LevelHooks map[Level][]Hook 15 | 16 | // Add a hook to an instance of logger. This is called with 17 | // `log.Hooks.Add(new(MyHook))` where `MyHook` implements the `Hook` interface. 18 | func (hooks LevelHooks) Add(hook Hook) { 19 | for _, level := range hook.Levels() { 20 | hooks[level] = append(hooks[level], hook) 21 | } 22 | } 23 | 24 | // Fire all the hooks for the passed level. Used by `entry.log` to fire 25 | // appropriate hooks for a log entry. 26 | func (hooks LevelHooks) Fire(level Level, entry *Entry) error { 27 | for _, hook := range hooks[level] { 28 | if err := hook.Fire(entry); err != nil { 29 | return err 30 | } 31 | } 32 | 33 | return nil 34 | } 35 | -------------------------------------------------------------------------------- /static/resources/js/services/user/services.list-user.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.services.user') 21 | .factory('ListUserService', ListUserService); 22 | 23 | ListUserService.$inject = ['$http', '$log']; 24 | 25 | function ListUserService($http, $log) { 26 | 27 | return listUser; 28 | 29 | function listUser(username) { 30 | return $http 31 | .get('/api/users', { 32 | 'params' : { 33 | 'username': username 34 | } 35 | }); 36 | } 37 | } 38 | })(); -------------------------------------------------------------------------------- /contrib/Configure_mirror.md: -------------------------------------------------------------------------------- 1 | # Configuring Harbor as a local registry mirror 2 | 3 | Harbor runs as a local registry by default. It can also be configured as a registry mirror, 4 | which caches downloaded images for subsequent use. Note that under this setup, the Harbor registry only acts as a mirror server and 5 | no longer accepts image pushing requests. Edit `Deploy/templates/registry/config.yml` before executing `./prepare`, and append a `proxy` section as follows: 6 | 7 | ``` 8 | proxy: 9 | remoteurl: https://registry-1.docker.io 10 | ``` 11 | In order to access private images on the Docker Hub, a username and a password can be supplied: 12 | 13 | ``` 14 | proxy: 15 | remoteurl: https://registry-1.docker.io 16 | username: [username] 17 | password: [password] 18 | ``` 19 | You will need to pass the `--registry-mirror` option to your Docker daemon on startup: 20 | 21 | ``` 22 | docker --registry-mirror=https:// daemon 23 | ``` 24 | For example, if your mirror is serving on `http://reg.yourdomain.com`, you would run: 25 | 26 | ``` 27 | docker --registry-mirror=https://reg.yourdomain.com daemon 28 | ``` 29 | 30 | Refer to the [Registry as a pull through cache](https://github.com/docker/distribution/blob/master/docs/mirror.md) for detailed information. 31 | -------------------------------------------------------------------------------- /static/resources/js/services/destination/services.list-destination-policy.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.services.destination') 21 | .factory('ListDestinationPolicyService', ListDestinationPolicyService); 22 | 23 | ListDestinationPolicyService.$inject = ['$http']; 24 | 25 | function ListDestinationPolicyService($http) { 26 | return listDestinationPolicy; 27 | function listDestinationPolicy(targetId) { 28 | return $http 29 | .get('/api/targets/' + targetId + '/policies/'); 30 | } 31 | } 32 | 33 | })(); -------------------------------------------------------------------------------- /static/resources/js/services/user/services.send-mail.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.services.user') 21 | .factory('SendMailService', SendMailService); 22 | 23 | SendMailService.$inject = ['$http', '$log']; 24 | 25 | function SendMailService($http, $log) { 26 | 27 | return SendMail; 28 | 29 | function SendMail(email) { 30 | return $http 31 | .get('/sendEmail', { 32 | 'params': { 33 | 'email': email 34 | } 35 | }); 36 | } 37 | 38 | } 39 | 40 | })(); -------------------------------------------------------------------------------- /static/resources/js/services/project/services.edit-project.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 'use strict'; 17 | 18 | angular 19 | .module('harbor.services.project') 20 | .factory('EditProjectService', EditProjectService); 21 | 22 | EditProjectService.$inject = ['$http', '$log']; 23 | 24 | function EditProjectService($http, $log) { 25 | 26 | return EditProject; 27 | 28 | function EditProject(projectId, isPublic) { 29 | return $http 30 | .put('/api/projects/' + projectId, { 31 | 'public': isPublic 32 | }); 33 | } 34 | } 35 | 36 | })(); -------------------------------------------------------------------------------- /static/resources/js/services/user/services.toggle-admin.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.services.user') 21 | .factory('ToggleAdminService', ToggleAdminService); 22 | 23 | ToggleAdminService.$inject = ['$http']; 24 | 25 | function ToggleAdminService($http) { 26 | 27 | return toggleAdmin; 28 | 29 | function toggleAdmin(userId, enabled) { 30 | return $http 31 | .put('/api/users/' + userId + '/sysadmin', { 32 | 'has_admin_role' : enabled 33 | }); 34 | } 35 | 36 | } 37 | 38 | })(); -------------------------------------------------------------------------------- /utils/log/record.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | 16 | package log 17 | 18 | import ( 19 | "time" 20 | ) 21 | 22 | // Record holds information about log 23 | type Record struct { 24 | Time time.Time // time when the log produced 25 | Msg string // content of the log 26 | Line string // in which file and line that the log produced 27 | Lvl Level // level of the log 28 | } 29 | 30 | // NewRecord creates a record according to the arguments provided and returns it 31 | func NewRecord(time time.Time, msg, line string, lvl Level) *Record { 32 | return &Record{ 33 | Time: time, 34 | Msg: msg, 35 | Line: line, 36 | Lvl: lvl, 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /static/resources/js/services/repository/services.list-tag.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.services.repository') 21 | .factory('ListTagService', ListTagService); 22 | 23 | ListTagService.$inject = ['$http', '$log']; 24 | 25 | function ListTagService($http, $log) { 26 | return ListTag; 27 | 28 | function ListTag(repoName) { 29 | return $http 30 | .get('/api/repositories/tags', { 31 | 'params': { 32 | 'repo_name': repoName 33 | } 34 | }); 35 | } 36 | } 37 | 38 | 39 | })(); -------------------------------------------------------------------------------- /static/resources/js/services/user/services.user-exist.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.services.user') 21 | .factory('UserExistService', UserExistService); 22 | 23 | UserExistService.$inject = ['$http', '$log']; 24 | 25 | function UserExistService($http, $log) { 26 | return userExist; 27 | function userExist(target, value) { 28 | return $.ajax({ 29 | type: 'POST', 30 | url: '/userExists', 31 | async: false, 32 | data: {'target': target, 'value': value} 33 | }); 34 | } 35 | } 36 | 37 | })(); -------------------------------------------------------------------------------- /vendor/github.com/astaxie/beego/grace/listener.go: -------------------------------------------------------------------------------- 1 | package grace 2 | 3 | import ( 4 | "net" 5 | "os" 6 | "syscall" 7 | "time" 8 | ) 9 | 10 | type graceListener struct { 11 | net.Listener 12 | stop chan error 13 | stopped bool 14 | server *Server 15 | } 16 | 17 | func newGraceListener(l net.Listener, srv *Server) (el *graceListener) { 18 | el = &graceListener{ 19 | Listener: l, 20 | stop: make(chan error), 21 | server: srv, 22 | } 23 | go func() { 24 | _ = <-el.stop 25 | el.stopped = true 26 | el.stop <- el.Listener.Close() 27 | }() 28 | return 29 | } 30 | 31 | func (gl *graceListener) Accept() (c net.Conn, err error) { 32 | tc, err := gl.Listener.(*net.TCPListener).AcceptTCP() 33 | if err != nil { 34 | return 35 | } 36 | 37 | tc.SetKeepAlive(true) 38 | tc.SetKeepAlivePeriod(3 * time.Minute) 39 | 40 | c = graceConn{ 41 | Conn: tc, 42 | server: gl.server, 43 | } 44 | 45 | gl.server.wg.Add(1) 46 | return 47 | } 48 | 49 | func (gl *graceListener) Close() error { 50 | if gl.stopped { 51 | return syscall.EINVAL 52 | } 53 | gl.stop <- nil 54 | return <-gl.stop 55 | } 56 | 57 | func (gl *graceListener) File() *os.File { 58 | // returns a dup(2) - FD_CLOEXEC flag *not* set 59 | tl := gl.Listener.(*net.TCPListener) 60 | fl, _ := tl.File() 61 | return fl 62 | } 63 | -------------------------------------------------------------------------------- /static/resources/js/services/project-member/services.current-project-member.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 17 | 'use strict'; 18 | 19 | angular 20 | .module('harbor.services.project.member') 21 | .factory('CurrentProjectMemberService', CurrentProjectMemberService); 22 | 23 | CurrentProjectMemberService.$inject = ['$http', '$log']; 24 | 25 | function CurrentProjectMemberService($http, $log) { 26 | return currentProjectMember; 27 | 28 | function currentProjectMember(projectId) { 29 | return $http 30 | .get('/api/projects/' + projectId + '/members/current'); 31 | } 32 | } 33 | 34 | })(); -------------------------------------------------------------------------------- /static/resources/js/services/project/services.add-project.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 VMware, Inc. All Rights Reserved. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | (function() { 16 | 'use strict'; 17 | 18 | angular 19 | .module('harbor.services.project') 20 | .factory('AddProjectService', AddProjectService); 21 | 22 | AddProjectService.$inject = ['$http', '$log']; 23 | 24 | function AddProjectService($http, $log) { 25 | 26 | return AddProject; 27 | 28 | function AddProject(projectName, isPublic) { 29 | return $http 30 | .post('/api/projects', { 31 | 'project_name': projectName, 32 | 'public': isPublic 33 | }); 34 | } 35 | } 36 | 37 | })(); -------------------------------------------------------------------------------- /vendor/github.com/go-sql-driver/mysql/AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the official list of Go-MySQL-Driver authors for copyright purposes. 2 | 3 | # If you are submitting a patch, please add your name or the name of the 4 | # organization which holds the copyright to this list in alphabetical order. 5 | 6 | # Names should be added to this file as 7 | # Name 8 | # The email address is not required for organizations. 9 | # Please keep the list sorted. 10 | 11 | 12 | # Individual Persons 13 | 14 | Aaron Hopkins 15 | Arne Hormann 16 | Carlos Nieto 17 | DisposaBoy 18 | Frederick Mayle 19 | Gustavo Kristic 20 | Hanno Braun 21 | James Harr 22 | Jian Zhen 23 | Julien Schmidt 24 | Leonardo YongUk Kim 25 | Lucas Liu 26 | Luke Scott 27 | Michael Woolnough 28 | Nicola Peduzzi 29 | Xiaobing Jiang 30 | Xiuming Chen 31 | 32 | # Organizations 33 | 34 | Barracuda Networks, Inc. 35 | Google Inc. 36 | -------------------------------------------------------------------------------- /vendor/github.com/docker/libtrust/filter.go: -------------------------------------------------------------------------------- 1 | package libtrust 2 | 3 | import ( 4 | "path/filepath" 5 | ) 6 | 7 | // FilterByHosts filters the list of PublicKeys to only those which contain a 8 | // 'hosts' pattern which matches the given host. If *includeEmpty* is true, 9 | // then keys which do not specify any hosts are also returned. 10 | func FilterByHosts(keys []PublicKey, host string, includeEmpty bool) ([]PublicKey, error) { 11 | filtered := make([]PublicKey, 0, len(keys)) 12 | 13 | for _, pubKey := range keys { 14 | var hosts []string 15 | switch v := pubKey.GetExtendedField("hosts").(type) { 16 | case []string: 17 | hosts = v 18 | case []interface{}: 19 | for _, value := range v { 20 | h, ok := value.(string) 21 | if !ok { 22 | continue 23 | } 24 | hosts = append(hosts, h) 25 | } 26 | } 27 | 28 | if len(hosts) == 0 { 29 | if includeEmpty { 30 | filtered = append(filtered, pubKey) 31 | } 32 | continue 33 | } 34 | 35 | // Check if any hosts match pattern 36 | for _, hostPattern := range hosts { 37 | match, err := filepath.Match(hostPattern, host) 38 | if err != nil { 39 | return nil, err 40 | } 41 | 42 | if match { 43 | filtered = append(filtered, pubKey) 44 | continue 45 | } 46 | } 47 | } 48 | 49 | return filtered, nil 50 | } 51 | -------------------------------------------------------------------------------- /vendor/github.com/astaxie/beego/docs.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 beego Author. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package beego 16 | 17 | import ( 18 | "github.com/astaxie/beego/context" 19 | ) 20 | 21 | // GlobalDocAPI store the swagger api documents 22 | var GlobalDocAPI = make(map[string]interface{}) 23 | 24 | func serverDocs(ctx *context.Context) { 25 | var obj interface{} 26 | if splat := ctx.Input.Param(":splat"); splat == "" { 27 | obj = GlobalDocAPI["Root"] 28 | } else { 29 | if v, ok := GlobalDocAPI[splat]; ok { 30 | obj = v 31 | } 32 | } 33 | if obj != nil { 34 | ctx.Output.Header("Access-Control-Allow-Origin", "*") 35 | ctx.Output.JSON(obj, false, false) 36 | return 37 | } 38 | ctx.Output.SetStatus(404) 39 | } 40 | --------------------------------------------------------------------------------