dart-archive / pub_server Goto Github PK
View Code? Open in Web Editor NEWReusable components for making a pub package server
Home Page: https://pub.dev/packages/pub_server
License: BSD 3-Clause "New" or "Revised" License
Reusable components for making a pub package server
Home Page: https://pub.dev/packages/pub_server
License: BSD 3-Clause "New" or "Revised" License
I need to publish libs to my personal pub, and I need "flutter packages get" by multiple source. Thanks
Take addUploader
as an example:
Future addUploader(String package, String userEmail);
We don't know information of the operator. How about changing it to:
Future addUploader(String package, String userEmail, {shelf.Request request});
Now we could get Google OAuth token from request.headers
then do permission things.
A few benefits:
info
event in such cases, and pub site admin would need to focus on less items (dart-lang/pub-dev#1456).pub
client could display them differently from unknown exceptions or unexpected errors from the pub site.flutter packages get
When we're ready
Error message I get is
UnauthorizedAccess: Unauthorized user: [email protected] is not allowed to upload versions to package redis..
While trying to upload redis package
https://pub.dartlang.org/packages/redis
I suspect it has something to do with email being capital. (at author -> [email protected] but for uploaded is [email protected] )
Since last upload I think I have replaced dart binaries so it is possible that bug is there (in pub)
D:\pub_server\pub_server>pub publish
Publishing pub_server 0.1.6-dev to https://pub.flutter-io.cn:
|-- .gitignore
|-- .idea
| |-- codeStyles
| | '-- Project.xml
| |-- libraries
| | |-- Dart_Packages.xml
| | '-- Dart_SDK.xml
| |-- misc.xml
| |-- modules.xml
| |-- pub_server.iml
| |-- vcs.xml
| '-- workspace.xml
|-- .travis.yml
|-- AUTHORS
|-- CHANGELOG.md
|-- LICENSE
|-- README.md
|-- analysis_options.yaml
|-- codereview.settings
|-- example
| |-- example.dart
| '-- src
| '-- examples
| |-- cow_repository.dart
| |-- file_repository.dart
| '-- http_proxy_repository.dart
|-- lib
| |-- repository.dart
| '-- shelf_pubserver.dart
|-- pubspec.yaml
'-- test
'-- shelf_pubserver_test.dart
Suggestions:
Package has 1 warning. Upload anyway (y/n)? y
Pub needs your authorization to upload packages on your behalf.
In a web browser, go to https://accounts.google.com/o/oauth2/auth?access_type=offline&approval_prompt=force&response_type=code&client_id=818368855108-8grd2eg9tj9f38os6f1urbcvsq399u8n.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A61995&scope=openid+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email
Then click "Allow access".
Waiting for your authorization...
Authorization received, processing...
It looks like accounts.google.com is having some trouble.
Pub will wait for a while before trying to connect again.
OS Error: 信号灯超时时间已到
, errno = 121, address = accounts.google.com, port = 62508
D:\pub_server\pub_server>pub publish
Publishing pub_server 0.1.6-dev to https://pub.flutter-io.cn:
|-- .gitignore
|-- .idea
| |-- codeStyles
| | '-- Project.xml
| |-- libraries
| | |-- Dart_Packages.xml
| | '-- Dart_SDK.xml
| |-- misc.xml
| |-- modules.xml
| |-- pub_server.iml
| |-- vcs.xml
| '-- workspace.xml
|-- .travis.yml
|-- AUTHORS
|-- CHANGELOG.md
|-- LICENSE
|-- README.md
|-- analysis_options.yaml
|-- codereview.settings
|-- example
| |-- example.dart
| '-- src
| '-- examples
| |-- cow_repository.dart
| |-- file_repository.dart
| '-- http_proxy_repository.dart
|-- lib
| |-- repository.dart
| '-- shelf_pubserver.dart
|-- pubspec.yaml
'-- test
'-- shelf_pubserver_test.dart
Suggestions:
Package has 1 warning. Upload anyway (y/n)? y
Pub needs your authorization to upload packages on your behalf.
In a web browser, go to https://accounts.google.com/o/oauth2/auth?access_type=offline&approval_prompt=force&response_type=code&client_id=818368855108-8grd2eg9tj9f38os6f1urbcvsq399u8n.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A63172&scope=openid+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email
Then click "Allow access".
Waiting for your authorization...
Authorization received, processing...
It looks like accounts.google.com is having some trouble.
Pub will wait for a while before trying to connect again.
OS Error: 信号灯超时时间已到
, errno = 121, address = accounts.google.com, port = 63891
Currently in order to host proprietary pub packages on a private pub server, the server must be behind a VPN. There is no way to require authentication for package downloads. Maven, npm, and Go all have ways of putting packages behind authentication barriers.
I saw no existing issue discussing this, so I figured I'd make one to get it on the Dart team's radar.
Great job on this one! I'm trying out this server using the original example. I was able to push a library A
without a problem but when calling pub get
from library B
which depends on A
it simply never finishes the resolving packages stage. This is due to the following exception:
ERROR - 2018-08-09 23:53:30.287675
Asynchronous error
type 'List<dynamic>' is not a subtype of type 'List<Map<dynamic, dynamic>>' in type cast
dart:core Object._as
example/src/examples/http_proxy_repository.dart 33:37 HttpProxyRepository.versions
===== asynchronous gap ===========================
example/src/examples/cow_repository.dart 135:18 _RemoteMetadataCache.fetchVersionlist.<fn>
dart:collection __InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent
example/src/examples/cow_repository.dart 131:10 _RemoteMetadataCache.fetchVersionlist
example/src/examples/cow_repository.dart 47:35 CopyAndWriteRepository.versions.onListen
dart:async Stream.toList
package:pub_server/shelf_pubserver.dart 244:62 ShelfPubServer._listVersions
PS: Is there any plan to replicate all pub.dartlang.org functionality eventually? Including serving a website to browse packages, version, and documentation.
The client was originally designed to send Accept: application/vnd.pub.v2+json
, to support multiple versions of the API.
I've recently documented this in:
https://github.com/dart-lang/pub/blob/master/doc/repository-spec-v2.md
We should probably start responding Content-Type: application/vnd.pub.v2+json
to requests which carry Accept: application/vnd.pub.v2+json
.
We might have to interpret no accept header or application/json
accept header as to mean return Content-Type: application/json
with the version 2 format. We could likely do some logging and figure out of this is necessary and then document it in the API docs.
But just returning Content-Type: application/vnd.pub.v2+json
to requests with Accept: application/vnd.pub.v2+json
is a good start. It means clients can start to check the Content-Type
.
From @grouma on February 12, 2018 20:21
We currently expose the various versions through the API. It would also be useful to have the date and time the version was released.
Copied from original issue: dart-lang/pub-dev#979
When the server tries to find a package on the remote, it throws a typing error.
//type 'List' is not a subtype of type 'List<Map<dynamic, dynamic>>' in type cast example\src\examples\cow_repository.dart 135:18
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.